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: handle .PHONY consitently on interrupt



details:   https://anonhg.NetBSD.org/src/rev/e4dfb6fef406
branches:  trunk
changeset: 373914:e4dfb6fef406
user:      sjg <sjg%NetBSD.org@localhost>
date:      Sat Mar 18 22:20:11 2023 +0000

description:
make: handle .PHONY consitently on interrupt

JobDeleteTarget skips .PHONY targets
CompatDeleteTarget should do the same

This addresses https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=269663

diffstat:

 usr.bin/make/compat.c                              |  7 ++++---
 usr.bin/make/unit-tests/cmd-interrupt.exp          |  1 -
 usr.bin/make/unit-tests/cmd-interrupt.mk           |  4 ++--
 usr.bin/make/unit-tests/deptgt-delete_on_error.exp |  2 --
 4 files changed, 6 insertions(+), 8 deletions(-)

diffs (71 lines):

diff -r a7ed237b31a3 -r e4dfb6fef406 usr.bin/make/compat.c
--- a/usr.bin/make/compat.c     Sat Mar 18 11:36:23 2023 +0000
+++ b/usr.bin/make/compat.c     Sat Mar 18 22:20:11 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat.c,v 1.245 2023/02/14 21:38:31 rillig Exp $      */
+/*     $NetBSD: compat.c,v 1.246 2023/03/18 22:20:11 sjg Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -91,7 +91,7 @@
 #include "pathnames.h"
 
 /*     "@(#)compat.c   8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: compat.c,v 1.245 2023/02/14 21:38:31 rillig Exp $");
+MAKE_RCSID("$NetBSD: compat.c,v 1.246 2023/03/18 22:20:11 sjg Exp $");
 
 static GNode *curTarg = NULL;
 static pid_t compatChild;
@@ -104,7 +104,8 @@
 static void
 CompatDeleteTarget(GNode *gn)
 {
-       if (gn != NULL && !GNode_IsPrecious(gn)) {
+       if (gn != NULL && !GNode_IsPrecious(gn) &&
+           (gn->type & OP_PHONY) == 0) {
                const char *file = GNode_VarTarget(gn);
 
                if (!opts.noExecute && unlink_file(file) == 0) {
diff -r a7ed237b31a3 -r e4dfb6fef406 usr.bin/make/unit-tests/cmd-interrupt.exp
--- a/usr.bin/make/unit-tests/cmd-interrupt.exp Sat Mar 18 11:36:23 2023 +0000
+++ b/usr.bin/make/unit-tests/cmd-interrupt.exp Sat Mar 18 22:20:11 2023 +0000
@@ -2,7 +2,6 @@
 make: *** cmd-interrupt-ordinary removed
 interrupt-ordinary: ok
 > cmd-interrupt-phony
-make: *** cmd-interrupt-phony removed
 interrupt-phony: ok
 > cmd-interrupt-precious
 interrupt-precious: ok
diff -r a7ed237b31a3 -r e4dfb6fef406 usr.bin/make/unit-tests/cmd-interrupt.mk
--- a/usr.bin/make/unit-tests/cmd-interrupt.mk  Sat Mar 18 11:36:23 2023 +0000
+++ b/usr.bin/make/unit-tests/cmd-interrupt.mk  Sat Mar 18 22:20:11 2023 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: cmd-interrupt.mk,v 1.3 2020/11/15 14:07:53 rillig Exp $
+# $NetBSD: cmd-interrupt.mk,v 1.4 2023/03/18 22:20:12 sjg Exp $
 #
 # Tests for interrupting a command.
 #
@@ -30,7 +30,7 @@
 interrupt-phony: .PHONY
        @${.MAKE} ${MAKEFLAGS} -f ${MAKEFILE} cmd-interrupt-phony || true
        # The ././ is necessary to work around the file cache.
-       @echo ${.TARGET}: ${exists(././cmd-interrupt-phony) :? error : ok }
+       @echo ${.TARGET}: ${exists(././cmd-interrupt-phony) :? ok : error }
 
 interrupt-precious: .PRECIOUS
        @${.MAKE} ${MAKEFLAGS} -f ${MAKEFILE} cmd-interrupt-precious || true
diff -r a7ed237b31a3 -r e4dfb6fef406 usr.bin/make/unit-tests/deptgt-delete_on_error.exp
--- a/usr.bin/make/unit-tests/deptgt-delete_on_error.exp        Sat Mar 18 11:36:23 2023 +0000
+++ b/usr.bin/make/unit-tests/deptgt-delete_on_error.exp        Sat Mar 18 22:20:11 2023 +0000
@@ -7,10 +7,8 @@
 make: *** deptgt-delete_on_error-regular-delete removed
 > deptgt-delete_on_error-phony; false
 *** Error code 1 (continuing)
-make: *** deptgt-delete_on_error-phony removed
 > deptgt-delete_on_error-phony-delete; false
 *** Error code 1 (continuing)
-make: *** deptgt-delete_on_error-phony-delete removed
 > deptgt-delete_on_error-precious; false
 *** Error code 1 (continuing)
 > deptgt-delete_on_error-precious-delete; false



Home | Main Index | Thread Index | Old Index