Comments (6)
If chezmoi does a
lookPath
before step 4, does that affect the resolution?
No. The lookup error is cached in the os/exec.Cmd
struct and is unaffected by other calls to os/exec.LookPath
. See https://github.com/golang/go/blob/go1.20.6/src/os/exec/exec.go#L418-L429.
from chezmoi.
We need to understand what you are seeing more explicitly before we can declare it as a bug or correct behaviour, therefore it is a support
request.
from chezmoi.
OK, this one is interesting. It's a "feature" of Go standard library's os/exec.Command
function. What's happening it:
- When chezmoi reads the external file, it creates the
os/exec.Cmd
structure for the git command to be run usingos/exec.Command
. os/exec.Command
immediately looks for thegit
command, which it doesn't find, asgit
is not yet installed. It then stores that not found error for later.- Later, chezmoi runs the
install-git.sh
script, which installsgit
. - Later, chezmoi calls
Run()
on theos/exec.Cmd
it created in step 1. Instead of checking again for the presence ofgit
in$PATH
, Go's standard library returns the not found error it saved at step 2.
I'll have a think about how to fix this.
from chezmoi.
I'm a bit puzzled as to why this was flagged as "support"
? I followed the manpage exactly, and the only deviation is that the prerequisite seems to be necessary for external sources rather than template expansion.
/usr/bin
is in PATH- Git is installed within the
run_before_
script to/user/bin/git
- The external sources are cloned after the
run_before_
scripts
Considering these factors, it seems logical that chezmoi should be able to locate git without any issues. It manages to do so when I run chezmoi apply
a second time. So, I'm left wondering why it doesn't work on the initial run.
To me, this situation appears to be a bug because the ideal scenario would be to install everything, including prerequisites and dotfiles, with a single command (like sh -c "$(curl -fsLS get.chezmoi.io/lb)" -- init --apply <username>
)
from chezmoi.
If chezmoi does a lookPath
before step 4, does that affect the resolution?
from chezmoi.
Thanks for the fast bugfix. You guys are amazing ! ❤️
from chezmoi.
Related Issues (20)
- Support for custom url request headers in .chezmoiexternal HOT 3
- msys2 not detected, bash scripts will run with windows shell HOT 2
- Customize the path for a single file HOT 3
- KeepassXC mode: "open" does not work with args ["--yubikey", "1:2343434"] HOT 1
- Way to add a file without `applying` HOT 4
- Using scripts on Windows? HOT 3
- FEATURE REQUEST: chezmoi mv HOT 3
- Add support to gopass multiline values HOT 2
- Setup branches inside config HOT 1
- New machine and some files just aren't there/claimed as unmanaged HOT 6
- Super Slow on my Windows HOT 1
- Chezmoi with NeoVim installed with Kickstarter and Lazy as Plugin Manager HOT 4
- Open editor with appropiate file extension when using template files HOT 1
- Chezmoi init works on Windows but not in Linux HOT 2
- chezmoi cd - modifies (breaks) shell environment HOT 2
- Wrong phonetics
- chezmoi: .chezmoiscripts/linux-install-packages.sh: inconsistent state HOT 3
- Windows template script is unexpectedly run on Linux HOT 2
- Installing on windows fails due to windows defender HOT 5
- Windows Defender on Windows 11 reported chezmoi winget package as infected by Trojan:Win32/Wacatac.B!ml HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chezmoi.