Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 369937 - sys-libs/readline-6.1_p2 multibyte hang
Summary: sys-libs/readline-6.1_p2 multibyte hang
Status: RESOLVED NEEDINFO
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: AMD64 Linux
: Low normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-03 19:41 UTC by Dylan Simon
Modified: 2011-06-11 22:51 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dylan Simon 2011-06-03 19:41:57 UTC
When running dev-lang/R-2.10.0, it occasionally becomes unresponsive and the process starts spinning after pressing some key combination.  From gdb, it appears to be spinning inside readline _rl_char_search_internal (calling _rl_find_next_mbchar, _rl_adjust_point, mbrtowc in a loop).

I have not figured out exactly which key triggers this, and it may be specific to my terminal which is not multibyte aware.  Another (non-gentoo) system with the same versions but without multibyte readline has never had this problem.
This may well be an upstream bug.  The closest report I can find is http://lists.gnu.org/archive/html/bug-bash/2009-05/msg00098.html.  I will try this patch and also try --disable-multibyte and report any findings.
Comment 1 Jeroen Roovers (RETIRED) gentoo-dev 2011-06-07 17:15:58 UTC
Could very well be an issue in dev-lang/R I guess.

1) Please post your `emerge --info' output too.
2) Attach the gdb backtrace/output.
Comment 2 Dylan Simon 2011-06-07 18:38:14 UTC
I have now reproduced it using the rltest program that comes with readline, so it is not R:

gcc /usr/share/readline/rltest.c -g -lreadline -o rltest

(gdb) where
#0  0x00007fbbb97b47c0 in _rl_adjust_point@plt () from /lib64/libreadline.so.6
#1  0x00007fbbb97d3993 in _rl_find_next_mbchar () from /lib64/libreadline.so.6
#2  0x00007fbbb97cc6b6 in _rl_char_search_internal () from /lib64/libreadline.so.6
#3  0x00007fbbb97b6382 in _rl_dispatch_subseq () from /lib64/libreadline.so.6
#4  0x00007fbbb97b6ba0 in readline_internal_char () from /lib64/libreadline.so.6
#5  0x00007fbbb97b7095 in readline () from /lib64/libreadline.so.6
#6  0x0000000000400895 in main () at rltest.c:60

Stepping through for a while shows that it returns here without ever exiting _rl_char_search_internal.

I am unable to reproduce it using a readline ebuild that is identical except for an added econf  --disable-multibyte.  I don't see an easy way to pass -g into the readline build but I'll work on doing so to get a better idea what kind of input it's choking on.

Portage 2.1.9.42 (default/linux/amd64/10.0/no-multilib, gcc-4.4.5, libc-0-r0, 2.6.37-gentoo-r4 x86_64)
=================================================================
System uname: Linux-2.6.37-gentoo-r4-x86_64-Intel-R-_Core-TM-2_CPU_6600_@_2.40GHz-with-gentoo-2.0.2
Timestamp of tree: Mon, 06 Jun 2011 15:45:01 +0000
app-shells/bash:     4.1_p9
dev-java/java-config: 2.1.11-r3
dev-lang/python:     2.7.1-r1, 3.1.3-r1
dev-util/cmake:      2.8.4-r1
sys-apps/baselayout: 2.0.2
sys-apps/openrc:     0.8.2-r1
sys-apps/sandbox:    2.4
sys-devel/autoconf:  2.13, 2.65-r1
sys-devel/automake:  1.10.3, 1.11.1
sys-devel/binutils:  2.20.1-r1
sys-devel/gcc:       4.4.5
sys-devel/gcc-config: 1.4.1-r1
sys-devel/libtool:   2.2.10
sys-devel/make:      3.82
sys-kernel/linux-headers: 2.6.36.1
sys-libs/glibc:      2.12.2
virtual/os-headers:  0
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=core2 -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c /usr/share/X11/xkb"
CXXFLAGS="-march=core2 -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--with-bdeps y"
FEATURES="assume-digests binpkg-logs collision-protect distlocks fixlafiles fixpackages news parallel-fetch protect-owned sandbox sfperms sign strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox"
FFLAGS=""
GENTOO_MIRRORS="http://mirror.datapipe.net/gentoo http://gentoo.cites.uiuc.edu/pub/gentoo/ http://mirrors.acm.cs.rpi.edu/gentoo/ http://gentoo.mirrors.pair.com/"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en"
MAKEOPTS="-j2 -l2"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/var/lib/layman/haskell /usr/local/portage"
SYNC="rsync://rsync.namerica.gentoo.org/gentoo-portage"
USE="X Xaw3d acl alsa amd64 berkdb bzip2 cairo cli cracklib crypt cxx dri dvd encode flac fontconfig fortran ftp gd gdbm gif gmp gpm gs gtk haddock iconv imlib jpeg kpathsea lapack latex mad mbox mmx modules mp3 ncurses nodrm nptl nptlonly ogg opengl openmp pam pcre pdf perl png pppd qt3support readline rtc session sse sse2 ssl svg sysfs tetex tiff truetype vim-syntax vorbis wmf xorg xv xvid zlib" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="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="braindump flow karbon kexi kpresenter krita tables words" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" 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 ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="intel vga" 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, INSTALL_MASK, LANG, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 3 Dylan Simon 2011-06-07 19:18:32 UTC
With symbols:
#0  _rl_char_search_internal (count=<value optimized out>, dir=<value optimized out>, smbchar=0x7f3dfaf1cea0 "\r", len=1) at ../text.c:1502
#1  0x00007f3dfacf1382 in _rl_dispatch_subseq (key=45, map=<value optimized out>, got_subseq=0) at ../readline.c:774
#2  0x00007f3dfacf1ba0 in readline_internal_char () at ../readline.c:552
#3  0x00007f3dfacf2095 in readline_internal_charloop (prompt=<value optimized out>) at ../readline.c:579
#4  readline_internal (prompt=<value optimized out>) at ../readline.c:593
#5  readline (prompt=<value optimized out>) at ../readline.c:342
#6  0x0000000000400895 in main () at rltest.c:60

n'ing through:
1500      while (count)
1502          if ((dir < 0 && pos <= 0) || (dir > 0 && pos >= rl_end))
1509          pos = (inc > 0) ? _rl_find_next_mbchar (rl_line_buffer, pos, 1, MB_FIND_ANY)
1517              if (_rl_is_mbchar_matched (rl_line_buffer, pos, rl_end, smbchar, len))
1537                           : (pos = _rl_find_next_mbchar (rl_line_buffer, pos, 1, MB_FIND_ANY)) != prepos);

pos = 0
inc = 1
rl_end = 0

smbchar is just "\r":
0x7f3dfaf1cea0 <_rl_vi_last_search_mbchar>:     13 '\r' 0 '\000'        0 '\000'        0 '\000'        0 '\000'        0 '\000'        0 '\000'        0 '\000'
rl_line_buffer is empty:
0x1cb0050:      0 '\000'        0 '\000'        0 '\000'        0 '\000'        0 '\000'        0 '\000'        0 '\000'        0 '\000'
Comment 4 SpanKY gentoo-dev 2011-06-11 22:51:19 UTC
readline-6.2 is the latest in the tree.  Comment #2 doesnt actually show the input that triggers the misbehavior, nor does any other comment.