brew: brew upgrade breaks terminal, requiring reset
Bug report:
Note: I have described the issue on StackExchange. No answer so far, so I thought I’d post it here.
When I run brew upgrade in my Bash shell, it breaks the terminal display (in both iTerm2 and Terminal) such that I can’t see anything I type in the following prompt and I can’t see the history. For example, here is what my terminal looks like after typing brew upgrade\necho hello\n at an empty prompt:
$ brew upgrade
$ hello
$
The only way I’ve found to fix the current terminal is to use reset.
The following do not cause this problem:
$ brew upgrade 1> /dev/null # piping stdout
$ brew upgrade | cat
However, I still see the problem with:
$ brew upgrade 2> /dev/null # piping stderr
I don’t see the problem in zsh.
I do have a custom prompt, but the problem still exists after disabling it by removing my .bashrc.
When I check the output for ANSI color codes, I don’t see any.
The problem might have started when I upgraded to OS X from Yosemite to El Capitan (10.11). It’s been some time, so I don’t remember exactly.
I suppose the problem might be discovered by reviewing the current Homebrew upgrade.rb code, but I wouldn’t know where to start.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 23 (10 by maintainers)
I can reproduce it on yosemite 10.10.5 after
echo edit on > ~/.editrcI was able to reproduce the issue after creating
~/.editrc(the single lineedit onwas sufficient). Notice how this not only affectsbrew upgrade, but alsobrew installand a few other Homebrew commands (but not all).The way
libeditis pulled into the Homebrew session is via thereadlineextension in Ruby, that is most prominently used by IRB, which in turn is used to power some of Homebrew’s interactive debug features during formula build. The IRB code is loaded even if those features aren’t used.I don’t understand yet why this is causing the observed behavior and I’m also unclear on what the intended effect of
edit onis (the documentation I found wasn’t exactly enlightening). Anyway, maybe this additional information helps others to investigate this further.