summaryrefslogtreecommitdiff
path: root/tests/rm/empty-inacc
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2006-02-11 18:03:29 +0000
committerJim Meyering <jim@meyering.net>2006-02-11 18:03:29 +0000
commitbe39ded88973955b01c147fa053f26632de9556c (patch)
tree0f382a0db92fec6813363a4b3c7527df734f00d2 /tests/rm/empty-inacc
parent870179fcd805c1c7c750ad4ee0606905f4d98117 (diff)
downloadcoreutils-be39ded88973955b01c147fa053f26632de9556c.tar.xz
# Ensure that rm -rf removes an empty-and-inaccessible directory.
Diffstat (limited to 'tests/rm/empty-inacc')
-rwxr-xr-xtests/rm/empty-inacc32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/rm/empty-inacc b/tests/rm/empty-inacc
new file mode 100755
index 000000000..02da7257c
--- /dev/null
+++ b/tests/rm/empty-inacc
@@ -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