Closed vbrand1984 closed 1 week ago
I tried to reproduce this but was unsuccessful. In my test chezmoi executes scripts correctly from scriptTempDir
. See #3858.
chezmoi: .config/openbox/rc.xml: fork/exec /tmp/2252122799.rc.xml: permission denied
rc.xml
is a strange name for a script. Do you really have a file in your source directory called dot_config/openbox/run_rc.xml
? Are you sure chezmoi is the problem here?
rc.xml is a strange name for a script. Do you really have a file in your source directory called dot_config/openbox/run_rc.xml?
Yes, it is this modify_
script for Openbox configuration. It removes the <keyboard>
tag from the file and replaces it with the <xi:include>
tag. But it works just fine by itself. The issue affects also run_
scripts from the .chezmoiscripts
directory, it's just that modify_
script appears to be the first one in the chain.
I have four systems on my desktop PC: Gentoo, Void Linux, Debian 12 and Devuan 5. I can reproduce the issue with my configuration (the dots, .chezmoi.toml.tmpl) on all of them. The configuration is a little bit messy as of now, but it works fine in all my systems (and on my laptop with Debian 12), unless the TMPDIR
variable declaration in the [scriptEnv]
section is deleted/commented. In that case, the aforementioned "permission denied" error emerges. And this is despite the scriptTempDir
variable is specified in that same .chezmoi.toml.tmpl
file. Deleting it causes no effect, it seems that only the TMPDIR
environment variable is what matters in my config.
On all my systems, I mount /tmp
via /etc/fstab
as following:
tmpfs /tmp tmpfs noatime,nosuid,nodev,noexec,mode=1777,size=8G 0 0
Anyways, thank you for your effort and time investment!
EDIT: Here is the output of chezmoi doctor
in my other systems:
EDIT2: In Gentoo, chezmoi's version lags behind because I install it via an ebuild from the guru overlay, and it is somewhat slow with upgrades.
UPDATE. I've performed some more tests and it seems that I was kinda wrong regarding the circumstances needed to reproduce this issue. The scriptTempDir
variable actually works well with the run_before_
and run_after_
scripts from the .chezmoiscripts
directory. But it isn't applied when the modify_
script is run.
Thanks for the investigation. This is definitely a bug.
Describe the bug
The
scriptTempDir
variable in the chezmoi config file seems to have no effect, and even if it is specified, chezmoi nevertheless tries to copy scripts in the/tmp
directory and run them from there. This is an issue when/tmp
is mounted with thenoexec
option, and despite the solution is described in chezmoi docs, it seems to not work.Although adding following lines in
~/.config/chezmoi/chezmoi.toml
does the thing and everything is working as intended afterwards, i.e. scripts are copied into the specified directory and executed flawlessly:To reproduce
Mount
/tmp
with thenoexec
option:And then run
chezmoi
while having any of themodify_
orrun_
scripts in the source tree:The output:
Although the
scriptTempDir
variable is set:Expected behavior
chezmoi should copy the scripts in the directory specified in the
scriptTempDir
configuration variable, as it is described in the docs.Output of
chezmoi doctor