Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 139043 - USE Flag +bashlogger causes bash to segfault if length of typed command exceeds 600 chars
Summary: USE Flag +bashlogger causes bash to segfault if length of typed command excee...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-07-03 10:23 UTC by Victor Nawothnig
Modified: 2006-07-15 20:54 UTC (History)
0 users

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


Attachments
Valgrind Output (valgrind.output,3.68 KB, text/plain)
2006-07-10 05:55 UTC, Victor Nawothnig
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Victor Nawothnig 2006-07-03 10:23:54 UTC
If I type any command that is longer than 598 chars (including whitespaces) bash and shell quit with a segmentation fault.

I'm going to try that with a new kernel tomorrow.
Im also updating to gcc-4.1.1 currently, but I had this problem also when I was completely stable and up-to-date about a year ago.
But I never cared.

The backtrace from gdb: bash, command is 599 long.

#0  0xb7dd69d0 in funlockfile () from /lib/libc.so.6
#1  0xb7dbddef in vfprintf () from /lib/libc.so.6
#2  0xb7e49d92 in vsyslog () from /lib/libc.so.6
#3  0xb7e4a253 in syslog () from /lib/libc.so.6
#4  0x080bd625 in add_history (string=0x80f6a08 'a' <repeats 200 times>..., logme=1) at history.c:265
#5  0x0808c98f in really_add_history (line=0x0) at bashhist.c:708
#6  0x0808caba in bash_add_history (line=0x80f6a08 'a' <repeats 200 times>...) at bashhist.c:697
#7  0x0808cc81 in check_add_history (line=0x80f6a08 'a' <repeats 200 times>..., force=0) at bashhist.c:638
#8  0x0808cd32 in maybe_add_history (line=0xbfc2875c "") at bashhist.c:614
#9  0x0808cec8 in pre_process_line (line=0x80f6a08 'a' <repeats 200 times>..., print_changes=1, addit=1) at bashhist.c:490
#10 0x0806001b in shell_getc (remove_quoted_newline=1) at parse.y:1997
#11 0x080611bc in read_token (command=<value optimized out>) at parse.y:2561
#12 0x08063d16 in yyparse () at parse.y:2207
#13 0x0805e208 in parse_command () at eval.c:222
#14 0x0805e2f7 in read_command () at eval.c:266
#15 0x0805e471 in reader_loop () at eval.c:132


