From e6e2b73db8004e122a06a253107cef2343b6e092 Mon Sep 17 00:00:00 2001 From: Glenn Washburn Date: Mon, 3 Mar 2025 02:12:04 -0600 Subject: [PATCH] tests/grub_cmd_cryptomount: Default TMPDIR to /tmp 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 Signed-off-by: Glenn Washburn Tested-by: Thomas Schmitt Reviewed-by: Daniel Kiper --- tests/grub_cmd_cryptomount.in | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/grub_cmd_cryptomount.in b/tests/grub_cmd_cryptomount.in index 2fba8a8e0..8dc99127d 100644 --- a/tests/grub_cmd_cryptomount.in +++ b/tests/grub_cmd_cryptomount.in @@ -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")