This bug has come to my attention from using Chezmoi.el package in Emacs, The package has a function called chezmoi-open-other which uses the chezmoi target-path $FILE to find the other file (Source file if you have the Home file open, Home file if you have the source file open)
If you have a different root set in .chezmoiroot, the target-path arg will direct to a file that has the changed root included:
/home/yourname/$ROOT/path/to/file
where as $ROOT should be excluded:
/home/yourname/path/to/file
Its easily fixed by not using .chezmoiroot and having everything in the default chezmoi location but i assume this isn't intended behavior.
```console
[ethan@ARCH-MSI-STEALTH ~]$ chezmoi doctor
RESULT CHECK MESSAGE
warning version v2.29.4, built at 2023-01-24T18:26:40Z
warning latest-version v2.30.0
ok os-arch linux/amd64 (Arch Linux)
ok uname Linux ARCH-MSI-STEALTH 6.1.8-arch1-1 #1 SMP PREEMPT_DYNAMIC Tue, 24 Jan 2023 21:07:04 +0000 x86_64 GNU/Linux
ok go-version go1.19.5 (gc)
ok executable /usr/bin/chezmoi
ok config-file ~/.config/chezmoi/chezmoi.toml, last modified 2023-02-07T13:47:49Z
ok source-dir ~/.local/share/chezmoi is a git working tree (clean)
ok suspicious-entries no suspicious entries
ok working-tree ~/.local/share/chezmoi is a git working tree (clean)
ok dest-dir ~ is a directory
ok umask 022
ok cd-command found /bin/zsh
ok cd-args /bin/zsh
info diff-command not set
ok edit-command found /usr/bin/emacs
ok edit-args /usr/bin/emacs
ok git-command found /usr/bin/git, version 2.39.1
warning merge-command vimdiff not found in $PATH
ok shell-command found /bin/zsh
ok shell-args /bin/zsh
info age-command age not found in $PATH
ok gpg-command found /usr/bin/gpg, version 2.2.40
info pinentry-command not set
info 1password-command op not found in $PATH
warning bitwarden-command found /usr/bin/bw, cannot parse version from Could not find dir, "~/.config/Bitwarden CLI"; creating it instead.
Could not find data file, "~/.config/Bitwarden CLI/data.json"; creating it instead.
2023.1.0
info gopass-command gopass not found in $PATH
info keepassxc-command keepassxc-cli not found in $PATH
info keepassxc-db not set
info keeper-command keeper not found in $PATH
info lastpass-command lpass not found in $PATH
info pass-command pass not found in $PATH
info passhole-command ph not found in $PATH
info vault-command vault not found in $PATH
info secret-command not set
```
Additional context
This hasn't effected normal dotfile operations, it seems to only effect the Emacs package that relys on this command to find the 'other' file. Although scripts made rely on this command will have the same unintended behavior. Thanks for all your hard work making this amazing piece of software.
Describe the bug
This bug has come to my attention from using Chezmoi.el package in Emacs, The package has a function called chezmoi-open-other which uses the
chezmoi target-path $FILE
to find the other file (Source file if you have the Home file open, Home file if you have the source file open)If you have a different root set in
.chezmoiroot
, the target-path arg will direct to a file that has the changed root included:/home/yourname/$ROOT/path/to/file
where as $ROOT should be excluded:/home/yourname/path/to/file
Its easily fixed by not using .chezmoiroot and having everything in the default chezmoi location but i assume this isn't intended behavior.
Link to issue opened on the chezmoi.el package
To reproduce
on a fresh arch VM with only chezmoi installed:
Expected behavior
when target-path is used, it returns the path without the addition of the changed chezmoi root.
Expected behavior with .chezmoiroot set to home:
Output of command with the
--verbose
flagOutput of
chezmoi doctor
Additional context
This hasn't effected normal dotfile operations, it seems to only effect the Emacs package that relys on this command to find the 'other' file. Although scripts made rely on this command will have the same unintended behavior. Thanks for all your hard work making this amazing piece of software.