🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Gregory Bond Wed, 16 Aug 1989 04:25
^D coredumps bash-1.02 (with fix)
#472
Author: Gregory Bond
Date: Wed, 16 Aug 1989 04:25
40 lines
1748 bytes
Bash version 1.02, ChangeLog last edit Wed Jun 28 16:51:42 1989

Sun 3/60 using SunOS 3.5Export, gcc 1.35 and Sun cc.

Typing ^D to bash to exit causes a core dump.

Cause: The readline() routine returns a char * (the read line), or EOF
on end of file.  Somewhere between 1.01 and 1.02 the code in
yy_readline_get() that handled the EOF was deleted, causing bash to
xrealloc() with EOF as a pointer.  Coredump.

Fix:

*** parse.y.orig	Wed Aug 16 14:21:34 1989
--- parse.y	Wed Aug 16 13:59:07 1989
***************
*** 427,436 ****
--- 427,448 ----
        if (!current_readline_prompt) 
  	current_readline_line = readline ("");
        else
  	current_readline_line = readline (current_readline_prompt);
  
+       /* 
+        * If you type a ^D to bash, then readline returns (char *)EOF
+        * This code avoids a coredump in xrealloc.  It was in bash-1.01 
+        * in a similar form, but was dropped for 1.02.
+        * gnb@melba.bby.oz.au 16/8/89 
+        */
+       if (current_readline_line == (char *)EOF) {
+ 	current_readline_line_index = 0;
+ 	current_readline_line == NULL;
+ 	return EOF;
+       }
+ 
        current_readline_line_index = 0;
        current_readline_line =
  	(char *)xrealloc (current_readline_line,
  			  2 + strlen (current_readline_line));
        strcat (current_readline_line, "\n");
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