]> git.ipfire.org Git - thirdparty/coreutils.git/commit
rm: do not skip files upon failure to remove an empty dir
authorNishant Nayan <nishant.nayan@oracle.com>
Thu, 26 Nov 2020 14:35:17 +0000 (14:35 +0000)
committerPádraig Brady <P@draigBrady.com>
Thu, 26 Nov 2020 16:51:38 +0000 (16:51 +0000)
commit6bf108358a6104ec1c694c9530b3cd56b95f4b57
treea559bf46fff34bbc5916b8f1df3f2b314bce8de2
parentb886390947fb9152341eb7ecf6fa223fbf46da32
rm: do not skip files upon failure to remove an empty dir

When removing a directory fails for some reason, and that directory
is empty, the rm_fts code gets the return value of the excise call
confused with the return value of its earlier call to prompt,
causing fts_skip_tree to be called again and the next file
that rm would otherwise have deleted to survive.

* src/remove.c (rm_fts): Ensure we only skip a single fts entry,
when processing empty dirs.  I.e. only skip the entry
having successfully removed it.
* tests/rm/empty-immutable-skip.sh: New root-only test.
* tests/local.mk: Add it.
* NEWS: Mention the bug fix.
Fixes https://bugs.gnu.org/44883
NEWS
src/remove.c
tests/local.mk
tests/rm/empty-immutable-skip.sh [new file with mode: 0755]