diff --git a/Cargo.lock b/Cargo.lock index e9243c55b54..0e83c077035 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1010,9 +1010,9 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "half" -version = "2.3.1" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc52e53916c08643f1b56ec082790d1e86a32e58dc5268f897f313fbae7b4872" +checksum = "b5eceaaeec696539ddaf7b333340f1af35a5aa87ae3e4f3ead0532f72affab2e" dependencies = [ "cfg-if", "crunchy", diff --git a/Cargo.toml b/Cargo.toml index 0bc33644f5f..487da295489 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -284,7 +284,7 @@ fts-sys = "0.2" fundu = "2.0.0" gcd = "2.3" glob = "0.3.1" -half = "2.3" +half = "2.4" hostname = "0.3" indicatif = "0.17" itertools = "0.12.1" diff --git a/src/uu/chmod/src/chmod.rs b/src/uu/chmod/src/chmod.rs index 31663b1af9c..3c387b5f8ee 100644 --- a/src/uu/chmod/src/chmod.rs +++ b/src/uu/chmod/src/chmod.rs @@ -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::(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, diff --git a/tests/by-util/test_chmod.rs b/tests/by-util/test_chmod.rs index be730a8c0ad..35197f85ee4 100644 --- a/tests/by-util/test_chmod.rs +++ b/tests/by-util/test_chmod.rs @@ -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!()); diff --git a/tests/by-util/test_uniq.rs b/tests/by-util/test_uniq.rs index 7ebc5c482e9..8b791e6c0c8 100644 --- a/tests/by-util/test_uniq.rs +++ b/tests/by-util/test_uniq.rs @@ -755,7 +755,7 @@ fn gnu_tests() { TestCase { name: "112", args: &["-D", "-c"], - input: "a a\na b\n", + input: "", // Note: Different from GNU test, but should not matter stdout: Some(""), stderr: Some("uniq: printing all duplicated lines and repeat counts is meaningless\nTry 'uniq --help' for more information.\n"), exit: Some(1), @@ -811,7 +811,7 @@ fn gnu_tests() { TestCase { name: "119", args: &["--all-repeated=badoption"], - input: "a a\na b\n", + input: "", // Note: Different from GNU test, but should not matter stdout: Some(""), stderr: Some("uniq: invalid argument 'badoption' for '--all-repeated'\nValid arguments are:\n - 'none'\n - 'prepend'\n - 'separate'\nTry 'uniq --help' for more information.\n"), exit: Some(1),