]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
tests/grub_cmd_cryptomount: Default TMPDIR to /tmp
authorGlenn Washburn <development@efficientek.com>
Mon, 3 Mar 2025 08:12:04 +0000 (02:12 -0600)
committerDaniel Kiper <daniel.kiper@oracle.com>
Wed, 26 Mar 2025 13:23:42 +0000 (14:23 +0100)
This fixes behavior where grub_cmd_cryptomount temporary files, which are
some times not cleaned up, are left in the / directory. Set TMPDIR if your
system does not have /tmp or it can not be used for some reason.

Reported-by: Thomas Schmitt <scdbackup@gmx.net>
Signed-off-by: Glenn Washburn <development@efficientek.com>
Tested-by: Thomas Schmitt <scdbackup@gmx.net>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
tests/grub_cmd_cryptomount.in

index 2fba8a8e0e3a25d1416a384402b3eb19aea30117..8dc99127d39eb2bff50e2a6b70263a627bf8995c 100644 (file)
@@ -47,8 +47,9 @@ _testcase() {
     shift 2
 
     # Create a subdir in TMPDIR for each testcase
-    _TMPDIR=$TMPDIR
-    TMPDIR=$TMPDIR/`echo -n "$(date +%s).$LOGPREFIX" | sed -e 's,[ /],_,g' -e 's,:$,,g'`
+    _TMPDIR=${TMPDIR:-/tmp}
+    TMPDIR=${_TMPDIR}/`echo -n "$(date +%s).${LOGPREFIX}" | sed -e 's,[ /],_,g' -e 's,:$,,g'`
+    export TMPDIR
     mkdir -p "$TMPDIR"
     set -- "$@" $([ "${EXPECTEDRES}" -eq 1 ] && echo "--xfail")