🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.bash.bug
Article #286

Re: bash 1.02 core dumps on control-D

#286
From: Chet Ramey
Date: Mon, 10 Jul 1989 13:50
65 lines
2543 bytes
In article <8907100230.AA22676@watmath.waterloo.edu> accwai@WATMATH.WATERLOO.EDU (Andy Wai) writes:
>
>  Script started on Sun Jul  9 21:45:32 1989
>  watmsg[1]% /usr/local/bin/bash
>  watmsg[1]$ ^D
>  Segmentation fault    /usr/local/bin/bash (core dumped)
>  watmsg[2]% exit
>

Brian took out the checks for current_readline_line[0] == EOF, and tries to
dereference it (parse.y: yy_readline_get).  Patch below.  Once again, this
may not be the Officially Blessed patch (there has to be a better way to do
this, but this works). 

>  %.o : %.c
>  ^^^^^^^^^
>	  $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
>
>It also assumes the existence of variables like MAKE and RM which is
>not defined in some versions of make.
>

There is no excuse for not using Gnu Make, which has all of these features.

The rule in question is basically equivalent to:

	.c.o:
		$(CC) -c $(CFLAGS) $(CPPFLAGS) $*.c


*** bash-1.02/parse.y	Sat Jul  1 21:42:28 1989
--- src-1.02/parse.y	Fri Jul  7 14:31:03 1989
***************
*** 431,438
  
        current_readline_line_index = 0;
!       current_readline_line =
! 	(char *)xrealloc (current_readline_line,
! 			  2 + strlen (current_readline_line));
!       strcat (current_readline_line, "\n");
      }
  

--- 431,447 -----
  
        current_readline_line_index = 0;
!       if ((long)current_readline_line != (long)EOF) {
!         current_readline_line =
! 	  (char *)xrealloc (current_readline_line,
! 			    2 + strlen (current_readline_line));
!         strcat (current_readline_line, "\n");
!       }
!     }
! 
!   if ((long) current_readline_line == (long) EOF) 
!     {
!       current_readline_line = (char *) NULL;
!       current_readline_line_index = 0;
!       return (EOF);
      }
  
Chet Ramey			"We are preparing to think about contemplating 
Network Services Group, CWRU	 preliminary work on plans to develop a
chet@cwjcc.INS.CWRU.Edu		 schedule for producing the 10th Edition of 
				 the Unix Programmers Manual." -- Andrew Hume
Technical Details
Message-ID: <406@cwjcc.CWRU.Edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!cwjcc!kiwi!chet
References: <8907100230.AA22676@watmath.waterloo.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!cwjcc!kiwi!chet
From: chet@kiwi.CWRU.EDU (Chet Ramey)
Newsgroups: gnu.bash.bug
Subject: Re: bash 1.02 core dumps on control-D
Summary: FIX
Message-ID: <406@cwjcc.CWRU.Edu>
Date: 10 Jul 89 13:50:31 GMT
References: <8907100230.AA22676@watmath.waterloo.edu>
Sender: news@cwjcc.CWRU.Edu
Reply-To: chet@kiwi.INS.CWRU.Edu (Chet Ramey)
Distribution: gnu
Organization: CWRU Andrew R. Jennings Computing Center
Lines: 65