From 78b166d1b163df894d567b79d3bb5744156fb0fe Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Mon, 26 Jun 2006 13:02:01 +0000 Subject: * NEWS: rm no longer fails to remove an empty, unreadable directory * src/remove.c (remove_cwd_entries): If we can't open a directory, and the failure is not being ignored, try to remove the directory with rmdir (aka unlinkat-with-AT_REMOVEDIR), in case it's empty. Problem report and test case from Paul Eggert in . * tests/rm/empty-inacc: New test, for the above. --- tests/rm/empty-inacc | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests/rm/empty-inacc') diff --git a/tests/rm/empty-inacc b/tests/rm/empty-inacc index 02da7257c..6c009759f 100755 --- a/tests/rm/empty-inacc +++ b/tests/rm/empty-inacc @@ -18,6 +18,10 @@ mkdir -p $tmp || framework_failure=1 cd $tmp || framework_failure=1 mkdir -m0 inacc || framework_failure=1 +# Also exercise the different code path that's taken for a directory +# that is empty (hence removable) and unreadable. +mkdir -m a-r -p a/unreadable + if test $framework_failure = 1; then echo "$0: failure in testing framework" 1>&2 (exit 1); exit 1 @@ -29,4 +33,8 @@ fail=0 rm -rf inacc || fail=1 test -d inacc && fail=1 +# This would fail for e.g., coreutils-5.97. +rm -rf a || fail=1 +test -d a && fail=1 + (exit $fail); exit $fail -- cgit v1.2.3-70-g09d2