This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

readline Bug! ;-) [was: Bash Bug! (was: Bug in rxvt 2.7.2 ...)]


Hey, as long as we're shifting the blame, let's shift it correctly ;-)
Details below...

On Tue, 1 Oct 2002, Jelks Cabaniss wrote:

> Igor Pechtchanski wrote:
>
> > > > As for the Ctrl-Left, this is something odd in bash.  I
> > > > can get the same behavior in a command window running bash,
> > > > or even by typing Esc O c.  Bash running on Linux does not
> > > > seem to have this problem.
>
> I wrote, speaking about CTRL+Left:
>
> > > Here it crashes rxvt, but not the bash console.  WinXP.
>
> > I can confirm Esc O c crashing a bash command window on Win2k SP2.
> > Seems like Esc O <anything> kills bash...
>
> Ah, you're right!  CTRL+Left doesn't crash bash here, but Esc O c sends
> it flying out the window in flames.
>
> /Jelks

This actually seems to be a readline bug.  Bash dies with a SIGSEGV
because of an infinite recursion in _rl_dispatch_subseq() in the readline
library.  I've included a transcript of a gdb session below.  The keys
pressed were '<Esc> O <space>'.  I'm going to try to debug it tomorrow,
but if anyone more familiar with the readline library wants to take a shot
at it earlier, it's fine with me. :-)
Oh,

$ cygcheck -svr | egrep "(readline|bash)"
Found: C:\cygwin\bin\bash.exe
  108k 2001/06/28 C:\cygwin\bin\cygreadline4.dll - os=4.0 img=1.0 sys=4.0
                  "cygreadline4.dll" v0.0 ts=2001/1/6 23:34
  127k 2002/07/17 C:\cygwin\bin\cygreadline5.dll - os=4.0 img=1.0 sys=4.0
                  "cygreadline5.dll" v0.0 ts=2002/7/17 17:18
bash                2.05b-5
libreadline4        4.1-2
libreadline5        4.3-1
readline            4.3-1
$

Hope this helps.
	Igor

$ gdb -nw ./bash.exe
GNU gdb 5.0 (20010428-3)
Copyright 2001 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-cygwin"...
(gdb) run -i
Starting program: ./bash.exe -i
/cygdrive/c/WINNT/system32/KERNEL32.dll: No such file or directory.
/cygdrive/c/WINNT/system32/USER32.dll: No such file or directory.
/cygdrive/c/WINNT/System32/IMM32.DLL: No such file or directory.
/cygdrive/c/WINNT/system32/RPCRT4.DLL: No such file or directory.
/cygdrive/c/WINNT/System32/LPK.DLL: No such file or directory.
/cygdrive/c/WINNT/System32/USP10.dll: No such file or directory.
/mnt/c/PROGRA~1/strack/ag32id.dll: No such file or directory.

Program received signal SIGSEGV, Segmentation fault.
0x0045bfc7 in _rl_dispatch_subseq (key=256, map=0x10028188, got_subseq=0)
    at readline.c:529
529       return _rl_dispatch_subseq (key, map, 0);
(gdb) where
#0  0x0045bfc7 in _rl_dispatch_subseq (key=256, map=0x10028188, got_subseq=0)
    at readline.c:529
#1  0x0045bfbc in _rl_dispatch (key=256, map=0x10028188) at readline.c:529
#2  0x0045c0a4 in _rl_dispatch_subseq (key=256, map=0x10028188, got_subseq=0)
    at readline.c:570
#3  0x0045bfbc in _rl_dispatch (key=256, map=0x10028188) at readline.c:529
#4  0x0045c0a4 in _rl_dispatch_subseq (key=256, map=0x10028188, got_subseq=0)
    at readline.c:570
#5  0x0045bfbc in _rl_dispatch (key=256, map=0x10028188) at readline.c:529
[ Zillions of identical frames here ]
---Type <return> to continue, or q <return> to quit---q
Quit
(gdb) break readline.c:542
Breakpoint 1 at 0x45bfcf: file readline.c, line 542.
(gdb) run -i
The program being debugged has been started already.
Start it from the beginning? (y or n) y

