Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merging file outside source directory leads to panic message and stacktrace dump #3585

Closed
ErrrorMaxx opened this issue Feb 21, 2024 · 0 comments · Fixed by #3586
Closed

Merging file outside source directory leads to panic message and stacktrace dump #3585

ErrrorMaxx opened this issue Feb 21, 2024 · 0 comments · Fixed by #3586
Labels
bug Something isn't working

Comments

@ErrrorMaxx
Copy link

ErrrorMaxx commented Feb 21, 2024

Describe the bug

Tried to run merge on file that is not in source directory. Got panic message and long stacktrace dump instead of simple error message

To reproduce

Run chezmoi merge *file not in source directory*

Expected behavior

Simple error message like chezmoi: {FILE}: not in source state

Output of command with the --verbose flag

$ chezmoi merge .zshrc --verbose
panic: .zshrc: not in source state

goroutine 1 [running]:
github.com/twpayne/chezmoi/v2/internal/chezmoi.(*SourceState).MustEntry(0x400027f000?, {{0x40007498b1?, 0x40002ebf00?}})
        /home/builder/.termux-build/chezmoi/build/src/github.com/twpayne/chezmoi/internal/chezmoi/sourcestate.go:800 +0xb0
github.com/twpayne/chezmoi/v2/internal/cmd.(*Config).runMergeCmd(0x64ef6f3540?, 0x40000f6900?, {0x40002ebf00?, 0x0?, 0x0?}, 0x0?)
        /home/builder/.termux-build/chezmoi/build/src/github.com/twpayne/chezmoi/internal/cmd/mergecmd.go:50 +0x98
github.com/twpayne/chezmoi/v2/internal/cmd.(*Config).newMergeCmd.(*Config).makeRunEWithSourceState.func2(0x40000fb800?, {0x40002ebf00, 0x1, 0x2})
        /home/builder/.termux-build/chezmoi/build/src/github.com/twpayne/chezmoi/internal/cmd/config.go:1528 +0x88
github.com/spf13/cobra.(*Command).execute(0x40000f6900, {0x40002ebee0, 0x2, 0x2})
        /home/builder/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:983 +0x840
github.com/spf13/cobra.(*Command).ExecuteC(0x400056b200)
        /home/builder/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1115 +0x344
github.com/spf13/cobra.(*Command).Execute(...)
        /home/builder/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1039
github.com/twpayne/chezmoi/v2/internal/cmd.(*Config).execute(0x400071fd08?, {0x400003c050, 0x3, 0x3})
        /home/builder/.termux-build/chezmoi/build/src/github.com/twpayne/chezmoi/internal/cmd/config.go:1197 +0x70
github.com/twpayne/chezmoi/v2/internal/cmd.runMain({{0x64ed98f120, 0x6}, {0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}}, {0x400003c050, 0x3, ...})
        /home/builder/.termux-build/chezmoi/build/src/github.com/twpayne/chezmoi/internal/cmd/cmd.go:296 +0x180
github.com/twpayne/chezmoi/v2/internal/cmd.Main({{0x64ed98f120, 0x6}, {0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}}, {0x400003c050?, 0x3, ...})
        /home/builder/.termux-build/chezmoi/build/src/github.com/twpayne/chezmoi/internal/cmd/cmd.go:111 +0x60
main.main()
        /home/builder/.termux-build/chezmoi/build/src/github.com/twpayne/chezmoi/main.go:24 +0xd8

Output of chezmoi doctor

$ chezmoi doctor
RESULT    CHECK                       MESSAGE
warning   version                     v2.46.1
ok        latest-version              v2.46.1
ok        os-arch                     android/arm64
ok        uname                       Linux localhost 4.19.191+ #1 SMP PREEMPT Wed Nov 29 21:44:22 CST 2023 aarch64 Android
ok        go-version                  go1.21.6 (gc)
ok        executable                  /data/data/com.termux/files/usr/bin/chezmoi
ok        config-file                 ~/.config/chezmoi/chezmoi.toml, last modified 2024-02-21T09:15:20Z
warning   source-dir                  /sdcard/.dots is a git working tree (dirty)
ok        suspicious-entries          no suspicious entries
warning   working-tree                /sdcard/.dots is a git working tree (dirty)
ok        dest-dir                    ~ is a directory
warning   umask                       077
ok        cd-command                  found /data/data/com.termux/files/usr/bin/zsh
ok        cd-args                     /data/data/com.termux/files/usr/bin/zsh
info      diff-command                not set
ok        edit-command                found /data/data/com.termux/files/usr/bin/micro
ok        edit-args                   micro
ok        git-command                 found /data/data/com.termux/files/usr/bin/git, version 2.43.2
warning   merge-command               vimdiff not found in $PATH
ok        shell-command               found /data/data/com.termux/files/usr/bin/zsh
ok        shell-args                  /data/data/com.termux/files/usr/bin/zsh
info      age-command                 age not found in $PATH
ok        gpg-command                 found /data/data/com.termux/files/usr/bin/gpg2, version 2.4.4
info      pinentry-command            not set
info      1password-command           op not found in $PATH
info      bitwarden-command           bw not found in $PATH
info      bitwarden-secrets-command   bws not found in $PATH
info      dashlane-command            dcli not found in $PATH
info      doppler-command             doppler not found in $PATH
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      rbw-command                 rbw not found in $PATH
info      vault-command               vault not found in $PATH
info      vlt-command                 vlt not found in $PATH
info      secret-command              not set
@twpayne twpayne added the bug Something isn't working label Feb 21, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants