Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make make(1): fix wrong exit status for multiple fai...



details:   https://anonhg.NetBSD.org/src/rev/36223394413a
branches:  trunk
changeset: 946738:36223394413a
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Dec 07 01:35:33 2020 +0000

description:
make(1): fix wrong exit status for multiple failed main targets

diffstat:

 usr.bin/make/compat.c                               |  19 +++++--------------
 usr.bin/make/unit-tests/opt-keep-going-multiple.exp |   6 ++++--
 usr.bin/make/unit-tests/opt.exp                     |   4 ++++
 3 files changed, 13 insertions(+), 16 deletions(-)

diffs (70 lines):

diff -r 26dcfceef278 -r 36223394413a usr.bin/make/compat.c
--- a/usr.bin/make/compat.c     Mon Dec 07 01:32:04 2020 +0000
+++ b/usr.bin/make/compat.c     Mon Dec 07 01:35:33 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat.c,v 1.203 2020/12/07 01:32:04 rillig Exp $      */
+/*     $NetBSD: compat.c,v 1.204 2020/12/07 01:35:33 rillig Exp $      */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -96,7 +96,7 @@
 #include "pathnames.h"
 
 /*     "@(#)compat.c   8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: compat.c,v 1.203 2020/12/07 01:32:04 rillig Exp $");
+MAKE_RCSID("$NetBSD: compat.c,v 1.204 2020/12/07 01:35:33 rillig Exp $");
 
 static GNode *curTarg = NULL;
 static pid_t compatChild;
@@ -714,21 +714,12 @@
                } else if (gn->made == ABORTED) {
                        printf("`%s' not remade because of errors.\n",
                               gn->name);
+               }
+               if (GNode_IsError(gn))
                        seenError = TRUE;
-               }
        }
 
-       /*
-        * XXX: what about multiple main targets if the first few fail but
-        * the last one succeeds?  This should not count as overall success.
-        * See opt-keep-going-multiple.mk.
-        */
-       if (GNode_IsError(gn))
-               seenError = TRUE;
-
-       /*
-        * If the user has defined a .END target, run its commands.
-        */
+       /* If the user has defined a .END target, run its commands. */
        if (!seenError) {
                GNode *endNode = Targ_GetEndNode();
                Compat_Make(endNode, endNode);
diff -r 26dcfceef278 -r 36223394413a usr.bin/make/unit-tests/opt-keep-going-multiple.exp
--- a/usr.bin/make/unit-tests/opt-keep-going-multiple.exp       Mon Dec 07 01:32:04 2020 +0000
+++ b/usr.bin/make/unit-tests/opt-keep-going-multiple.exp       Mon Dec 07 01:35:33 2020 +0000
@@ -3,5 +3,7 @@
 false fail2
 *** Error code 1 (continuing)
 true succeed
-: The end.
-exit status 0
+
+Stop.
+make: stopped in unit-tests
+exit status 1
diff -r 26dcfceef278 -r 36223394413a usr.bin/make/unit-tests/opt.exp
--- a/usr.bin/make/unit-tests/opt.exp   Mon Dec 07 01:32:04 2020 +0000
+++ b/usr.bin/make/unit-tests/opt.exp   Mon Dec 07 01:35:33 2020 +0000
@@ -12,6 +12,10 @@
 make: don't know how to make -f (continuing)
 `/dev/null' is up to date.
 
+Stop.
+make: stopped in unit-tests
+*** Error code 1 (ignored)
+
 make -?
 usage: make [-BeikNnqrSstWwX]
             [-C directory] [-D variable] [-d flags] [-f makefile]



Home | Main Index | Thread Index | Old Index