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

bug(chmod): chmod on symlink pointing to non existing file is failing (#1694)

This commit is contained in:
Sylvestre Ledru 2021-01-18 23:09:00 +01:00 committed by GitHub
parent 88911be6e0
commit 013bb285cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 46 additions and 1 deletions

View file

@ -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"));
}