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

rm: allow -r flag to be specified multiple times

GNU rm allows the `-r` flag to be specified multiple times, but
uutils/coreutils would previously exit with an error.

I encountered this while attempting to run `make clean` on the
Postgres source tree (github.com/postgres/postgres).

Updates #1663.
This commit is contained in:
Kevin Burke 2021-10-28 21:50:58 -07:00
parent 1b39a10938
commit 3e1c5c2d99
No known key found for this signature in database
GPG key ID: D1D71AA4DED6C5C4
2 changed files with 24 additions and 0 deletions

View file

@ -169,6 +169,29 @@ fn test_rm_recursive() {
assert!(!at.file_exists(file_b));
}
#[test]
fn test_rm_recursive_multiple() {
let (at, mut ucmd) = at_and_ucmd!();
let dir = "test_rm_recursive_directory";
let file_a = "test_rm_recursive_directory/test_rm_recursive_file_a";
let file_b = "test_rm_recursive_directory/test_rm_recursive_file_b";
at.mkdir(dir);
at.touch(file_a);
at.touch(file_b);
ucmd.arg("-r")
.arg("-r")
.arg("-r")
.arg(dir)
.succeeds()
.no_stderr();
assert!(!at.dir_exists(dir));
assert!(!at.file_exists(file_a));
assert!(!at.file_exists(file_b));
}
#[test]
fn test_rm_directory_without_flag() {
let (at, mut ucmd) = at_and_ucmd!();