diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index bd853e26c..a9b03eb34 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -757,6 +757,8 @@ fn need_copy(from: &Path, to: &Path, b: &Behavior) -> UResult { // setuid || setgid || sticky let extra_mode: u32 = 0o7000; + // setuid || setgid || sticky || permissions + let all_modes: u32 = 0o7777; if b.specified_mode.unwrap_or(0) & extra_mode != 0 || from_meta.mode() & extra_mode != 0 @@ -764,6 +766,9 @@ fn need_copy(from: &Path, to: &Path, b: &Behavior) -> UResult { { return Ok(true); } + if b.mode() != to_meta.mode() & all_modes { + return Ok(true); + } if !from_meta.is_file() || !to_meta.is_file() { return Ok(true);