Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!UCSD.EDU!emil%chem From: emil%chem@UCSD.EDU (Emil M. Scoffone) Newsgroups: gnu.bash.bug Subject: BASH bug report Message-ID: <8907171530.AA06676@sdchemv1.chem.ucsd.edu> Date: 17 Jul 89 15:30:06 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 57 To: bug-bash@ai.mit.edu BASH version: 1.02 Machine: Sun 3/160 OpSys: SunOS 3.2 (4.2BSD) Compiler: Sun's native cc ------------------------------------------------------------ Description of bug: Hitting ^D at the beginning of line results in the following message: Segmentation fault (core dumped) and the shell crashes. This seems to be independent of the value of 'IGNOREEOF' and 'ignoreeof'. ------------------------------------------------------------ Probable Reason: I ran BASH in dbx, and found out that 'readline' returns EOF coerced to a (char *) on its second invocation after it has seen a valid EOF. On the other hand, 'yy_readline_get' never checks if the value that 'readline' returns in 'current_readline_line' is a valid pointer. When it gets to 'strlen' in the 'xrealloc' call, BASH bombs out. ------------------------------------------------------------ My Fix: I edited 'parse.y' to include a statement that checks if 'current_readline_line' is (char *) EOF: 08:16:45 pogo(6) diff -c parse.y parse.y~ *** parse.y Mon Jul 17 08:16:44 1989 --- parse.y~ Mon Jul 17 08:05:13 1989 *************** *** 429,439 **** else current_readline_line = readline (current_readline_prompt); - if (current_readline_line == (char *) EOF) { - current_readline_line = (char *)NULL; - return (EOF); - } - current_readline_line_index = 0; current_readline_line = (char *)xrealloc (current_readline_line, --- 429,434 ---- 08:16:50 pogo(7) ------------------------------------------------------------ I have also seen erratic behaviour on ^D on a Compaq 386 running System V, but I haven't had time to look at it in great detail.