From nox@saturn.kn-bremen.de  Sat Feb 13 09:48:05 1999
Received: from blaubaer.kn-bremen.de (blaubaer.kn-bremen.de [194.94.232.249])
          by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id JAA25656
          for <FreeBSD-gnats-submit@freebsd.org>; Sat, 13 Feb 1999 09:48:01 -0800 (PST)
          (envelope-from nox@saturn.kn-bremen.de)
Received: from saturn.kn-bremen.de (uucp@localhost)
	by blaubaer.kn-bremen.de (8.9.1/8.9.1) with UUCP id SAA02626
	for FreeBSD-gnats-submit@freebsd.org; Sat, 13 Feb 1999 18:41:06 +0100
Received: (from nox@localhost)
	by saturn.kn-bremen.de (8.8.7/8.8.5) id SAA02095;
	Sat, 13 Feb 1999 18:39:25 +0100 (MET)
Message-Id: <199902131739.SAA02095@saturn.kn-bremen.de>
Date: Sat, 13 Feb 1999 18:39:25 +0100 (MET)
From: Juergen Lock <nox@jelal.kn-bremen.de>
Reply-To: nox@jelal.kn-bremen.de
To: FreeBSD-gnats-submit@freebsd.org
Subject: /bin/sh called from make dumps core
X-Send-Pr-Version: 3.2

>Number:         10064
>Category:       bin
>Synopsis:       /bin/sh called from make dumps core
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Feb 13 09:50:00 PST 1999
>Closed-Date:    Mon Jul 5 05:31:17 PDT 1999
>Last-Modified:  Mon Jul  5 11:40:01 PDT 1999
>Originator:     Juergen Lock
>Release:        FreeBSD 2.1.7-RELEASE i386
>Organization:
me? organized?
>Environment:

	

>Description:

	During a long build (cygwin32 as cross compiler) /bin/sh
	called from gmake dumps core inside popstackmark().
	Replacing the 2.1-stable sh with a 2.2.5-RELEASE one didn't
	help, so i tried the patch below: now its still building
	as i write this.

>How-To-Repeat:

	I can send my (unfinished) port if your intrested, but you'll
	need some 250 MBytes free and wait a while before it gets
	to the point where it happenes.  this is the C file i used
	to attach gdb to the offending sh command:

-----cut--------
#include <stdio.h>

