🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Emil M. Scoffone Mon, 17 Jul 1989 15:30
BASH bug report
#338
Author: Emil M. Scoffone
Date: Mon, 17 Jul 1989 15:30
57 lines
2169 bytes
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.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads