Subject: Re: make: sh -e shouldn't be used in compat mode?
To: None <tech-toolchain@NetBSD.org>
From: Simon Gerraty <sjg@juniper.net>
List: tech-toolchain
Date: 05/05/2004 16:41:16
BTW the patch would be:

? unit-tests/compat
Index: compat.c
===================================================================
RCS file: /cvsroot/src/usr.bin/make/compat.c,v
retrieving revision 1.52
diff -u -p -r1.52 compat.c
--- compat.c	10 Sep 2003 18:04:22 -0000	1.52
+++ compat.c	5 May 2004 23:39:14 -0000
@@ -286,9 +286,7 @@ CompatRunCommand(ClientData cmdp, Client
     if (*cp != '\0') {
 	/*
 	 * If *cp isn't the null character, we hit a "meta" character and
-	 * need to pass the command off to the shell. We give the shell the
-	 * -e flag as well as -c if it's supposed to exit when it hits an
-	 * error.
+	 * need to pass the command off to the shell. 
 	 */
 	static const char *shargv[4];
 
@@ -297,9 +295,9 @@ CompatRunCommand(ClientData cmdp, Client
 	 * The following work for any of the builtin shell specs.
 	 */
 	if (DEBUG(SHELL))
-		shargv[1] = (errCheck ? "-exc" : "-xc");
+		shargv[1] = "-xc";
 	else
-		shargv[1] = (errCheck ? "-ec" : "-c");
+		shargv[1] = "-c";
 	shargv[2] = cmd;
 	shargv[3] = (char *)NULL;
 	av = shargv;
Index: unit-tests/Makefile
===================================================================
RCS file: /cvsroot/src/usr.bin/make/unit-tests/Makefile,v
retrieving revision 1.12
diff -u -p -r1.12 Makefile
--- unit-tests/Makefile	8 Apr 2004 00:59:01 -0000	1.12
+++ unit-tests/Makefile	5 May 2004 23:39:14 -0000
@@ -19,6 +19,7 @@ UNIT_TESTS:= ${.PARSEDIR}
 # Simple sub-makefiles - we run them as a black box
 # keep the list sorted.
 SUBFILES= \
+	compat \
 	cond1 \
 	modmatch \
 	modts \
Index: unit-tests/test.exp
===================================================================
RCS file: /cvsroot/src/usr.bin/make/unit-tests/test.exp,v
retrieving revision 1.11
diff -u -p -r1.11 test.exp
--- unit-tests/test.exp	13 Apr 2004 16:06:23 -0000	1.11
+++ unit-tests/test.exp	5 May 2004 23:39:14 -0000
@@ -1,3 +1,7 @@
+Posix says we should execute the command as if run by system(3)
+Expect 'Hello,' and 'World!'
+Hello,
+World!
 make: "cond1" line 75: warning: extra else
 make: "cond1" line 85: warning: extra else
 2 is  prime
--- /dev/null	Wed May  5 16:05:00 2004
+++ unit-tests/compat	Wed May  5 16:38:46 2004
@@ -0,0 +1,6 @@
+# $Id$
+
+all:
+	@echo "Posix says we should execute the command as if run by system(3)"
+	@echo "Expect 'Hello,' and 'World!'"
+	@echo Hello,; false; echo "World!"