Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 554850

Summary: sys-libs/readline-6.3_p8-r2: Pressing delete key at end of line goes into command mode
Product: Gentoo Linux Reporter: ta2002 <throw_away_2002>
Component: [OLD] Core systemAssignee: Gentoo's Team for Core System packages <base-system>
Status: UNCONFIRMED ---    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: del.log created as requested
command output as requested

Description ta2002 2015-07-14 09:46:08 UTC
Did recent upgrades to bash and readline (bash from 4.2_p53 to 4.3_p53, and readline from 6.2_p5-r1 to 6.3_p8-r2). Immediately started seeing very undesirable behavior when entering commands:

https://forums.gentoo.org/viewtopic-p-7778696.html

Basically with readline 6.3, pressing the delete key at the end of the line changes into command mode (do not want that at all).

Downgraded to bash 4.2_p53 (which I had to do because bash 4.3 requires readline 6.3). Problem was still there. Downgraded to readline 6.2_p5-r1. Problem went away and command line editing behaves as before.

# emerge --info
Portage 2.2.20 (python 3.3.5-final-0, default/linux/amd64/13.0/no-multilib, gcc-4.8.4, glibc-2.20-r2, 4.0.5-gentoo x86_64)
=================================================================
System uname: Linux-4.0.5-gentoo-x86_64-Intel-R-_Core-TM-2_Quad_CPU_Q8400_@_2.66GHz-with-gentoo-2.2
KiB Mem:     8016936 total,   2363760 free
KiB Swap:    1047548 total,   1047548 free
Timestamp of repository gentoo: Tue, 14 Jul 2015 02:30:01 +0000
sh bash 4.2_p53
ld GNU ld (Gentoo 2.24 p1.4) 2.24
app-shells/bash:          4.2_p53::gentoo
dev-java/java-config:     2.2.0::gentoo
dev-lang/perl:            5.20.2::gentoo
dev-lang/python:          2.7.9-r1::gentoo, 3.3.5-r1::gentoo, 3.4.1::gentoo
dev-util/cmake:           3.2.2::gentoo
dev-util/pkgconfig:       0.28-r2::gentoo
sys-apps/baselayout:      2.2::gentoo
sys-apps/openrc:          0.17::gentoo
sys-apps/sandbox:         2.6-r1::gentoo
sys-devel/autoconf:       2.69::gentoo
sys-devel/automake:       1.14.1::gentoo
sys-devel/binutils:       2.24-r3::gentoo
sys-devel/gcc:            4.8.4::gentoo
sys-devel/gcc-config:     1.7.3::gentoo
sys-devel/libtool:        2.4.6::gentoo
sys-devel/make:           4.1-r1::gentoo
sys-kernel/linux-headers: 3.18::gentoo (virtual/os-headers)
sys-libs/glibc:           2.20-r2::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -fomit-frame-pointer -pipe -march=core2 -mcx16 -msahf -msse4.1 --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=2048 -mfpmath=sse"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -fomit-frame-pointer -pipe -march=core2 -mcx16 -msahf -msse4.1 --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=2048 -mfpmath=sse"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j5"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
USE="64bit R X a52 aac aalib accessibility acoustid acpi additions adobe-cff aio alsa amd64 ap asf aspell audio audiofile avcodec avformat blksha1 bluray bookmarks bwscheduler bzip2 cacert cairo caps cdda cdio cdr chm chroot cli client consolekit cpumining cracklib crypt cryptsetup css cups cxx dbus device-mapper dga directfb djvu downloadorder dri dri3 dvbpsi dvd dvdnav dvdr ebook egl eigen encode espeak exceptions exif expat fam fbcon ffmpeg filecaps flac fluidsynth fontconfig fortran gbm gcj gcrypt ggi gif git glamor glib glibc-omitfp gmp gpg gphoto2 gpm gsm gstreamer gtk handbook hardcoded-tables hddtemp hpn iconv idea imap infowidget inotify iostats ipc ipfilter ipv6 jabber jbig jit joystick jpeg jsbsim kdcraw kde kmod kscreen lame lcms less libass libkms libmpv libwww live lm_sensors logviewer lzma mad matroska mbox mdns-bundled memlimit midi minizip mmx mmxext mp3 mp4 mpeg mta mudflap nas ncurses net netapi network nls no-old-linux nodrm npm nptl ntfsprogs ntp ocamlopt offlinehelp ofx ogg okular opengl openmedia openmp oscar osdmenu p2p pcre pdf pm-utils png policykit portmon postproc ps qt3support quotes raptor readline real recursion-limit redland rtc rtmp savedconfig scanfolder scanner scrypt sdl search secure-delete sensord shared-glapi shm silc smbclient smtp snapshot sndfile sound speex spell sse sse2 sse2_4way sse2check sse4 ssl ssse3 stats subversion svg swscale sysfs taglib tcmalloc tcpd theora threads threadsafe tiff tls-heartbeat truetype udev udisks unicode upower urandom usb userlocales utils v4l2 vdpau video vorbis wav webdav-neon webinterface x264 xcb xinerama xml xmp xpdf-headers xslt xv xvid yahoo zlib zrtp" ABI_X86="64" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="author braindump flow karbon krita sheets stage words" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="evdev" KERNEL="linux" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python3_4" PYTHON_TARGETS="python3_4" RUBY_TARGETS="ruby19 ruby20" USERLAND="GNU" VIDEO_CARDS="nouveau" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
Comment 1 SpanKY gentoo-dev 2015-07-18 14:45:35 UTC
please post all relevant details in the bug.  we don't want to deal with external links (even Gentoo sites).

