twpayne/chezmoi

chezmoi writes garbage to terminal when exiting

Closed this issue · 7 comments

Describe the bug

A clear and concise description of what the bug is.

Running any command, e.g. cz git pull or cz diff will end with the terminal bell being triggered (or it's something else that looks like visual bell on urxvt), and the prompt is preloaded with ddd;1R:

~ $ cz status
 M .bash_profile
 M .config/conky/conkyrc
 M .config/conky/conkyrc_carter
 M .ssh/config
~ $ ddd;1R

Note that I did not type anything but cz status⤶.

To reproduce

Any command should work.

Expected behavior

Just normal command output.

Output of command with the --verbose flag

~ $ cz --verbose status
 M .bash_profile
 M .config/conky/conkyrc
 M .config/conky/conkyrc_carter
 M .ssh/config
~ $ ddd;1R

Output of chezmoi doctor

$ cz doctor
RESULT   CHECK                       MESSAGE
ok       version                     v2.52.2, commit f91dbfc2256b59c003ecdf28815a265e48eeecc3, built at 2024-09-10T00:13:37Z, built by goreleaser
ok       latest-version              v2.52.2
ok       os-arch                     linux/amd64 (Debian GNU/Linux)
ok       uname                       Linux workdog 6.10.9-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.10.9-1 (2024-09-08) x86_64 GNU/Linux
ok       go-version                  go1.23.1 (gc)
ok       executable                  ~/bin/chezmoi
ok       upgrade-method              replace-executable
ok       config-file                 ~/.config/chezmoi/chezmoi.toml, last modified 2024-06-07T14:35:51+02:00
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                       002
ok       cd-command                  found /bin/bash
ok       cd-args                     /bin/bash
info     diff-command                not set
ok       edit-command                found /usr/bin/vi
ok       edit-args                   /usr/bin/vi
ok       git-command                 found /usr/bin/git, version 2.45.2
ok       merge-command               found /usr/bin/vimdiff
ok       shell-command               found /bin/bash
ok       shell-args                  /bin/bash
info     age-command                 age not found in $PATH
ok       gpg-command                 found /usr/bin/gpg, version 2.2.43
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
~ $ ddd;1R

Additional context

Recent update (today). The command didn't do this before. Unfortunately, I don't remember what my old version was. Probably something near 2.49.

rxvt-unicode is 9.31-3+b1 (Debian Trixie aka testing).

Please provide sufficient information for someone else to reproduce the problem.

Please provide sufficient information for someone else to reproduce the problem.

I don't know how to do that? If I knew the very specifics, I would have shared them (or proposed a fix). So far, I know it happens with v2.52.2 on urxvt, but not with 2.48.0 or inside of tmux. I'll try and bisect this, but it will take some time.

This is almost certainly a problem with your local configuration. There have not been any changes to chezmoi's terminal handling in a long time.

I would check your shell prompt, terminal settings, and any pagers that you have configured.

4667419 is the first bad commit. Looking at the deps changed there, bubbletea stands out as the likely culprit. Checking out that commit and reverting bubbletea to v0.27.0 makes the problem go away. So this is an upstream bug. I'll go there for help.

Thank you for the investigation. Note that this may already be fixed by #3940. It's worth checking the latest master branch of chezmoi, which uses bubbletea v1.1.1, not v0.27.0.

Ok, this is triggered by enabling transparency in urxvt via (.Xresources):

RemoteIRC*background: rgba:0000/0000/0000/dddd

Changing that to:

RemoteIRC*background: black

"fixes" the problem.

I am pretty sure this is either a bug in urxvt/urxvt's terminfo file, or in bubbletea. I am not keen on delving into the horrors of terminfo again, so I'll just ditch transparency on urxvt and call it a day. This machine will be moved to Wayland (and thus a different terminal emulator) soon anyway.