Module Name: src
Committed By: rillig
Date: Mon Dec 7 01:35:33 UTC 2020
Modified Files:
src/usr.bin/make: compat.c
src/usr.bin/make/unit-tests: opt-keep-going-multiple.exp opt.exp
Log Message:
make(1): fix wrong exit status for multiple failed main targets
To generate a diff of this commit:
cvs rdiff -u -r1.203 -r1.204 src/usr.bin/make/compat.c
cvs rdiff -u -r1.1 -r1.2 \
src/usr.bin/make/unit-tests/opt-keep-going-multiple.exp
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/opt.exp
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/make/compat.c
diff -u src/usr.bin/make/compat.c:1.203 src/usr.bin/make/compat.c:1.204
--- src/usr.bin/make/compat.c:1.203 Mon Dec 7 01:32:04 2020
+++ src/usr.bin/make/compat.c Mon Dec 7 01:35:33 2020
@@ -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 @@ Compat_Run(GNodeList *targs)
} else if (gn->made == ABORTED) {
printf("`%s' not remade because of errors.\n",
gn->name);
- seenError = TRUE;
}
+ 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);
Index: src/usr.bin/make/unit-tests/opt-keep-going-multiple.exp
diff -u src/usr.bin/make/unit-tests/opt-keep-going-multiple.exp:1.1 src/usr.bin/make/unit-tests/opt-keep-going-multiple.exp:1.2
--- src/usr.bin/make/unit-tests/opt-keep-going-multiple.exp:1.1 Mon Dec 7 01:32:04 2020
+++ src/usr.bin/make/unit-tests/opt-keep-going-multiple.exp Mon Dec 7 01:35:33 2020
@@ -3,5 +3,7 @@ false fail1
false fail2
*** Error code 1 (continuing)
true succeed
-: The end.
-exit status 0
+
+Stop.
+make: stopped in unit-tests
+exit status 1
Index: src/usr.bin/make/unit-tests/opt.exp
diff -u src/usr.bin/make/unit-tests/opt.exp:1.7 src/usr.bin/make/unit-tests/opt.exp:1.8
--- src/usr.bin/make/unit-tests/opt.exp:1.7 Wed Nov 18 01:06:59 2020
+++ src/usr.bin/make/unit-tests/opt.exp Mon Dec 7 01:35:33 2020
@@ -12,6 +12,10 @@ make -r -f /dev/null -- -VAR=value -f /d
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]