hal9000 ~ # emerge --info
Portage 2.1.1_pre1-r5 (default-linux/x86/no-nptl, gcc-4.1.0, glibc-2.3.6-r4, 2.6.14-gentoo-r7 i686)
=================================================================
System uname: 2.6.14-gentoo-r7 i686 AMD Athlon(tm) XP 3000+
Gentoo Base System version 1.6.15
ccache version 2.3 [enabled]
dev-lang/python:     2.4.3-r1
dev-python/pycrypto: 2.0.1-r5
dev-util/ccache:     2.3
dev-util/confcache:  [Not Present]
sys-apps/sandbox:    1.2.17
sys-devel/autoconf:  2.13, 2.59-r7
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2
sys-devel/binutils:  2.16.1-r3
sys-devel/gcc-config: 1.3.13-r2
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.11-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=athlon-xp -O2 -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/X11/xkb /usr/share/config"
CONFIG_PROTECT_MASK="/etc/env.d /etc/gconf /etc/revdep-rebuild /etc/splash /etc/terminfo"
CXXFLAGS="-march=athlon-xp -O2 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig ccache distlocks fixpackages metadata-transfer sandbox sfperms"
GENTOO_MIRRORS="http://ftp.belnet.be/mirror/rsync.gentoo.org/gentoo/"
LANG="en_US.utf8"
LC_ALL="en_US.utf8"
LINGUAS="en de"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude='/distfiles' --exclude='/local' --exclude='/packages'"
PORTAGE_TMPDIR="/var/tmp/portage"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.de.gentoo.org/gentoo-portage"
USE="x86 16bit 3dnow 3dnowext 7zip X aac accessibility acpi aim aimextras alsa amarok apache apache2 apm asf avi bashlogger berkdb bitmap-fonts c++ ccache cdrom chroot cli crypt css cups dedicated dhcp dio disk-cache divx4linux double-precision dri dvd dvdr eds emboss encode fame fastcgi firefox foomaticdb fortran gatos gcj gdbm gif gimp glibc glibc-compat20 glibc-omitfp glx gnome gphoto2 gpm gstreamer gtk gtk2 icq imlib ipv6 irc isdnlog javascript jpeg kde kdeenablefinal libg++ libwww mad math maya-shaderlibrary md5sum mem-cache memcache memlimit mikmod mmx mmxext motif mp3 mpeg mpeg4 mplayer msn musicbrainz mysql ncurses net nls no-old-linux nowin nsplugin nvidia ogg opengl pcre pdflib perl png pppd python qt qt3 qt4 quicktime readline reflection reiserfs sdl sensord session spell spl ssl tcpd truetype truetype-fonts type1-fonts unicode userlocales utf8 vorbis win32codecs wxwindows xml xmms xorg xv zlib elibc_glibc input_devices_keyboard input_devices_mouse input_devices_evdev kernel_linux linguas_en linguas_de userland_GNU video_cards_nv video_cards_nvidia video_cards_vesa"
Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LDFLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY
Comment 1 Victor Nawothnig 2006-07-03 10:24:48 UTC
Forgot the bash version. 3.1_p16
Comment 2 SpanKY gentoo-dev 2006-07-03 12:27:49 UTC
works for me on x86 stable and amd64 unstable ...

i tried this command:
ls /../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../..
Comment 3 Victor Nawothnig 2006-07-04 02:18:27 UTC
It does not depend on the gcc.
I built bash with the gcc-3.4.6, gcc-4.1.0 and gcc-4.1.1 and had the same problem with each compiler.
Going to try a last stable kernel today anyway.
Comment 4 Victor Nawothnig 2006-07-07 05:21:24 UTC
Still same error with 2.6.16-gentoo-r9.
I also get the error with the standard shell.

I do not have any weird or insane bash settings. Error even occurs with defaul tbash settings.

Can anyone reproduce this bug, or any ideas?
Comment 5 Victor Nawothnig 2006-07-09 04:52:48 UTC
< marienz> norc: that backtrace makes no sense to me. It's saying bash_add_history is called with a sane value for "line", but it calls really_add_history with a null line, but I don't see any way that function could do that since it passes "line" unchanged.

^ Thats what I got in #gentoo few days ago.

So maybe thats the clue that might help getting this problem fixed.

Before I forget this.
Of course I temporarily build bash with those settings, for debugging with gdb.

CFLAGS="-O1 -pipe -g -ggdb"
CXXFLAGS="${CFLAGS}"
FEATURES="nostrip"

But I'm having the same problem with the CFLAGS I specified.
Comment 6 Victor Nawothnig 2006-07-10 05:55:20 UTC
Error is due to bash-3.1-bash-logger.patch.
USE="-bashlogger" solves the problem, and this flag only applies the mentioned patch.

Additional valgrind output will be attached, there might be some indirect memory corruption.

Hope thats enough for anyone of you to go on.
Comment 7 Victor Nawothnig 2006-07-10 05:55:46 UTC
Created attachment 91359 [details]
Valgrind Output

Verbose valgrind output
Comment 8 Victor Nawothnig 2006-07-11 12:34:26 UTC
I attached the patch there.

*** This bug has been marked as a duplicate of 91327 ***
Comment 9 SpanKY gentoo-dev 2006-07-14 21:25:48 UTC
track the bug here, not in old closed/fixed bugs
Comment 10 SpanKY gentoo-dev 2006-07-15 20:54:06 UTC
thanks, fix now in cvs