twpayne / chezmoi

Manage your dotfiles across multiple diverse machines, securely.
https://www.chezmoi.io/
MIT License
12.63k stars 475 forks source link

Adding .local/bin hangs #3838

Closed dabrown645 closed 1 month ago

dabrown645 commented 1 month ago

Describe the bug

chezmoi add .local/bin hangs and doesn't add directory contents.

To reproduce

I have my commands in .local/bin and when I tried to add them the command just hangs and I have to to get out.

chezmoi add .local/bin

Expected behavior

Expected that the contents of .local/bin added to .local/share/chezmoi

Output of command with the --verbose flag

$ chezmoi --verbose add .local/bin
(system hangs no output)

Output of chezmoi doctor

```console ❯ chezmoi doctor RESULT CHECK MESSAGE ok version v2.49.1, commit b4b55659c69fb13a502903c16dcdd566b988eece, built at 2024-06-23T12:28:09Z, built by goreleaser ok latest-version v2.49.1 ok os-arch linux/amd64 (Garuda Linux) ok uname Linux rog1 6.9.6-zen1-1-zen #1 ZEN SMP PREEMPT_DYNAMIC Fri, 21 Jun 2024 19:48:59 +0000 x86_64 GNU/Linux ok go-version go1.22.4 (gc) ok executable ~/.local/bin/chezmoi ok upgrade-method replace-executable ok config-file no config file found 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 warning umask 027 ok cd-command found /bin/zsh ok cd-args /bin/zsh info diff-command not set ok edit-command found /usr/bin/nvim ok edit-args /usr/bin/nvim ok git-command found /usr/bin/git, version 2.45.2 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.4.5 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 ```

Additional context

Add any other context about the problem here.

twpayne commented 1 month ago

You need to provide sufficient information for someone else to reproduce the problem.

dabrown645 commented 1 month ago

I figured out what is going on chezmoi installs itself in $HOME/bin but I keep my pgms in .local/bin which is in my path so I moved chezmoi there and tried to add .local/bin with chezmoi and it hangs.

I happened to get interrupted after executing "chezmoi add .local/bin" and when I get back there were the following chezmoi msgs:

❯ bin/chezmoi add .local/bin chezmoi: /home/dabrown/.local/bin/chezmoi:84001: Detected a Generic API Key, potentially exposing access to various services and sensitive operations. chezmoi: /home/dabrown/.local/bin/chezmoi:159915: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

twpayne commented 1 month ago

Ah, thank you! This is really helpful.

The tl;dr is that chezmoi's secret scanning is detecting secrets in chezmoi's own binary, which leads to the warning/hang.

The fix is likely for chezmoi add to skip anything with chezmoi in the path, but I need to think about this.

Thank you!