summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2008-07-22 11:23:08 +0200
committerJim Meyering <meyering@redhat.com>2008-07-22 13:15:02 +0200
commitf82c5ba71efd1228a58953b6efc5e0d84c73e8a4 (patch)
tree355886625c4d80089677b4ad4acf25c3851c17df /tests
parent9bb0d5766eeb200dae447a616903f14a0079aa63 (diff)
downloadcoreutils-f82c5ba71efd1228a58953b6efc5e0d84c73e8a4.tar.xz
tests: do not run chmod on a prefix of space-embedded tmpdir
* TESTS/test-lib.sh (remove_tmp_): New function. (trap 0): Use it instead of open-coded (and misquoted) version.
Diffstat (limited to 'tests')
-rw-r--r--tests/test-lib.sh10
1 files changed, 8 insertions, 2 deletions
diff --git a/tests/test-lib.sh b/tests/test-lib.sh
index 2083d0c15..f38693334 100644
--- a/tests/test-lib.sh
+++ b/tests/test-lib.sh
@@ -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_"