Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make/unit-tests Never 'rm -rf ${TMPDIR}' when you ca...



details:   https://anonhg.NetBSD.org/src/rev/dc286b665fda
branches:  trunk
changeset: 365697:dc286b665fda
user:      sjg <sjg%NetBSD.org@localhost>
date:      Mon Apr 18 15:59:39 2022 +0000

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

diffstat:

 usr.bin/make/unit-tests/deptgt-posix.mk |  14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diffs (36 lines):

diff -r 8402dbf21f56 -r dc286b665fda usr.bin/make/unit-tests/deptgt-posix.mk
--- a/usr.bin/make/unit-tests/deptgt-posix.mk   Mon Apr 18 15:06:27 2022 +0000
+++ b/usr.bin/make/unit-tests/deptgt-posix.mk   Mon Apr 18 15:59:39 2022 +0000
@@ -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 @@
            '.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.



Home | Main Index | Thread Index | Old Index