post the output of `locale` and the exact steps to reproduce the issue.
Comment 2 ta2002 2015-07-19 18:15:21 UTC
For years (like about twenty of them) if I held down the "delete" key in the middle of a command, all of the characters to the right of the cursor would be removed one at a time until there were none left (and that was it).

After the upgrade to readline 6.3, if I hold down the delete key, the characters still disappear one at a time, but after the last character under the cursor is removed, editing goes into "command mode," the prompt disappears, and is replaced with "(arg: 3) [remainder of command line]"

The next press of the delete key restores the prompt, but each additional press now removes the character under the cursor, AND shifts the cursor one position to the left. After all of the characters are removed, the prompt is again replaced by "(arg: 3)" (followed by absolutely nothing).

This happens even pressing the delete key with an empty command line (using bash).
Comment 3 SpanKY gentoo-dev 2015-07-20 02:32:22 UTC
(In reply to throw_away_2002 from comment #2)

i use the delete key all the time and have never run into a problem

try building readline with sane CFLAGS to see if that makes the issue go away

do you have an ~/.inputrc file (or have customized /etc/inputrc) ?  if so, attach it here.

what terminal are you using exactly ?  what about your `locale` settings (as already requested) ?
Comment 4 ta2002 2015-07-20 10:49:06 UTC
(In reply to SpanKY from comment #3)

> try building readline with sane CFLAGS to see if that makes the issue go away

Please tell me which CFLAG you believe is not sane. Those are the DEFAULT CFLAGS.

$ gcc -march=native -Q -v -x c - < /dev/null

[...]

options passed:  -v - -march=core2 -mcx16 -msahf -mno-movbe -mno-aes
 -mno-pclmul -mno-popcnt -mno-abm -mno-lwp -mno-fma -mno-fma4 -mno-xop
 -mno-bmi -mno-bmi2 -mno-tbm -mno-avx -mno-avx2 -mno-sse4.2 -msse4.1
 -mno-lzcnt -mno-rtm -mno-hle -mno-rdrnd -mno-f16c -mno-fsgsbase
 -mno-rdseed -mno-prfchw -mno-adx -mfxsr -mno-xsave -mno-xsaveopt
 --param l1-cache-size=32 --param l1-cache-line-size=64
 --param l2-cache-size=2048 -mtune=core2 -fstack-protector

[...]

Actually, this was just suggested (even better):

$ gcc -### -E - -march=native 2>&1 | sed -r '/cc1/!d;s/(")|(^.* - )|( -mno-[^\ ]+)//g'

-march=core2 -mcx16 -msahf -msse4.1 -mfxsr --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=2048 -mtune=core2 -fstack-protector

Guess I need to add -mfxsr to my CFLAGS (I like to see defaults explicitly declared).


> do you have an ~/.inputrc file (or have customized /etc/inputrc) ?  if so,
> attach it here.

No ~/.inputrc, and /etc/inputrc is the default with sys-apps/baselayout-2.2. There is a ""\e[3~": delete-char" line, but it looks like it is in a "$if mode=emacs" block, and I have "set -o vi" in ~/.bashrc.

> what terminal are you using exactly ?  what about your `locale` settings (as
> already requested) ?

Happens on all terminals from the console to konsole.

Don't think there is anything interesting there (POSIX for sorting, end defaults for everything else), but since you asked:

$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE=POSIX
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"

Again, no problem in readline 6.2. Upgrading to 6.3 (no other changes) causes problem, downgrading fixes problem.
Comment 5 SpanKY gentoo-dev 2015-07-20 11:13:40 UTC
(In reply to throw_away_2002 from comment #4)

i'm not going to waste time debating compiler settings.  verify something simple like the following still causes the bug to occur:
  CFLAGS='-O2 -pipe'
Comment 6 SpanKY gentoo-dev 2015-07-20 11:27:45 UTC
if it still fails, try using typescript to post a session:
$ script del.log
$ export PS1='$ '
<do things to make the error happen, then exit the session>
now upload the del.log file here as an attachment

also what are your PS[1234] and PROMPT_COMMAND variables set to ?

you're doing this all locally correct ?  you aren't ssh-ing to a remote host ?

you're not using screen/tmux/etc... right ?
Comment 7 ta2002 2015-07-20 15:18:57 UTC
Created attachment 407270 [details]
del.log created as requested
Comment 8 ta2002 2015-07-20 15:20:37 UTC
(In reply to SpanKY from comment #5)
> (In reply to throw_away_2002 from comment #4)
> 
> i'm not going to waste time debating compiler settings.  verify something
> simple like the following still causes the bug to occur:
>   CFLAGS='-O2 -pipe'

No problem. I just wanted to make the points that I am not using "insane" CFLAGS (they are the defaults), and omitting the defaults is not going to change compiler behavior at all.

So I did exactly "CFLAGS='-O2 -pipe' emerge -1 readline" with no change in behavior.

(In reply to SpanKY from comment #6)
> if it still fails, try using typescript to post a session:
> $ script del.log
> $ export PS1='$ '
> <do things to make the error happen, then exit the session>
> now upload the del.log file here as an attachment

Should be attached (actually, I goofed that part up and created the attachment without the comment).

I did three things: 1. changed PS1 as requested. 2. hit delete immediately (which replaced the prompt with "(arg: 3)"), and 3. (after hitting carriage returns to restore the prompt), typed the numbers from one to nine (plus zero), and then moved the cursor left five spaces, and then continuously pressed the delete key. The behavior was the numbers six through zero were deleted as expected, then with the next press, command mode was entered (the bad part) with the prompt again replaced by "(arg: 3)", then (at the next press, the prompt was restored, but I was still in command mode where each press of the delete key deleted the number under the cursor AND moved the cursor one space to the left. When all of the numbers were gone, it behaved like pressing the delete key with an empty line (which I just did above).

> also what are your PS[1234] and PROMPT_COMMAND variables set to ?

I changed PS1 to '$ ' for testing (no difference) , but they are normally:

$ set | grep PS[1234]
PS1='\[\033[0;31m\][\t]\[\033[0;32m\][\h:]\[\033[0;35m\][\#]\[\033[0;36m\][\w]$\[\033[0;00m\] '
PS2='> '
PS4='+ '

> you're doing this all locally correct ?  you aren't ssh-ing to a remote host
> ?
> 
> you're not using screen/tmux/etc... right ?

All local. No ssh, screen, or tmux.
Comment 9 SpanKY gentoo-dev 2015-07-29 08:28:48 UTC
what does `stty -a` show ?  how about `set` ?  attach as logs as they'll be pretty spammy.
Comment 10 ta2002 2015-11-14 07:36:41 UTC
Created attachment 416906 [details]
command output as requested

Sorry, this fell off my radar for a while, and I had to "fix" my main machine by reverting, and installing the problem version on a less important machine.
Comment 11 ta2002 2018-01-05 11:32:41 UTC
Acknowledged upstream (with a claim that a fix was committed) here:

http://lists.gnu.org/archive/html/bug-readline/2017-05/msg00007.html

Won't see the fix until the next release, though. :(