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

git module seems to break stderr #1869

Closed
gnuletik opened this issue Oct 21, 2020 · 7 comments
Closed

git module seems to break stderr #1869

gnuletik opened this issue Oct 21, 2020 · 7 comments

Comments

@gnuletik
Copy link

gnuletik commented Oct 21, 2020

Description

When enabling the git module, the stderr output occasionally breaks and nothing is printed on the terminal.

Expected behavior

When writing to stderr, it should be printed into the terminal.

Steps to Reproduce

It's quite hard to reproduce this bug. I tried many different scenarios but I didn't found any simple steps to reproduce it.

cd some-git-repo
# write some commands to generate the issue
# e.g.
~/c/i/f/s/d/a/www ❯❯❯ e                                                     master ✭ ✱ ◼
zsh: command not found: nano
~/c/i/f/s/d/a/www ❯❯❯ e                                               ✘ 127 master ✭ ✱ ◼
zsh: command not found: nano
~/c/i/f/s/d/a/www ❯❯❯ e                                               ✘ 127 master ✭ ✱ ◼
zsh: command not found: nano
~/c/i/f/s/d/a/www ❯❯❯ e                                               ✘ 127 master ✭ ✱ ◼
zsh: command not found: nano
~/c/i/f/s/d/a/www ❯❯❯ eee                                             ✘ 127 master ✭ ✱ ◼
zsh: command not found: eee
~/c/i/f/s/d/a/www ❯❯❯ e                                               ✘ 127 master ✭ ✱ ◼
zsh: command not found: nano
~/c/i/f/s/d/a/www ❯❯❯ e                                               ✘ 127 master ✭ ✱ ◼
zsh: command not found: nano
~/c/i/f/s/d/a/www ❯❯❯ eeee                                            ✘ 127 master ✭ ✱ ◼
zsh: command not found: eeee
~/c/i/f/s/d/a/www ❯❯❯ e                                               ✘ 127 master ✭ ✱ ◼
zsh: command not found: nano
~/c/i/f/s/d/a/www ❯❯❯ e                                               ✘ 127 master ✭ ✱ ◼
zsh: command not found: nano
~/c/i/f/s/d/a/www ❯❯❯ e                                               ✘ 127 master ✭ ✱ ◼

# At some point, nothing is printed to stderr

~/c/i/f/s/d/a/www ❯❯❯ eeeee                                           ✘ 127 master ✭ ✱ ◼
~/c/i/f/s/d/a/www ❯❯❯ echo test 1>&2                                  ✘ 127 master ✭ ✱ ◼

# But stdout seems to work fine

~/c/i/f/s/d/a/www ❯❯❯ echo test                                       ✘ 127 master ✭ ✱ ◼
test

Sometimes, I just cd into a git repository, and the issue occurs.

I tried to disable the git module and I could not reproduce the issue.

Versions

  • Prezto commit: 0a40549
  • ZSH version: zsh 5.8
  • OS information: Archlinux (kernel 5.9.1-arch1-1)
@srijanshetty
Copy link
Collaborator

@gnuletik I'm not sure what is causing this issue but I know a fix for this. nano is the default editor for git. You should update your $EDITOR to either vim or emacs to fix this issues or just update global git config to specific a different EDITOR.

@gnuletik
Copy link
Author

gnuletik commented Oct 26, 2020

Hi @srijanshetty

Thanks for the answer !
The $EDITOR variable was already set but setting the $VISUAL variable fixed the default editor for git.

However, the issue still appears when spamming other commands.

zsh: command not found: CD
~/c/i/f/s/d/a/www ❯❯❯ S                                                                                                                                             ✘ 127 dev ✭ ◼
zsh: command not found: S
~/c/i/f/s/d/a/www ❯❯❯ A                                                                                                                                             ✘ 127 dev ✭ ◼
zsh: command not found: A
~/c/i/f/s/d/a/www ❯❯❯ A                                                                                                                                             ✘ 127 dev ✭ ◼
zsh: command not found: A
~/c/i/f/s/d/a/www ❯❯❯ A                                                                                                                                             ✘ 127 dev ✭ ◼
zsh: command not found: A
~/c/i/f/s/d/a/www ❯❯❯                                                                                                                                               ✘ 127 dev ✭ ◼
~/c/i/f/s/d/a/www ❯❯❯ a                                                                                                                                             ✘ 127 dev ✭ ◼
zsh: command not found: a
~/c/i/f/s/d/a/www ❯❯❯ a                                                                                                                                             ✘ 127 dev ✭ ◼
zsh: command not found: a

# and now stderr is broken

~/c/i/f/s/d/a/www ❯❯❯ a                                                                                                                                             ✘ 127 dev ✭ ◼
~/c/i/f/s/d/a/www ❯❯❯                                                                                                                                               ✘ 127 dev ✭ ◼
~/c/i/f/s/d/a/www ❯❯❯                                                                                                                                               ✘ 127 dev ✭ ◼

~/c/i/f/s/d/a/www ❯❯❯ a                                                                                                                                             ✘ 127 dev ✭ ◼
~/c/i/f/s/d/a/www ❯❯❯ echo test 1>&2                                                                                                                                ✘ 130 dev ✭ ◼
~/c/i/f/s/d/a/www ❯❯❯ echo test                                                                                                                                           dev ✭ ◼
test

# stdout still works

NB: I cannot reopen the issue.

Also, the issue do not appears with oh-my-zsh.

@belak belak reopened this Oct 26, 2020
@belak
Copy link
Collaborator

belak commented Oct 26, 2020

My current guess is that something in our git-info function or the external zsh-async are using stderr redirection with a command stored in a variable and that var is somehow unset sometimes.

I think we've had similar issues with people holding down Control C...

Does this seem correlated to how quickly you rerun the command, or is that not a factor?

@gnuletik
Copy link
Author

Hi @belak,

Thanks for the answer.

Holding Ctrl-C do not reproduce the problem.

I tried this test

  • cd into git repo
  • press 'a'
  • Wait half a second
  • press enter
  • Wait half a second
  • Go back to the "press 'a'" step

The issue occurred after 40 occurrences.
I repeated the tests faster multiple times, sometimes it occurs after 5 occurrences, sometimes after 40.

So, it does not seems correlated to how quickly I rerun the command.

Thanks!

@gdetrez
Copy link
Contributor

gdetrez commented May 11, 2021

Hej! I was just digging into the same problem and found this issue. In my case it looks like the reason is a redirected stderr (as @belak correctly guessed):

❯❯❯ ls -l /proc/self/fd
lrwx------ 64 gregoire 11 maj 13:58 0 -> /dev/pts/8
lrwx------ 64 gregoire 11 maj 13:58 1 -> /dev/pts/8
l-wx------ 64 gregoire 11 maj 13:58 2 -> /dev/null

There's a related issue in zsh-async which has been fixed in recent releases. So I locally updated the submodule to v1.8.5 in the hope that it'll fix this (annoying) issue (and won't break anything else) 🤞

@indrajitr
Copy link
Collaborator

Just updated async to 1.8.5 via #1926. This was in my backlog for a while.
Let's keep an eye on how this goes. We can roll back if we find a regression.

@indrajitr
Copy link
Collaborator

Closing, assuming #1926 fixed this. @gnuletik, please feel free to reopen if you still continue to face this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants