1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

rm: correct prompt for removing inaccessible dir

Change the prompt when attempting to remove an inaccessible
directory. Before this commit, the prompt was

    rm: remove write-protected directory 'dir'?

After this commit, the prompt is

    rm: attempt removal of inaccessible directory 'dir'?

This required slightly adjusting the logic for which prompt messages to
display under which circumstances.

Fixes #7309.
This commit is contained in:
Jeffrey Finkelstein 2025-02-18 18:39:45 -05:00
parent bc995283c4
commit 2b531b78ef
2 changed files with 44 additions and 20 deletions

View file

@ -874,6 +874,19 @@ fn test_inaccessible_dir_nonempty() {
assert!(at.dir_exists("dir"));
}
#[cfg(not(windows))]
#[test]
fn test_inaccessible_dir_interactive() {
let (at, mut ucmd) = at_and_ucmd!();
at.mkdir("dir");
at.set_mode("dir", 0);
ucmd.args(&["-i", "-d", "dir"])
.pipe_in("y\n")
.succeeds()
.stderr_only("rm: attempt removal of inaccessible directory 'dir'? ");
assert!(!at.dir_exists("dir"));
}
#[cfg(not(windows))]
#[test]
fn test_inaccessible_dir_recursive() {