mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
bug(chmod): chmod on symlink pointing to non existing file is failing (#1694)
This commit is contained in:
parent
88911be6e0
commit
013bb285cd
2 changed files with 46 additions and 1 deletions
|
@ -346,3 +346,31 @@ fn test_chmod_preserve_root() {
|
|||
.stderr
|
||||
.contains("chmod: error: it is dangerous to operate recursively on '/'"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_chmod_symlink_non_existing_file() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
at.symlink_file("/non-existing", "test-long.link");
|
||||
|
||||
let result = ucmd
|
||||
.arg("-R")
|
||||
.arg("755")
|
||||
.arg("-v")
|
||||
.arg("test-long.link")
|
||||
.fails();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_chmod_symlink_non_existing_recursive() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
at.mkdir("tmp");
|
||||
at.symlink_file("/non-existing", "tmp/test-long.link");
|
||||
|
||||
let result = ucmd.arg("-R").arg("755").arg("-v").arg("tmp").succeeds();
|
||||
// it should be a success
|
||||
println!("stderr {}", result.stderr);
|
||||
println!("stdout {}", result.stdout);
|
||||
assert!(result
|
||||
.stderr
|
||||
.contains("neither symbolic link 'tmp/test-long.link' nor referent has been changed"));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue