mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07: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:
co-authored by
Daniel Hofstetter
parent
a853a5b3ef
commit
095eced4be
@@ -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!());
|
||||
|
||||
Reference in New Issue
Block a user