int main(int argc, char **argv) {
  return execl ("/bin/sh", "/bin/sh", "-c", "read x; dir=`echo configure-target-libstdc++ | sed -e 's/configure-target-//'`;  if [ ! -d i586-cygwin32 ]; then  true;  elif [ -f i586-cygwin32/${dir}/Makefile ] ; then  true;  elif echo \" libiberty newlib libio librx libstdc++ libg++ examples winsup    \" | grep \" ${dir} \" >/dev/null 2>&1; then  if [ -d ../${dir} ]; then  [ -d i586-cygwin32/${dir} ] || mkdir i586-cygwin32/${dir}; r=`pwd`; export r;  s=`cd ..; pwd`; export s;   AR=\"` if [ -f $r/binutils/ar ] ; then echo $r/binutils/ar ; else if [ \"i386-unknown-freebsd2.1.7\" = \"i586-pc-cygwin32\" ] ; then echo ar; else t='-e s,^,i586-cygwin32-, '; echo ar | sed -e 's/x/x/' $t ; fi; fi`\"; export AR;  AS=\"` if [ -f $r/gas/as-new ] ; then echo $r/gas/as-new ; else if [ \"i386-unknown-freebsd2.1.7\" = \"i586-pc-cygwin32\" ] ; then echo as; else t='-e s,^,i586-cygwin32-, '; echo as | sed -e 's/x/x/' $t ; fi; fi`\"; export AS;  CC=\"` if [ -f $r/gcc/xgcc ] ; then if [ -f $r/i586-!
cygwin32/newlib/Makefile ] ; then case \"i586-pc-cygwin32\" in i[3456]86-*-cygwin*) echo $r/gcc/xgcc -B$r/gcc/ -B$r/i586-cygwin32/newlib/ -L$r/i586-cygwin32/winsup -idirafter $r/i586-cygwin32/newlib/targ-include -idirafter $s/winsup/include -idirafter $s/newlib/libc/include -idirafter $s/newlib/libc/sys/cygwin -idirafter  $s/newlib/libc/sys/cygwin32 -nostdinc; ;; *) echo $r/gcc/xgcc -B$r/gcc/ -idirafter $r/i586-cygwin32/newlib/targ-include -idirafter $s/newlib/libc/include -nostdinc; ;; esac else echo $r/gcc/xgcc -B$r/gcc/; fi; else if [ \"i386-unknown-freebsd2.1.7\"= \"i586-pc-cygwin32\" ] ; then echo gcc; else t='-e s,^,i586-cygwin32-, '; echo gcc | sed -e 's/x/x/' $t; fi; fi`\"; export CC;  CFLAGS=\"-g -O2\"; export CFLAGS;  CXX=\"` if [ -f $r/gcc/xgcc ] ; then if [ -f $r/i586-cygwin32/newlib/Makefile ] ; then case \"i586-pc-cygwin32\" in i[3456]86-*-cygwin*) echo $r/gcc/xgcc  -B$r/gcc/ -B$r/i586-cygwin32/newlib/ -L$r/i586-cygwin32/winsup -idirafter  $r/i586-cygwin32/newlib!
/targ-include -idirafter $s/winsup/include -idirafter $s/newlib/libc/include -idirafter $s/newlib/libc/sys/cygwin -idirafter  $s/newlib/libc/sys/cygwin32 -nostdinc; ;; *) echo $r/gcc/xgcc -B$r/gcc/ -idirafter $r/i586-cygwin32/newlib/targ-include -idirafter $s/newlib/libc/include -nostdinc; ;; esac else echo $r/gcc/xgcc -B$r/gcc/; fi; else if [ \"i386-unknown-freebsd2.1.7\" = \"i586-pc-cygwin32\" ] ; then echo c++; else t='-e s,^,i586-cygwin32-, '; echo c++ | sed -e 's/x/x/' $t; fi; fi`\"; export CXX;  CXXFLAGS=\"-g -O2\"; export CXXFLAGS;  DLLTOOL=\"` if [ -f $r/binutils/dlltool ] ; then echo $r/binutils/dlltool ; else if [ \"i386-unknown-freebsd2.1.7\" = \"i586-pc-cygwin32\" ] ; then echo dlltool; else t='-e s,^,i586-cygwin32-, '; echo dlltool | sed -e 's/x/x/' $t ; fi; fi`\"; export DLLTOOL;  LD=\"` if [ -f $r/ld/ld-new ] ; then echo $r/ld/ld-new ; else if [ \"i386-unknown-freebsd2.1.7\" = \"i586-pc-cygwin32\" ] ; then echo ld; else t='-e s,^,i586-cygwin32-, '; echo ld | sed!
 -e 's/x/x/' $t ; fi; fi`\"; export LD;  LDFLAGS=\"\"; export LDFLAGS;  NM=\"` if [ -f $r/binutils/nm-new ] ; then echo $r/binutils/nm-new ; else if [ \"i386-unknown-freebsd2.1.7\" = \"i586-pc-cygwin32\" ] ; then echo nm; else t='-e s,^,i586-cygwin32-, '; echo nm | sed -e 's/x/x/' $t ; fi; fi`\"; export NM;  RANLIB=\"` if [ -f $r/binutils/ranlib ] ; then echo $r/binutils/ranlib ; else if [ \"i386-unknown-freebsd2.1.7\" = \"i586-pc-cygwin32\" ] ; then echo ranlib; else t='-e s,^,i586-cygwin32-, '; echo ranlib | sed -e 's/x/x/' $t ; fi; fi`\"; export RANLIB;  WINDRES=\"` if [ -f $r/binutils/windres ] ; then echo $r/binutils/windres ; else if [ \"i386-unknown-freebsd2.1.7\" = \"i586-pc-cygwin32\" ] ; then echo windres; else t='-e s,^,i586-cygwin32-, '; echo windres | sed -e 's/x/x/' $t ; fi; fi`\"; export WINDRES;  echo Configuring in i586-cygwin32/${dir};  cd i586-cygwin32/${dir};  case .. in  /*)  topdir=.. ;;  *)  case \"i586-cygwin32\" in  .) topdir=\"../..\" ;;  *) topdir=\"!
../../..\" ;;  esac ;;  esac;  if [ \"..\" = \".\" ] ; then  if [ \"i586-cygwin32\" != \".\" ] ; then  if /bin/sh $s/symlink-tree  ${topdir}/${dir} \"no-such-file\" ; then  if [ -f Makefile ]; then  if gmake distclean; then  true;  else  exit 1;  fi;  else  true;  fi;  else  exit 1;  fi;  else  true;  fi;  srcdiroption=\"--srcdir=.\";  libsrcdir=\".\";  else  srcdiroption=\"--srcdir=${topdir}/${dir}\";  libsrcdir=\"$s/${dir}\";  fi;  if [ -f ${libsrcdir}/configure ] ; then  /bin/sh ${libsrcdir}/configure  --host=i586-cygwin32  --build=i386-unknown-freebsd2.1.7 --with-newlib --enable-multilib  --with-cross-host=i386-unknown-freebsd2.1.7     --prefix=/usr/local/gnu-win32 ${srcdiroption}  --with-target-subdir=\"i586-cygwin32\";  else  /bin/sh $s/configure  --host=i586-cygwin32 --build=i386-unknown-freebsd2.1.7 --with-newlib --enable-multilib --with-cross-host=i386-unknown-freebsd2.1.7     --prefix=/usr/local/gnu-win32 ${srcdiroption}  --with-target-subdir=\"i586-cygwin32\";  fi;!
  else  true;  fi;  else  true;  fi", (char *)NULL);
}
-----cut--------

>Fix:
	
	

Index: /usr4/home4/cvs/src/bin/sh/memalloc.c
===================================================================
RCS file: /home/cvs/cvs/src/bin/sh/memalloc.c,v
retrieving revision 1.2
diff -u -r1.2 memalloc.c
--- memalloc.c	1994/09/24 02:57:50	1.2
+++ memalloc.c	1999/02/13 16:37:22
@@ -180,6 +180,9 @@
 	INTOFF;
 	while (stackp != mark->stackp) {
 		sp = stackp;
+#if 1
+		if (!sp) break;
+#endif
 		stackp = sp->prev;
 		ckfree(sp);
 	}
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: sheldonh 
State-Changed-When: Tue Jun 22 04:44:24 PDT 1999 
State-Changed-Why:  
Are you in a position to suggest what situation causes member's of the 
mark list to exist "below" the global stack base, or am I misreading 
the code horribly? 

From: Sheldon Hearn <sheldonh@uunet.co.za>
To: Juergen Lock <nox@jelal.kn-bremen.de>
Cc: freebsd-gnats-submit@freebsd.org
Subject: Re: bin/10064: /bin/sh called from make dumps core 
Date: Wed, 23 Jun 1999 16:52:10 +0200

 On Tue, 22 Jun 1999 23:12:11 +0200, Juergen Lock wrote:
 
 > Umm, i fixed this the redmond way, just looked at how it crashed
 > and patched around the problem without actually trying to understand
 > the code...
 
 Hi Juergen,
 
 Could you do me a huge favour? I've just gotten feedback from someone
 who suspects that your problem was fixed in rev 1.26 of
 src/bin/sh/expand.c ...
 
 Could you back your change out of your local source, get the expand.c
 fix and see if the problem still exists?
 
 Many thanks,
 Sheldon.
 

From: Juergen Lock <nox@jelal.kn-bremen.de>
To: Sheldon Hearn <sheldonh@uunet.co.za>
Cc: Juergen Lock <nox@jelal.kn-bremen.de>,
	freebsd-gnats-submit@freebsd.org
Subject: Re: bin/10064: /bin/sh called from make dumps core
Date: Sun, 4 Jul 1999 12:44:15 +0200

 On Wed, Jun 23, 1999 at 04:52:10PM +0200, Sheldon Hearn wrote:
 > 
 > 
 > On Tue, 22 Jun 1999 23:12:11 +0200, Juergen Lock wrote:
 > 
 > > Umm, i fixed this the redmond way, just looked at how it crashed
 > > and patched around the problem without actually trying to understand
 > > the code...
 > 
 > Hi Juergen,
 > 
 > Could you do me a huge favour? I've just gotten feedback from someone
 > who suspects that your problem was fixed in rev 1.26 of
 > src/bin/sh/expand.c ...
 > 
 > Could you back your change out of your local source, get the expand.c
 > fix and see if the problem still exists?
 
 OK after several nightly runs of my i586-cygwin32 crossgcc build
 i finally go it to the point where it crashed.  (I had to use a
 2.1-stable system, with the right kernel, to get it to pass the right
 args to sh that make it die...)  then i built the 3.2-stable sh on
 2.1-stable cause the expand.c diff didn't apply to the 2.1-stable sh.
 well, the 3.2-stable sh didn't die (and the expand.c diff isn't yet
 MFC'd)!  at least not at the same place where the 2.1-stable one died,
 didn't wait for the whole build to finish...  A 2.2.5R sh also died
 I remembered, maybe the expand.c diff applies there.  Well it did
 (more or less, had to apply it by hand), but it didn't fix the crash!
 Hmm so let's find out which patch makes it dissapear.  After building
 several sh:s from the RELENG_2_2 branch i found out the 2.2.7R sh
 dies and the 2.2.8R sh doesn't, and the crucial patch is in parser.c
 (0parser228 below).  undoing that patch in the 3.2-stable sh as well
 as in the -current sh cause both to crash, and that patch doesn't
 look like it could fix a stack bug, only mask it by using the stack
 differently, right?  Anyway here comes the whole shebang, reduced to
 only the touched files:  (unshar in an empty dir, set CVSROOT then
 run `crash'.)
 
  HTH,
 	Juergen
 
 # This is a shell archive.  Save it in a file, remove anything before
 # this line, and then unpack it by entering "sh file".  Note, it may
 # create directories; files and directories will be owned by you and
 # have default permissions.
 #
 # This archive contains:
 #
 #	crash
 #	kill11.c
 #	0parser228
 #	work
 #	work/gnu-win32
 #	work/gnu-win32/src
 #	work/gnu-win32/src/CROSS
 #	work/gnu-win32/src/CROSS/i586-cygwin32
 #	work/gnu-win32/src/CROSS/i586-cygwin32/libstdc++
 #	work/gnu-win32/src/CROSS/i586-cygwin32/newlib
 #	work/gnu-win32/src/CROSS/i586-cygwin32/newlib/Makefile
 #	work/gnu-win32/src/CROSS/binutils
 #	work/gnu-win32/src/CROSS/binutils/ar
 #	work/gnu-win32/src/CROSS/gas
 #	work/gnu-win32/src/CROSS/gas/as-new
 #	work/gnu-win32/src/CROSS/gcc
 #	work/gnu-win32/src/CROSS/gcc/xgcc
 #	work/gnu-win32/src/libstdc++
 #
 echo x - crash
 sed 's/^X//' >crash << 'END-of-crash'
 X#! /bin/sh
 Xcc -o kill11 kill11.c
 X# set CVSROOT; also try co -rRELENG_3
 Xcvs co src/bin/sh src/usr.bin/printf
 Xpatch src/bin/sh/parser.c <0parser228 
 X(cd src/bin/sh/; make)
 Xecho hit return, or attach gdb then hit return
 X(cd work/gnu-win32/src/CROSS/; ../../../../kill11 ../../../../src/bin/sh/sh )
 X# examine the core in work/gnu-win32/src/CROSS
 END-of-crash
 echo x - kill11.c
 sed 's/^X//' >kill11.c << 'END-of-kill11.c'
 X#include <stdio.h>
 X
 Xint main(int argc, char **argv) {
 X	char *sh = argc == 2 ? argv[1] : "/bin/sh";
 X	return execl (sh, sh, "-c", "read x; dir=`echo configure-target-libstdc++ | sed -e 's/configure-target-//'`;  if [ ! -d i586-cygwin32 ]; then  true;  elif [ -f i586-cygwin32/${dir}/Makefile ] ; then  true;  elif echo \" libiberty newlib libio librx libstdc++ libg++ examples winsup    \" | grep \" ${dir} \" >/dev/null 2>&1; then  if [ -d ../${dir} ]; then  [ -d i586-cygwin32/${dir} ] || mkdir i586-cygwin32/${dir}; r=`pwd`; export r;  s=`cd ..; pwd`; export s;   AR=\"` if [ -f $r/binutils/ar ] ; then echo  $r/binutils/ar ; else if [ \"i386-unknown-freebsd2.1.7\" = \"i586-pc-cygwin32\" ] ; then echo ar; else t='-e s,^,i586-cygwin32-, '; echo ar | sed -e 's/x/x/' $t ; fi; fi`\"; export AR;  AS=\"` if [ -f $r/gas/as-new ] ; then echo $r/gas/as-new ; else if [ \"i386-unknown-freebsd2.1.7\" = \"i586-pc-cygwin32\" ] ; then echo as; else t='-e s,^,i586-cygwin32-, '; echo as | sed -e 's/x/x/' $t ; fi; fi`\"; export AS;  CC=\"` if [ -f $r/gcc/xgcc ] ; then if [ -f $r/i586-cygwin32/newli!
 b/Makefile ] ; then case \"i586-pc-cygwin32\" in i[3456]86-*-cygwin*) echo $r/gcc/xgcc -B$r/gcc/ -B$r/i586-cygwin32/newlib/ -L$r/i586-cygwin32/winsup -idirafter $r/i586-cygwin32/newlib/targ-include -idirafter $s/winsup/include -idirafter $s/newlib/libc/include -idirafter $s/newlib/libc/sys/cygwin -idirafter  $s/newlib/libc/sys/cygwin32 -nostdinc; ;; *) echo $r/gcc/xgcc -B$r/gcc/ -idirafter $r/i586-cygwin32/newlib/targ-include -idirafter $s/newlib/libc/include -nostdinc; ;; esac else echo $r/gcc/xgcc -B$r/g cc/; fi; else if [ \"i386-unknown-freebsd2.1.7\"= \"i586-pc-cygwin32\" ] ; then echo gcc; else t='-e s,^,i586-cygwin32-, '; echo gcc | sed -e 's/x/x/' $t; fi; fi`\"; export CC;  CFLAGS=\"-g -O2\"; export CFLAGS;  CXX=\"` if [ -f $r/gcc/xgcc ] ; then if [ -f $r/i586-cygwin32/newlib/Makefile ] ; then case \"i586-pc-cygwin32\" in i[3456]86-*-cygwin*) echo $r/gcc/xgcc  -B$r/gcc/ -B$r/i586-cygwin32/newlib/ -L$r/i586-cygwin32/winsup -idirafter  $r/i586-cygwin32/newlib/targ-include !
 -idirafter $s/winsup/include -idirafter $s/newlib/libc/include -idirafter $s/newlib/libc/sys/cygwin -idirafter  $s/newlib/libc/sys/cygwin32 -nostdinc; ;; *) echo $r/gcc/xgcc -B$r/gcc/ -idirafter $r/i586-cygwin32/newlib/targ-include -idirafter $s/newlib/libc/include -nostdinc; ;; esac else echo $r/gcc/xgcc -B$r/gcc/; fi; else if [ \"i386-unknown-freebsd2.1.7\" = \"i586-pc-cygwin32\" ] ; then echo c++; else t='-e s,^,i586-cygwin32-, '; echo c++ | sed -e 's/x/x/' $t; fi; fi`\"; export CXX;  CXXFLAGS=\"-g -O2\ "; export CXXFLAGS;  DLLTOOL=\"` if [ -f $r/binutils/dlltool ] ; then echo $r/binutils/dlltool ; else if [ \"i386-unknown-freebsd2.1.7\" = \"i586-pc-cygwin32\" ] ; then echo dlltool; else t='-e s,^,i586-cygwin32-, '; echo dlltool | sed -e 's/x/x/' $t ; fi; fi`\"; export DLLTOOL;  LD=\"` if [ -f $r/ld/ld-new ] ; then echo $r/ld/ld-new ; else if [ \"i386-unknown-freebsd2.1.7\" = \"i586-pc-cygwin32\" ] ; then echo ld; else t='-e s,^,i586-cygwin32-, '; echo ld | sed -e 's/x/x/' $!
 t ; fi; fi`\"; export LD;  LDFLAGS=\"\"; export LDFLAGS;  NM=\"` if [ -f $r/binutils/nm-new ] ; then echo $r/binutils/nm-new ; else if [ \"i386-unknown-freebsd2.1.7\" = \"i586-pc-cygwin32\" ] ; then echo nm; else t='-e s,^,i586-cygwin32-, '; echo nm | sed -e 's/x/x/' $t ; fi; fi`\"; export NM;  RANLIB=\"` if [ -f $r/binutils/ranlib ] ; then echo $r/binutils/ranlib ; else if [ \"i386-unknown-freebsd2.1.7\" = \"i586-pc-cygwin32\" ] ; then echo ranlib; else t='-e s,^,i586-cygwin32-, '; echo ranlib | sed -e 's /x/x/' $t ; fi; fi`\"; export RANLIB;  WINDRES=\"` if [ -f $r/binutils/windres ] ; then echo $r/binutils/windres ; else if [ \"i386-unknown-freebsd2.1.7\" = \"i586-pc-cygwin32\" ] ; then echo windres; else t='-e s,^,i586-cygwin32-, '; echo windres | sed -e 's/x/x/' $t ; fi; fi`\"; export WINDRES;  echo Configuring in i586-cygwin32/${dir};  cd i586-cygwin32/${dir};  case .. in  /*)  topdir=.. ;;  *)  case \"i586-cygwin32\" in  .) topdir=\"../..\" ;;  *) topdir=\"../../..\" ;; !
  esac ;;  esac;  if [ \"..\" = \".\" ] ; then  if [ \"i586-cygwin32\" != \".\" ] ; then  if /bin/sh $s/symlink-tree  ${topdir}/${dir} \"no-such-file\" ; then  if [ -f Makefile ]; then  if gmake distclean; then  true;  else  exit 1;  fi;  else  true;  fi;  else  exit 1;  fi;  else  true;  fi;  srcdiroption=\"--srcdir=.\";  libsrcdir=\".\";  else  srcdiroption=\"--srcdir=${topdir}/${dir}\";  libsrcdir=\"$s/${dir}\";  fi;  if [ -f ${libsrcdir}/configure ] ; then  /bin/sh ${libsrcdir}/configure  --host=i586-cy gwin32  --build=i386-unknown-freebsd2.1.7 --with-newlib --enable-multilib  --with-cross-host=i386-unknown-freebsd2.1.7     --prefix=/usr/local/gnu-win32 ${srcdiroption}  --with-target-subdir=\"i586-cygwin32\";  else  /bin/sh $s/configure  --host=i586-cygwin32 --build=i386-unknown-freebsd2.1.7 --with-newlib --enable-multilib --with-cross-host=i386-unknown-freebsd2.1.7     --prefix=/usr/local/gnu-win32 ${srcdiroption}  --with-target-subdir=\"i586-cygwin32\";  fi;  else  true;  !
 fi;  else  true;  fi", (char *)NULL);
 X}
 END-of-kill11.c
 echo x - 0parser228
 sed 's/^X//' >0parser228 << 'END-of-0parser228'
 XIndex: parser.c
 X===================================================================
 XRCS file: /home/cvs/cvs/src/bin/sh/parser.c,v
 Xretrieving revision 1.16.2.2
 Xdiff -u -r1.16.2.2 parser.c
 X--- parser.c	1998/11/03 15:57:36	1.16.2.2
 X+++ parser.c	1999/07/03 13:26:28
 X@@ -942,36 +940,27 @@
 X 						USTPUTC('\\', out);
 X 					if (SQSYNTAX[c] == CCTL)
 X 						USTPUTC(CTLESC, out);
 X-					else if (eofmark == NULL)
 X-						USTPUTC(CTLQUOTEMARK, out);
 X 					USTPUTC(c, out);
 X 					quotef++;
 X 				}
 X 				break;
 X 			case CSQUOTE:
 X-				if (eofmark == NULL)
 X-					USTPUTC(CTLQUOTEMARK, out);
 X 				syntax = SQSYNTAX;
 X 				break;
 X 			case CDQUOTE:
 X-				if (eofmark == NULL)
 X-					USTPUTC(CTLQUOTEMARK, out);
 X 				syntax = DQSYNTAX;
 X 				dblquote = 1;
 X 				break;
 X 			case CENDQUOTE:
 X-				if (eofmark != NULL && arinest == 0 &&
 X-				    varnest == 0) {
 X+				if (eofmark) {
 X 					USTPUTC(c, out);
 X 				} else {
 X-					if (arinest) {
 X+					if (arinest)
 X 						syntax = ARISYNTAX;
 X-						dblquote = 0;
 X-					} else if (eofmark == NULL) {
 X+					else
 X 						syntax = BASESYNTAX;
 X-						dblquote = 0;
 X-					}
 X 					quotef++;
 X+					dblquote = 0;
 X 				}
 X 				break;
 X 			case CVAR:	/* '$' */
 X@@ -998,10 +987,6 @@
 X 						if (--arinest == 0) {
 X 							USTPUTC(CTLENDARI, out);
 X 							syntax = prevsyntax;
 X-							if (syntax == DQSYNTAX)
 X-								dblquote = 1;
 X-							else
 X-								dblquote = 0;
 X 						} else
 X 							USTPUTC(')', out);
 X 					} else {
 X@@ -1414,10 +1399,6 @@
 X 		prevsyntax = syntax;
 X 		syntax = ARISYNTAX;
 X 		USTPUTC(CTLARI, out);
 X-		if (dblquote)
 X-			USTPUTC('"',out);
 X-		else
 X-			USTPUTC(' ',out);
 X 	} else {
 X 		/*
 X 		 * we collapse embedded arithmetic expansion to
 X@@ -1453,8 +1434,6 @@
 X 
 X 	p = text;
 X 	while ((c = *p++) != '\0') {
 X-		if ( c == CTLQUOTEMARK)
 X-			continue;
 X 		if (c == CTLESC)
 X 			p++;
 X 		else if (BASESYNTAX[c] == CCTL)
 END-of-0parser228
 echo c - work
 mkdir -p work > /dev/null 2>&1
 echo c - work/gnu-win32
 mkdir -p work/gnu-win32 > /dev/null 2>&1
 echo c - work/gnu-win32/src
 mkdir -p work/gnu-win32/src > /dev/null 2>&1
 echo c - work/gnu-win32/src/CROSS
 mkdir -p work/gnu-win32/src/CROSS > /dev/null 2>&1
 echo c - work/gnu-win32/src/CROSS/i586-cygwin32
 mkdir -p work/gnu-win32/src/CROSS/i586-cygwin32 > /dev/null 2>&1
 echo c - work/gnu-win32/src/CROSS/i586-cygwin32/libstdc++
 mkdir -p work/gnu-win32/src/CROSS/i586-cygwin32/libstdc++ > /dev/null 2>&1
 echo c - work/gnu-win32/src/CROSS/i586-cygwin32/newlib
 mkdir -p work/gnu-win32/src/CROSS/i586-cygwin32/newlib > /dev/null 2>&1
 echo x - work/gnu-win32/src/CROSS/i586-cygwin32/newlib/Makefile
 sed 's/^X//' >work/gnu-win32/src/CROSS/i586-cygwin32/newlib/Makefile << 'END-of-work/gnu-win32/src/CROSS/i586-cygwin32/newlib/Makefile'
 END-of-work/gnu-win32/src/CROSS/i586-cygwin32/newlib/Makefile
 echo c - work/gnu-win32/src/CROSS/binutils
 mkdir -p work/gnu-win32/src/CROSS/binutils > /dev/null 2>&1
 echo x - work/gnu-win32/src/CROSS/binutils/ar
 sed 's/^X//' >work/gnu-win32/src/CROSS/binutils/ar << 'END-of-work/gnu-win32/src/CROSS/binutils/ar'
 END-of-work/gnu-win32/src/CROSS/binutils/ar
 echo c - work/gnu-win32/src/CROSS/gas
 mkdir -p work/gnu-win32/src/CROSS/gas > /dev/null 2>&1
 echo x - work/gnu-win32/src/CROSS/gas/as-new
 sed 's/^X//' >work/gnu-win32/src/CROSS/gas/as-new << 'END-of-work/gnu-win32/src/CROSS/gas/as-new'
 END-of-work/gnu-win32/src/CROSS/gas/as-new
 echo c - work/gnu-win32/src/CROSS/gcc
 mkdir -p work/gnu-win32/src/CROSS/gcc > /dev/null 2>&1
 echo x - work/gnu-win32/src/CROSS/gcc/xgcc
 sed 's/^X//' >work/gnu-win32/src/CROSS/gcc/xgcc << 'END-of-work/gnu-win32/src/CROSS/gcc/xgcc'
 END-of-work/gnu-win32/src/CROSS/gcc/xgcc
 echo c - work/gnu-win32/src/libstdc++
 mkdir -p work/gnu-win32/src/libstdc++ > /dev/null 2>&1
 exit
 
 -- 
 Juergen Lock <nox.foo@jelal.kn-bremen.de>
 (remove dot foo from address to reply)
 

From: Sheldon Hearn <sheldonh@uunet.co.za>
To: Juergen Lock <nox@jelal.kn-bremen.de>
Cc: freebsd-gnats-submit@freebsd.org
Subject: Re: bin/10064: /bin/sh called from make dumps core 
Date: Mon, 05 Jul 1999 10:19:13 +0200

 On Sun, 04 Jul 1999 12:44:15 +0200, Juergen Lock wrote:
 
 > Hmm so let's find out which patch makes it dissapear.  After building
 > several sh:s from the RELENG_2_2 branch i found out the 2.2.7R sh
 > dies and the 2.2.8R sh doesn't, and the crucial patch is in parser.c
 > (0parser228 below).  undoing that patch in the 3.2-stable sh as well
 > as in the -current sh cause both to crash, and that patch doesn't
 > look like it could fix a stack bug, only mask it by using the stack
 > differently, right?
 
 Surely one way to fix a stack bug is to use the stack differently? :-)
 
 I think the important thing, as you've discovered for yourself, is that
 it's fixed in 2.2.8-RELEASE, 3.2-STABLE and 4.0-CURRENT. Thanks for the
 feedback.
 
 Ciao,
 Sheldon.
 
State-Changed-From-To: feedback->closed 
State-Changed-By: sheldonh 
State-Changed-When: Mon Jul 5 05:31:17 PDT 1999 
State-Changed-Why:  
Submitter confirms that the problem is fixed in 2.2.8-RELEASE and later 
versions. 

From: Juergen Lock <nox@jelal.kn-bremen.de>
To: Sheldon Hearn <sheldonh@uunet.co.za>
Cc: Juergen Lock <nox@jelal.kn-bremen.de>,
	freebsd-gnats-submit@freebsd.org
Subject: Re: bin/10064: /bin/sh called from make dumps core
Date: Mon, 5 Jul 1999 19:23:47 +0200

 On Mon, Jul 05, 1999 at 10:19:13AM +0200, Sheldon Hearn wrote:
 
 > On Sun, 04 Jul 1999 12:44:15 +0200, Juergen Lock wrote:
 > 
 > > Hmm so let's find out which patch makes it dissapear.  After building
 > > several sh:s from the RELENG_2_2 branch i found out the 2.2.7R sh
 > > dies and the 2.2.8R sh doesn't, and the crucial patch is in parser.c
 > > (0parser228 below).  undoing that patch in the 3.2-stable sh as well
 > > as in the -current sh cause both to crash, and that patch doesn't
 > > look like it could fix a stack bug, only mask it by using the stack
 > > differently, right?
 > 
 > Surely one way to fix a stack bug is to use the stack differently? :-)
 
 Well what i meant was that parser.c patch probably only changes the amount
 of stack used for that particular sh command and so the crash disappears,
 but now a different sh command would still cause a crash.  Finding that
 kind of different sh command without really knowing the innards of sh was
 much more difficult than just including the (reversed) parser.c patch, so
 thats what i did.
 > 
 > I think the important thing, as you've discovered for yourself, is that
 > it's fixed in 2.2.8-RELEASE, 3.2-STABLE and 4.0-CURRENT. Thanks for the
 > feedback.
 
  It is fixed for this particular sh command, but is it really fixed for
 all possible sh commands?  Someone who knows the sh code better than
 both of us :) should answer this i think.
 
  Regards,
 -- 
 Juergen Lock <nox.foo@jelal.kn-bremen.de>
 (remove dot foo from address to reply)
 
>Unformatted:
