Module Name:    src
Committed By:   sjg
Date:           Mon Apr 18 15:59:39 UTC 2022

Modified Files:
        src/usr.bin/make/unit-tests: deptgt-posix.mk

Log Message:
Never 'rm -rf ${TMPDIR}' when you cannot be sure what it is

Use a safer variable for a subdir of ${TMPDIR} that we know
we can remove safely.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/deptgt-posix.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/unit-tests/deptgt-posix.mk
diff -u src/usr.bin/make/unit-tests/deptgt-posix.mk:1.1 src/usr.bin/make/unit-tests/deptgt-posix.mk:1.2
--- src/usr.bin/make/unit-tests/deptgt-posix.mk:1.1	Mon Apr 18 15:06:28 2022
+++ src/usr.bin/make/unit-tests/deptgt-posix.mk	Mon Apr 18 15:59:39 2022
@@ -1,4 +1,4 @@
-# $NetBSD: deptgt-posix.mk,v 1.1 2022/04/18 15:06:28 rillig Exp $
+# $NetBSD: deptgt-posix.mk,v 1.2 2022/04/18 15:59:39 sjg Exp $
 #
 # Tests for the special target '.POSIX', which enables POSIX mode.
 #
@@ -15,10 +15,10 @@
 # See also:
 #	https://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html
 
-TMPDIR?=	/tmp/make.test.deptgt-posix
-SYSDIR=		${TMPDIR}/sysdir
-MAIN_MK=	${TMPDIR}/main.mk
-INCLUDED_MK=	${TMPDIR}/included.mk
+TESTTMP=	${TMPDIR:U/tmp}/make.test.deptgt-posix
+SYSDIR=		${TESTTMP}/sysdir
+MAIN_MK=	${TESTTMP}/main.mk
+INCLUDED_MK=	${TESTTMP}/included.mk
 
 all: .PHONY
 .SILENT:
@@ -58,9 +58,9 @@ check-not-seen-sys-mk: .USE
 	    '.endif'
 
 run: .USE
-	(cd "${TMPDIR}" && MAKEFLAGS=${MAKEFLAGS.${.TARGET}:Q} ${MAKE} \
+	(cd "${TESTTMP}" && MAKEFLAGS=${MAKEFLAGS.${.TARGET}:Q} ${MAKE} \
 	    -m "${SYSDIR}" -f ${MAIN_MK:T})
-	rm -rf ${TMPDIR}
+	rm -rf ${TESTTMP}
 
 # If the main makefile has a '.for' loop as its first non-comment line, a
 # strict reading of POSIX 2018 makes the makefile non-conforming.

Reply via email to