;;
esac
-# We use a trap below for cleanup. This requires us to go through
-# hoops to get the right exit status transported through the signal.
-# So use `Exit STATUS' instead of `exit STATUS' inside of the tests.
-# Turn off errexit here so that we don't trip the bug with OSF1/Tru64
-# sh inside this function.
-Exit ()
-{
- set +e
- (exit $1)
- exit $1
-}
-curdir=`pwd`
+## ---------------------------------------------------------------- ##
+## Create and set up of the temporary directory used by the test. ##
+## Set up of the exit trap for cleanup of said directory. ##
+## ---------------------------------------------------------------- ##
+
+# The subdirectory where the current test script will run and write its
+# temporary/data files. This will be created shortly, and will be removed
+# by the cleanup trap below if the test passes. If the test doesn't pass,
+# this directory will be kept, to facilitate debugging.
testSubDir=$me.dir
+
test ! -d $testSubDir || {
- find $testSubDir -type d ! -perm -200 -exec chmod u+w {} ";"
+ find $testSubDir -type d ! -perm -700 -exec chmod u+rwx {} ";"
rm -rf $testSubDir
}
mkdir $testSubDir
if test "$sh_errexit_works" = yes; then
trap 'exit_status=$?
set +e
- cd "$curdir"
+ cd "$testbuilddir"
case $exit_status,$keep_testdirs in
0,)
- find $testSubDir -type d ! -perm -200 -exec chmod u+w {} ";"
+ find $testSubDir -type d ! -perm -700 -exec chmod u+rwx {} ";"
rm -rf $testSubDir
;;
esac