]> git.ipfire.org Git - thirdparty/coreutils.git/commit
rm: --dir (-d): fix bugs in handling of empty, inaccessible directories
authorJim Meyering <meyering@meta.com>
Mon, 6 Feb 2023 17:01:55 +0000 (09:01 -0800)
committerJim Meyering <meyering@meta.com>
Tue, 21 Feb 2023 15:18:17 +0000 (07:18 -0800)
commita0803c4bad6f8e11bb05effcc42ef433f4fc3f9b
tree89b7c3a87814938ceedcf401c5862619208c03b2
parent95f4ee0577dd836de523f46999777fbbbe9d2772
rm: --dir (-d): fix bugs in handling of empty, inaccessible directories

* src/remove.c (prompt, rm_fts): In the dir-handling code of both of
these functions, relax a "get_dir_status (...) == DS_EMPTY" condition
to instead test only "get_dir_status (...) != 0", enabling flow control
to reach the prompt function also for unreadable directories. However,
that function itself also needed special handling for this case:
(prompt): Handle empty, inaccessible directories properly,
deleting them with -d (--dir), and prompting about whether to delete
with -i (--interactive).
* tests/rm/empty-inacc.sh: Add tests for the new code.
Reported by наб <nabijaczleweli@nabijaczleweli.xyz> in
bugs.debian.org/1015273
* NEWS (Bug fixes): Mention this.
NEWS
src/remove.c
tests/rm/empty-inacc.sh