commit:     2f32e4a026a1d45bfc8223f55bb8913f2d455ec5
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Thu Aug  8 09:28:03 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Aug 11 10:11:00 2024 +0000
URL:        
https://gitweb.gentoo.org/proj/gentoo-functions.git/commit/?id=2f32e4a0

test-functions: choose a better variable name for storing the temp dir

The name, dir, is rather generic. Rename it to global_tmpdir to diminish
the likelihood of an accidental name space conflict.

Also, don't pass the -f option to rm(1) at the point that the directory
is to be removed.

Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 test-functions | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/test-functions b/test-functions
index 275d32f..1f54208 100755
--- a/test-functions
+++ b/test-functions
@@ -12,14 +12,14 @@ bailout() {
 }
 
 assign_tmpdir() {
-       dir=$(mktemp -d) \
-       && chdir "${dir}" \
+       global_tmpdir=$(mktemp -d) \
+       && chdir "${global_tmpdir}" \
        || bailout "Couldn't create or change to the temp dir"
 }
 
 cleanup_tmpdir() {
-       if [ -n "${dir}" ]; then
-               rm -rf -- "${dir}"
+       if [ "${global_tmpdir}" ]; then
+               rm -r -- "${global_tmpdir}"
        fi
 }
 
@@ -1103,7 +1103,7 @@ iterate_tests() {
 
 printf 'TAP version 13\n'
 
-unset -v dir
+unset -v global_tmpdir
 
 # PATH is redefined to prevent ebuild-helpers such as die from interfering.
 export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/opt/pkg/bin

Reply via email to