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: fix error handling in jobs mode



details:   https://anonhg.NetBSD.org/src/rev/d0feb16787c4
branches:  trunk
changeset: 1021762:d0feb16787c4
user:      rillig <rillig%NetBSD.org@localhost>
date:      Wed Jun 16 09:47:51 2021 +0000

description:
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.

diffstat:

 usr.bin/make/job.c                                    |  13 +++++++++++--
 usr.bin/make/unit-tests/jobs-empty-commands-error.exp |   5 +++--
 2 files changed, 14 insertions(+), 4 deletions(-)

diffs (45 lines):

diff -r 19ef73914428 -r d0feb16787c4 usr.bin/make/job.c
--- a/usr.bin/make/job.c        Wed Jun 16 09:39:48 2021 +0000
+++ b/usr.bin/make/job.c        Wed Jun 16 09:47:51 2021 +0000
@@ -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 @@
        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)) {
                /*
diff -r 19ef73914428 -r d0feb16787c4 usr.bin/make/unit-tests/jobs-empty-commands-error.exp
--- a/usr.bin/make/unit-tests/jobs-empty-commands-error.exp     Wed Jun 16 09:39:48 2021 +0000
+++ b/usr.bin/make/unit-tests/jobs-empty-commands-error.exp     Wed Jun 16 09:47:51 2021 +0000
@@ -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



Home | Main Index | Thread Index | Old Index