tests: do not run chmod on a prefix of space-embedded tmpdir
authorJim Meyering <meyering@redhat.com>
Tue, 22 Jul 2008 09:23:08 +0000 (11:23 +0200)
committerJim Meyering <meyering@redhat.com>
Tue, 22 Jul 2008 11:15:02 +0000 (13:15 +0200)
* TESTS/test-lib.sh (remove_tmp_): New function.
(trap 0): Use it instead of open-coded (and misquoted) version.

tests/test-lib.sh

index 2083d0c..f386933 100644 (file)
@@ -271,10 +271,16 @@ cleanup_() { :; }
 t_=$("$abs_top_builddir/src/mktemp" -d --tmp="$test_dir_" cu-$this_test.XXXXXXXXXX)\
     || error_ "failed to create temporary directory in $test_dir_"
 
+remove_tmp_()
+{
+  local st=$?
+  cleanup_
+  cd "$test_dir_" && chmod -R u+rwx "$t_" && rm -rf "$t_" && exit $st
+}
+
 # Run each test from within a temporary sub-directory named after the
 # test itself, and arrange to remove it upon exception or normal exit.
-trap 'st=$?; cleanup_; d='"$t_"';
-    cd '"$test_dir_"' && chmod -R u+rwx "$d" && rm -rf "$d" && exit $st' 0
+trap remove_tmp_ 0
 trap '(exit $?); exit $?' 1 2 13 15
 
 cd "$t_" || error_ "failed to cd to $t_"