Module Name: src
Committed By: rillig
Date: Wed Jun 16 09:47:51 UTC 2021
Modified Files:
src/usr.bin/make: job.c
src/usr.bin/make/unit-tests: jobs-empty-commands-error.exp
Log Message:
make: fix error handling in jobs mode
By using the same error handling code as in the branch for non-empty
commands, the behavior is the same again as before 2021-01-29.
To generate a diff of this commit:
cvs rdiff -u -r1.434 -r1.435 src/usr.bin/make/job.c
cvs rdiff -u -r1.1 -r1.2 \
src/usr.bin/make/unit-tests/jobs-empty-commands-error.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/job.c
diff -u src/usr.bin/make/job.c:1.434 src/usr.bin/make/job.c:1.435
--- src/usr.bin/make/job.c:1.434 Wed Jun 16 03:56:59 2021
+++ src/usr.bin/make/job.c Wed Jun 16 09:47:51 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: job.c,v 1.434 2021/06/16 03:56:59 rillig Exp $ */
+/* $NetBSD: job.c,v 1.435 2021/06/16 09:47:51 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -142,7 +142,7 @@
#include "trace.h"
/* "@(#)job.c 8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: job.c,v 1.434 2021/06/16 03:56:59 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.435 2021/06/16 09:47:51 rillig Exp $");
/*
* A shell defines how the commands are run. All commands for a target are
@@ -1663,6 +1663,15 @@ JobStart(GNode *gn, bool special)
if (Lst_IsEmpty(&gn->commands)) {
job->cmdFILE = stdout;
run = false;
+
+ /*
+ * We're serious here, but if the commands were bogus, we're
+ * also dead...
+ */
+ if (!cmdsOK) {
+ PrintOnError(gn, NULL); /* provide some clue */
+ DieHorribly();
+ }
} else if (((gn->type & OP_MAKE) && !opts.noRecursiveExecute) ||
(!opts.noExecute && !opts.touchFlag)) {
/*
Index: src/usr.bin/make/unit-tests/jobs-empty-commands-error.exp
diff -u src/usr.bin/make/unit-tests/jobs-empty-commands-error.exp:1.1 src/usr.bin/make/unit-tests/jobs-empty-commands-error.exp:1.2
--- src/usr.bin/make/unit-tests/jobs-empty-commands-error.exp:1.1 Wed Jun 16 09:39:48 2021
+++ src/usr.bin/make/unit-tests/jobs-empty-commands-error.exp Wed Jun 16 09:47:51 2021
@@ -1,4 +1,5 @@
: 'Making existing-target out of nothing.'
make: don't know how to make nonexistent-target (continuing)
-`nonexistent-target' was not built (being made, type OP_DEPS_FOUND|OP_MARK, flags REMAKE|DONE_WAIT|DONE_ALLSRC|DONECYCLE)!
-exit status 1
+
+make: stopped in unit-tests
+exit status 2