MSYS2-packages: Arrow keys and backspace not working in bash after recent update
Today I ran pacman -Syu
which upgraded the following packages (from the end of /var/log/pacman.log
):
[2018-01-30 11:56] [ALPM] upgraded mpfr (3.1.5.1-3 -> 4.0.0.1-3)
[2018-01-30 11:56] [ALPM] upgraded gcc-libs (6.4.0-1 -> 6.4.0-2)
[2018-01-30 11:56] [ALPM] upgraded ncurses (6.0.20170708-2 -> 6.1.20180127-1)
[2018-01-30 11:56] [ALPM] upgraded gawk (4.1.4-2 -> 4.2.0-1)
[2018-01-30 11:56] [ALPM] upgraded isl (0.16.1-1 -> 0.18-1)
[2018-01-30 11:56] [ALPM] upgraded mpc (1.0.3-1 -> 1.1.0-1)
[2018-01-30 11:56] [ALPM] upgraded msys2-w32api-headers (5.0.0.4961.e09dd4ca-1 -> 6.0.0.5097.36d7b92b-1)
[2018-01-30 11:56] [ALPM] upgraded msys2-w32api-runtime (5.0.0.4961.e09dd4ca-1 -> 6.0.0.5097.36d7b92b-1)
[2018-01-30 11:56] [ALPM] upgraded gcc (6.4.0-1 -> 6.4.0-2)
[2018-01-30 11:56] [ALPM] upgraded ncurses-devel (6.0.20170708-2 -> 6.1.20180127-1)
[2018-01-30 11:56] [ALPM] upgraded wget (1.19.2-1 -> 1.19.3-1)
After this update the arrow keys and backspace don’t work correctly at the shell input line, in a weird way.
I tried the following with and without a ~/.bashrc
file:
Pressing few chars and then a backspace seems to print a space. Up arrow works but then the shell doesn’t clean up the line with history inputs and just appends the history items to the line.
Left and right arrows at the shell prompt don’t skip chars as expected, but ctrl-v
and then pressing an arrow key does print a correct (I think) string, e.g. ctrl-v and then right arrow prints ^[[C
but the shell doesn’t seem to re-render the line correctly when used without it.
Up/down/left/right arrows while in less
(/usr/bin/less) does seem to work correctly.
It’s like the shell reads the keys correctly but not able to re-render the input line correctly. Maybe the ncurses update is at fault?
About this issue
- Original URL
- State: open
- Created 6 years ago
- Reactions: 4
- Comments: 38 (14 by maintainers)
Commits related to this issue
- bash: rebuild. See #1124 — committed to lazka/MSYS2-packages by lazka 6 years ago
- bash: rebuild. See #1124 — committed to lazka/MSYS2-packages by lazka 6 years ago
I do have the described issues as well. Changing
TERM
(e.g. toansi
) seems to fix everything, but it’s weirder than that:– David Macek
Just happened for me as well. Downgrading
ncurses
solved it for me.I checked my
/var/log/pacman.log
which ended with:So, somewhere between 2018-01-15 and 2018-01-30 this regression happened.
ncurses
seemed like the most suspicious upgrade, so I downgraded (see instructions on how to ignore package upgrades for certain packages) through:and in the next MSYS2 instance I started, terminal codes for backspace, delete, etc., worked as intended again.
I tried checking the
Backarrow sends ^H
andDelete sends DEL
settings in “broken” mode, but it did not seem to help, instead doing nothing when pressing those characters, if I recall correctly.I am using
TERM=xterm-256color
.Assuming ncurses 6.1 may break binary compatibility, it would need a rebuild of all packages which use ncurses. Bash is just the most visible of those (assuming there are more packages depending on ncurses).
#1128
Rebuild bash can fix the problem. Thank you for the information.
You could try the rebuilded bash at
https://ci.appveyor.com/project/zklhp/msys2-packages/build/1.0.16/artifacts
It’s because the default mintty TERM is
xterm
, and the issue appears to be related to TERM beingxterm-256color
- which is required for some programs to display more than 8 colors.FWIW, my original
/usr/bin/bash.exe
is from 2017-02-15, so almost a year old, and building a fresh one (same version4.4.12(1)-release (x86_64-pc-msys)
, using makepkg) did fix it for me. I also know of other people bumping into this issue, which, again, is quite a dealbreaker.