Starting program: ./bash.exe -i
/cygdrive/c/WINNT/system32/KERNEL32.dll: No such file or directory.
/cygdrive/c/WINNT/system32/USER32.dll: No such file or directory.
/cygdrive/c/WINNT/System32/IMM32.DLL: No such file or directory.
/cygdrive/c/WINNT/system32/RPCRT4.DLL: No such file or directory.
/cygdrive/c/WINNT/System32/LPK.DLL: No such file or directory.
/cygdrive/c/WINNT/System32/USP10.dll: No such file or directory.
/mnt/c/PROGRA~1/strack/ag32id.dll: No such file or directory.

Breakpoint 1, _rl_dispatch_subseq (key=27, map=0x477bc0, got_subseq=0)
    at readline.c:542
542       if (META_CHAR (key) && _rl_convert_meta_chars_to_ascii)
(gdb) cont
Continuing.

Breakpoint 1, _rl_dispatch_subseq (key=79, map=0x4783e0, got_subseq=0)
    at readline.c:542
542       if (META_CHAR (key) && _rl_convert_meta_chars_to_ascii)
(gdb) cont
Continuing.

Breakpoint 1, _rl_dispatch_subseq (key=32, map=0x10028188, got_subseq=0)
    at readline.c:542
542       if (META_CHAR (key) && _rl_convert_meta_chars_to_ascii)
(gdb) cont
Continuing.

Breakpoint 1, _rl_dispatch_subseq (key=256, map=0x10028188, got_subseq=0)
    at readline.c:542
542       if (META_CHAR (key) && _rl_convert_meta_chars_to_ascii)
(gdb) where
#0  _rl_dispatch_subseq (key=256, map=0x10028188, got_subseq=0)
    at readline.c:542
#1  0x0045bfbc in _rl_dispatch (key=256, map=0x10028188) at readline.c:529
#2  0x0045c205 in _rl_dispatch_subseq (key=79, map=0x4783e0, got_subseq=0)
    at readline.c:653
#3  0x0045c1e9 in _rl_dispatch_subseq (key=27, map=0x477bc0, got_subseq=0)
    at readline.c:645
#4  0x0045bfbc in _rl_dispatch (key=27, map=0x477bc0) at readline.c:529
#5  0x0045be64 in readline_internal_char () at readline.c:443
#6  0x0045bf2d in readline_internal_charloop () at readline.c:489
#7  0x0045bf4c in readline_internal () at readline.c:503
#8  0x0045bb12 in readline (
    prompt=0x1002eda0 "\001[\e[32mpechtcha\e[0m:\e[33m/tmp/bashtest\e[0m]\002 ") at readline.c:299
#9  0x0040654a in yy_readline_get ()
    at /usr/homes/chet/src/bash/src/parse.y:1108
#10 0x004064a5 in yy_getc () at /usr/homes/chet/src/bash/src/parse.y:1042
#11 0x00406dd5 in shell_getc (remove_quoted_newline=1)
    at /usr/homes/chet/src/bash/src/parse.y:1803
#12 0x004078ae in read_token (command=0)
    at /usr/homes/chet/src/bash/src/parse.y:2414
#13 0x00407393 in yylex () at /usr/homes/chet/src/bash/src/parse.y:2084
#14 0x00404fdb in yyparse () at /usr/local/share/bison/bison.simple:573
---Type <return> to continue, or q <return> to quit---q
Quit
(gdb) up
#1  0x0045bfbc in _rl_dispatch (key=256, map=0x10028188) at readline.c:529
529       return _rl_dispatch_subseq (key, map, 0);
(gdb) up
#2  0x0045c205 in _rl_dispatch_subseq (key=79, map=0x4783e0, got_subseq=0)
    at readline.c:653
653                 r = _rl_dispatch (ANYOTHERKEY, FUNCTION_TO_KEYMAP (map, key));
(gdb) list
648                 /* We didn't match anything, and the keymap we're indexed into
649                    shadowed a function previously bound to that prefix.  Call
650                    the function.  The recursive call to _rl_dispatch_subseq has
651                    already taken care of pushing any necessary input back onto
652                    the input queue with _rl_unget_char. */
653                 r = _rl_dispatch (ANYOTHERKEY, FUNCTION_TO_KEYMAP (map, key));
654               else if (r && map[ANYOTHERKEY].function)
655                 {
656                   /* We didn't match (r is probably -1), so return something to
657                      tell the caller that it should try ANYOTHERKEY for an
(gdb) q
The program is running.  Exit anyway? (y or n) y
$

-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"Water molecules expand as they grow warmer" (C) Popular Science, Oct'02, p.51



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]