mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
Merge pull request #2281 from deantvv/chmod-match-gnu-error
chmod: match GNU error
This commit is contained in:
@@ -262,8 +262,10 @@ impl Chmoder {
|
||||
);
|
||||
}
|
||||
return Ok(());
|
||||
} else if err.kind() == std::io::ErrorKind::PermissionDenied {
|
||||
show_error!("'{}': Permission denied", file.display());
|
||||
} else {
|
||||
show_error!("{}: '{}'", err, file.display());
|
||||
show_error!("'{}': {}", file.display(), err);
|
||||
}
|
||||
return Err(1);
|
||||
}
|
||||
|
||||
@@ -282,6 +282,26 @@ fn test_chmod_reference_file() {
|
||||
run_single_test(&tests[0], at, ucmd);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_permission_denied() {
|
||||
let scene = TestScenario::new(util_name!());
|
||||
let at = &scene.fixtures;
|
||||
|
||||
at.mkdir("d/");
|
||||
at.mkdir("d/no-x");
|
||||
at.mkdir("d/no-x/y");
|
||||
|
||||
scene.ucmd().arg("u=rw").arg("d/no-x").succeeds();
|
||||
|
||||
scene
|
||||
.ucmd()
|
||||
.arg("-R")
|
||||
.arg("o=r")
|
||||
.arg("d")
|
||||
.fails()
|
||||
.stderr_is("chmod: 'd/no-x/y': Permission denied");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_chmod_recursive() {
|
||||
let _guard = UMASK_MUTEX.lock();
|
||||
|
||||
Reference in New Issue
Block a user