Skip to content

Commit 6825995

Browse files
committed
chmod: Regression tests for --preserve-root not being bypassed by path that resolves to root
1 parent 3e40483 commit 6825995

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/by-util/test_chmod.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,17 @@ fn test_chmod_preserve_root() {
508508
.stderr_contains("chmod: it is dangerous to operate recursively on '/'");
509509
}
510510

511+
#[test]
512+
fn test_chmod_preserve_root_with_paths_that_resolve_to_root() {
513+
new_ucmd!()
514+
.arg("-R")
515+
.arg("--preserve-root")
516+
.arg("755")
517+
.arg("/../")
518+
.fails_with_code(1)
519+
.stderr_contains("chmod: it is dangerous to operate recursively on '/'");
520+
}
521+
511522
#[test]
512523
fn test_chmod_symlink_non_existing_file() {
513524
let scene = TestScenario::new(util_name!());

0 commit comments

Comments
 (0)