(I found this while testing a new version of 'install-sh'.)
Here's a scenario illustrating the problem.
$ mkdir -m a-r -p a/b
$ rm -fr a
rm: cannot open directory `a/b': Permission denied
rm: cannot remove directory `a': Directory not empty
$ ls -ld a a/b
drwxr-xr-x 3 eggert eggert 4096 Jun 26 00:51 a
d-wx-wx-wx 2 eggert eggert 4096 Jun 26 00:51 a/b
My reading of POSIX is that, though a diagnostic is allowed here and
rm can exit with nonzero status because a/b is unreadable, "rm" is
still required to rmdir both a/b and a here, so this is a
POSIX-conformance issue.
Solaris 10 'rm' gets it right: when it discovers that "a/b" is
unreadable (openat fails) it tries rmdir("a/b"), and this works. No
diagnostics are issued.
This problem is in both coreutils 5.97 and CVS trunk.
One other test case:
$ mkdir -m 0 -p a/b
$ rm -fr a
rm: cannot chdir from `a' to `b': Permission denied
$ ls -ld a a/b
drwxr-xr-x 3 eggert eggert 4096 Jun 26 01:00 a
d--------- 2 eggert eggert 4096 Jun 26 01:00 a/b
This omits the "Directory not entry" diagnostic. It's a bit odd that
the diagnostic is omitted here but not for the first test case -- is
that intended?
_______________________________________________
Bug-coreutils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-coreutils