Subject: Re: make: sh -e shouldn't be used in compat mode?
To: Simon Gerraty <sjg@juniper.net>
From: James Chacon <jmc@NetBSD.org>
List: tech-toolchain
Date: 05/05/2004 21:32:00
On Wed, May 05, 2004 at 04:41:16PM -0700, Simon Gerraty wrote:
> BTW the patch would be:
Why not also add something simple in the test that a multi-line command w:
echo foo
(echo bar;exit 1)
echo baz
never gets to 'echo baz'
(This was I think the whole idea behind -e and subshells, etc not always
exiting in the same ways)
James
> ? 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!"
>
>