CVS commit: src/usr.bin/make

2023-03-18 Thread Simon J. Gerraty
Module Name:src
Committed By:   sjg
Date:   Sat Mar 18 22:20:12 UTC 2023

Modified Files:
src/usr.bin/make: compat.c
src/usr.bin/make/unit-tests: cmd-interrupt.exp cmd-interrupt.mk
deptgt-delete_on_error.exp

Log Message:
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


To generate a diff of this commit:
cvs rdiff -u -r1.245 -r1.246 src/usr.bin/make/compat.c
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/cmd-interrupt.exp \
src/usr.bin/make/unit-tests/deptgt-delete_on_error.exp
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/cmd-interrupt.mk

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.245 src/usr.bin/make/compat.c:1.246
--- src/usr.bin/make/compat.c:1.245	Tue Feb 14 21:38:31 2023
+++ src/usr.bin/make/compat.c	Sat Mar 18 22:20:11 2023
@@ -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 int compatSigno;
 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) {

Index: src/usr.bin/make/unit-tests/cmd-interrupt.exp
diff -u src/usr.bin/make/unit-tests/cmd-interrupt.exp:1.2 src/usr.bin/make/unit-tests/cmd-interrupt.exp:1.3
--- src/usr.bin/make/unit-tests/cmd-interrupt.exp:1.2	Fri Aug 28 18:16:22 2020
+++ src/usr.bin/make/unit-tests/cmd-interrupt.exp	Sat Mar 18 22:20:12 2023
@@ -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
Index: src/usr.bin/make/unit-tests/deptgt-delete_on_error.exp
diff -u src/usr.bin/make/unit-tests/deptgt-delete_on_error.exp:1.2 src/usr.bin/make/unit-tests/deptgt-delete_on_error.exp:1.3
--- src/usr.bin/make/unit-tests/deptgt-delete_on_error.exp:1.2	Sun Oct 25 21:31:00 2020
+++ src/usr.bin/make/unit-tests/deptgt-delete_on_error.exp	Sat Mar 18 22:20:12 2023
@@ -7,10 +7,8 @@ make: *** deptgt-delete_on_error-regular
 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

Index: src/usr.bin/make/unit-tests/cmd-interrupt.mk
diff -u src/usr.bin/make/unit-tests/cmd-interrupt.mk:1.3 src/usr.bin/make/unit-tests/cmd-interrupt.mk:1.4
--- src/usr.bin/make/unit-tests/cmd-interrupt.mk:1.3	Sun Nov 15 14:07:53 2020
+++ src/usr.bin/make/unit-tests/cmd-interrupt.mk	Sat Mar 18 22:20:12 2023
@@ -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-ordinary:
 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



CVS commit: src/usr.bin/make

2023-03-18 Thread Simon J. Gerraty
Module Name:src
Committed By:   sjg
Date:   Sat Mar 18 22:20:12 UTC 2023

Modified Files:
src/usr.bin/make: compat.c
src/usr.bin/make/unit-tests: cmd-interrupt.exp cmd-interrupt.mk
deptgt-delete_on_error.exp

Log Message:
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


To generate a diff of this commit:
cvs rdiff -u -r1.245 -r1.246 src/usr.bin/make/compat.c
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/cmd-interrupt.exp \
src/usr.bin/make/unit-tests/deptgt-delete_on_error.exp
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/cmd-interrupt.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/distrib/utils/embedded/files

2023-03-18 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Mar 18 11:36:23 UTC 2023

Modified Files:
src/distrib/utils/embedded/files: resize_disklabel

Log Message:
Can't use disklabel to find the real size of a disk since a fake disklabel
read from disk is trusted. Revert to use drvctl again.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/distrib/utils/embedded/files/resize_disklabel

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/utils/embedded/files/resize_disklabel
diff -u src/distrib/utils/embedded/files/resize_disklabel:1.4 src/distrib/utils/embedded/files/resize_disklabel:1.5
--- src/distrib/utils/embedded/files/resize_disklabel:1.4	Sat Feb 18 07:58:34 2023
+++ src/distrib/utils/embedded/files/resize_disklabel	Sat Mar 18 11:36:23 2023
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: resize_disklabel,v 1.4 2023/02/18 07:58:34 mlelstv Exp $
+# $NetBSD: resize_disklabel,v 1.5 2023/03/18 11:36:23 mlelstv Exp $
 #
 
 # PROVIDE: resize_disklabel
@@ -27,8 +27,7 @@ get_total_sectors()
 	local disk
 
 	disk=$1
-	/sbin/disklabel -t "$disk" \
-	| sed -ne 's/.*:su#\([0-9]*\):.*/\1/p'
+	/sbin/drvctl -p "$disk" disk-info/geometry/sectors-per-unit
 }
 
 get_rawpart_sectors()



CVS commit: src/distrib/utils/embedded/files

2023-03-18 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Mar 18 11:36:23 UTC 2023

Modified Files:
src/distrib/utils/embedded/files: resize_disklabel

Log Message:
Can't use disklabel to find the real size of a disk since a fake disklabel
read from disk is trusted. Revert to use drvctl again.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/distrib/utils/embedded/files/resize_disklabel

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.