bash history buffer output mangled after repeated up-arrow

tech-lists at tech-lists at
Wed Apr 25 14:26:09 UTC 2018


I've noticed now, for a while (like maybe over a year) that if you're in
bash shell, hitting up-arrow (which usually loads history -1) multiple
times will result in part of history becoming the prompt.

I use csh as login shell now because csh doesn't have this problem.

I can re-create the issue by logging in then doing the following:
% bash
$ . .profile
hit uparrow a few times (in this case, 15 times), it gets to this in its
bzcat /var/log/messages.1.bz2 |less

prompt is now:
[john at desktop ~]$ bzcat /var<--cursor is here waiting for input

[keep hitting up arrow]
now it's [john at desktop ~]$ ls -lah .g[history] where [history] is 
find /usr/src/sys/sys/param.h -mtime; echo

backspacing to (in this case) [john at desktop ~]$ ls -lah .g (which is as
far as one can backspace on that line) and hitting return, restored the 
normal prompt position. Repeatedly hitting up-arrow mangles bash

it doesn't happen in csh. Not tried other shells. It only happens on
freebsd boxes (11-stable and later). I've not seen it happen on linuxen 
(raspabian, mint, ubuntu, centos). It doesn't matter if bash is built from 
source or installed via pkg. Doesn't matter if fdescfs is mounted or not.
It still happens if I create a fresh freebsd-11-stable VM, log into it,
install bash.

Any ideas?

More information about the freebsd-questions mailing list