# Ensure that rm -rf removes an empty-and-inaccessible directory.
authorJim Meyering <jim@meyering.net>
Sat, 11 Feb 2006 18:03:29 +0000 (18:03 +0000)
committerJim Meyering <jim@meyering.net>
Sat, 11 Feb 2006 18:03:29 +0000 (18:03 +0000)
tests/rm/empty-inacc [new file with mode: 0755]

diff --git a/tests/rm/empty-inacc b/tests/rm/empty-inacc
new file mode 100755 (executable)
index 0000000..02da725
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/sh
+# Ensure that rm -rf removes an empty-and-inaccessible directory.
+
+if test "$VERBOSE" = yes; then
+  set -x
+  rm --version
+fi
+
+PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
+
+pwd=`pwd`
+t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
+trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
+trap '(exit $?); exit $?' 1 2 13 15
+
+framework_failure=0
+mkdir -p $tmp || framework_failure=1
+cd $tmp || framework_failure=1
+mkdir -m0 inacc || framework_failure=1
+
+if test $framework_failure = 1; then
+  echo "$0: failure in testing framework" 1>&2
+  (exit 1); exit 1
+fi
+
+fail=0
+
+# This would fail for e.g., coreutils-5.93.
+rm -rf inacc || fail=1
+test -d inacc && fail=1
+
+(exit $fail); exit $fail