From be39ded88973955b01c147fa053f26632de9556c Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sat, 11 Feb 2006 18:03:29 +0000 Subject: # Ensure that rm -rf removes an empty-and-inaccessible directory. --- tests/rm/empty-inacc | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 tests/rm/empty-inacc (limited to 'tests/rm') 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 -- cgit v1.2.3-54-g00ecf