]> git.ipfire.org Git - thirdparty/coreutils.git/commit
rmdir: diagnose non following of symlinks with trailing slash
authorPádraig Brady <P@draigBrady.com>
Tue, 16 Feb 2021 05:07:40 +0000 (05:07 +0000)
committerPádraig Brady <P@draigBrady.com>
Fri, 19 Feb 2021 11:35:30 +0000 (11:35 +0000)
commit9de1d153f82243aeaaf19b0e5da2345f9b8652e3
treea2ac338e39e265ea940ad3daffc690027e864f9e
parenta5e0d8f387e81e854427addbbaf2504541bbf4b9
rmdir: diagnose non following of symlinks with trailing slash

GNU/Linux is unusual here in that rmdir("symlink/") returns ENOTDIR,
whereas Solaris and FreeBSD at least, will follow the symlink
and remove the target directory.  We don't make the behavior
on Linux kernels consistent, but at least clarify
the confusing error message.

* src/rmdir (main): Output a specific error message for the above case.
(remove_parents): In the error message, don't assume intermediate paths
are directories, as they could be symlinks.
* tests/rmdir/symlink-errors.sh: Add a new test.
* tests/local.mk: Reference the new test.
* NEWS: Mention the improvement.
NEWS
src/rmdir.c
tests/local.mk
tests/rmdir/symlink-errors.sh [new file with mode: 0755]