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 error handling for dependency of ....
details: https://anonhg.NetBSD.org/src/rev/d19528d76f7a
branches: trunk
changeset: 946350:d19528d76f7a
user: rillig <rillig%NetBSD.org@localhost>
date: Tue Nov 24 18:17:45 2020 +0000
description:
make(1): fix error handling for dependency of .END in -k mode
Fix one bug, find 4 new ones. All these bugs have been around since
2005-05-08, when dependencies on the .BEGIN, .END and .INTERRUPT nodes
were implemented. Before that, checking gn->made == ERROR was
appropriate, but adding the dependencies made ABORTED a new possible
error value from Compat_Make.
diffstat:
usr.bin/make/compat.c | 9 ++++++---
usr.bin/make/job.c | 6 ++++--
usr.bin/make/make.h | 8 +++++++-
usr.bin/make/unit-tests/deptgt-end-fail-indirect.exp | 5 ++++-
4 files changed, 21 insertions(+), 7 deletions(-)
diffs (112 lines):
diff -r 930f23325f22 -r d19528d76f7a usr.bin/make/compat.c
--- a/usr.bin/make/compat.c Tue Nov 24 17:59:42 2020 +0000
+++ b/usr.bin/make/compat.c Tue Nov 24 18:17:45 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat.c,v 1.190 2020/11/24 17:42:31 rillig Exp $ */
+/* $NetBSD: compat.c,v 1.191 2020/11/24 18:17:45 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.190 2020/11/24 17:42:31 rillig Exp $");
+MAKE_RCSID("$NetBSD: compat.c,v 1.191 2020/11/24 18:17:45 rillig Exp $");
static GNode *curTarg = NULL;
static pid_t compatChild;
@@ -639,6 +639,8 @@
if (gn->made == UNMADE && (gn == pgn || !(pgn->type & OP_MADE))) {
if (!MakeUnmade(gn, pgn))
goto cohorts;
+
+ /* XXX: Replace with GNode_IsError(gn) */
} else if (gn->made == ERROR) {
/*
* Already had an error when making this.
@@ -689,6 +691,7 @@
gn = Targ_FindNode(".BEGIN");
if (gn != NULL) {
Compat_Make(gn, gn);
+ /* XXX: Replace with GNode_IsError(gn) */
if (gn->made == ERROR) {
PrintOnError(gn, "\nStop.");
exit(1);
@@ -722,7 +725,7 @@
if (indirectErrors == 0) {
GNode *endNode = Targ_GetEndNode();
Compat_Make(endNode, endNode);
- if (gn->made == ERROR || endNode->made == ERROR) {
+ if (GNode_IsError(gn) || GNode_IsError(endNode)) {
PrintOnError(gn, "\nStop.");
exit(1);
}
diff -r 930f23325f22 -r d19528d76f7a usr.bin/make/job.c
--- a/usr.bin/make/job.c Tue Nov 24 17:59:42 2020 +0000
+++ b/usr.bin/make/job.c Tue Nov 24 18:17:45 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: job.c,v 1.328 2020/11/23 23:41:11 rillig Exp $ */
+/* $NetBSD: job.c,v 1.329 2020/11/24 18:17:45 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -143,7 +143,7 @@
#include "trace.h"
/* "@(#)job.c 8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: job.c,v 1.328 2020/11/23 23:41:11 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.329 2020/11/24 18:17:45 rillig Exp $");
/* A shell defines how the commands are run. All commands for a target are
* written into a single file, which is then given to the shell to execute
@@ -1843,6 +1843,7 @@
}
#else
Compat_Make(targ, targ);
+ /* XXX: Replace with GNode_IsError(gn) */
if (targ->made == ERROR) {
PrintOnError(targ, "\n\nStop.");
exit(1);
@@ -2739,6 +2740,7 @@
Var_Set(ALLSRC, fname, gn);
JobRun(gn);
+ /* XXX: Replace with GNode_IsError(gn) */
if (gn->made == ERROR) {
PrintOnError(gn, "\n\nStop.");
exit(1);
diff -r 930f23325f22 -r d19528d76f7a usr.bin/make/make.h
--- a/usr.bin/make/make.h Tue Nov 24 17:59:42 2020 +0000
+++ b/usr.bin/make/make.h Tue Nov 24 18:17:45 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: make.h,v 1.216 2020/11/24 17:42:31 rillig Exp $ */
+/* $NetBSD: make.h,v 1.217 2020/11/24 18:17:45 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -701,6 +701,12 @@
return gn->path != NULL ? gn->path : gn->name;
}
+MAKE_INLINE Boolean
+GNode_IsError(const GNode *gn)
+{
+ return gn->made == ERROR || gn->made == ABORTED;
+}
+
MAKE_INLINE const char *
GNode_VarTarget(GNode *gn) { return Var_ValueDirect(TARGET, gn); }
MAKE_INLINE const char *
diff -r 930f23325f22 -r d19528d76f7a usr.bin/make/unit-tests/deptgt-end-fail-indirect.exp
--- a/usr.bin/make/unit-tests/deptgt-end-fail-indirect.exp Tue Nov 24 17:59:42 2020 +0000
+++ b/usr.bin/make/unit-tests/deptgt-end-fail-indirect.exp Tue Nov 24 18:17:45 2020 +0000
@@ -1,4 +1,7 @@
: all
false
*** Error code 1 (continuing)
-exit status 0
+
+Stop.
+make: stopped in unit-tests
+exit status 1
Home |
Main Index |
Thread Index |
Old Index