mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
chmod: Fix chmod -c --reference reporting when no change is made (#6016)
* Make fperm hold 6 digit octal permission. Set it to 4 digits when displaying * Add test * Make every permission 4 octal digits * Change test name to be more suggestive * chmod: merge two args in test --------- Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
This commit is contained in:
parent
a853a5b3ef
commit
095eced4be
2 changed files with 15 additions and 1 deletions
|
@ -101,7 +101,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
let recursive = matches.get_flag(options::RECURSIVE);
|
||||
let fmode = match matches.get_one::<String>(options::REFERENCE) {
|
||||
Some(fref) => match fs::metadata(fref) {
|
||||
Ok(meta) => Some(meta.mode()),
|
||||
Ok(meta) => Some(meta.mode() & 0o7777),
|
||||
Err(err) => {
|
||||
return Err(USimpleError::new(
|
||||
1,
|
||||
|
|
|
@ -645,6 +645,20 @@ fn test_quiet_n_verbose_used_multiple_times() {
|
|||
.succeeds();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_changes_from_identical_reference() {
|
||||
let scene = TestScenario::new(util_name!());
|
||||
let at = &scene.fixtures;
|
||||
at.touch("file");
|
||||
scene
|
||||
.ucmd()
|
||||
.arg("-c")
|
||||
.arg("--reference=file")
|
||||
.arg("file")
|
||||
.succeeds()
|
||||
.no_stdout();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_gnu_invalid_mode() {
|
||||
let scene = TestScenario::new(util_name!());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue