bash history buffer output mangled after repeated up-arrow

Lowell Gilbert freebsd-questions-local at
Wed Apr 25 18:11:05 UTC 2018

tech-lists at writes:

> hi,
> 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
> history:
> 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
> history.
> 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?

It doesn't happen to me.

Maybe you've got something weird in your .profile?

More information about the freebsd-questions mailing list