From 4d71a6e2d2145655e24d94f46fb48e02160992db Mon Sep 17 00:00:00 2001 From: Adrian Kretz Date: Thu, 13 Nov 2025 00:13:24 +0100 Subject: [PATCH 1/2] test/install: add test to ignore umask --- tests/by-util/test_install.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index f4c7b2dc1..1e78b28da 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -243,6 +243,29 @@ fn test_install_mode_symbolic() { assert_eq!(0o100_003_u32, PermissionsExt::mode(&permissions)); } +#[test] +fn test_install_mode_symbolic_ignore_umask() { + let (at, mut ucmd) = at_and_ucmd!(); + let dir = "target_dir"; + let file = "source_file"; + let mode_arg = "--mode=+w"; + + at.touch(file); + at.mkdir(dir); + ucmd.arg(file) + .arg(dir) + .arg(mode_arg) + .umask(0o022) + .succeeds() + .no_stderr(); + + let dest_file = &format!("{dir}/{file}"); + assert!(at.file_exists(file)); + assert!(at.file_exists(dest_file)); + let permissions = at.metadata(dest_file).permissions(); + assert_eq!(0o100_222_u32, PermissionsExt::mode(&permissions)); +} + #[test] fn test_install_mode_failing() { let (at, mut ucmd) = at_and_ucmd!(); From 376b88ac72dd5e63d2342721610b07d3dc2fadfc Mon Sep 17 00:00:00 2001 From: Adrian Kretz Date: Thu, 13 Nov 2025 00:14:00 +0100 Subject: [PATCH 2/2] install: ignore umask with symbolic mode --- src/uu/install/src/install.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index 4242cc04b..49252dcf9 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -25,7 +25,6 @@ use uucore::display::Quotable; use uucore::entries::{grp2gid, usr2uid}; use uucore::error::{FromIo, UError, UResult, UUsageError}; use uucore::fs::dir_strip_dot_for_creation; -use uucore::mode::get_umask; use uucore::perms::{Verbosity, VerbosityLevel, wrap_chown}; use uucore::process::{getegid, geteuid}; #[cfg(feature = "selinux")] @@ -339,7 +338,7 @@ fn behavior(matches: &ArgMatches) -> UResult { let specified_mode: Option = if matches.contains_id(OPT_MODE) { let x = matches.get_one::(OPT_MODE).ok_or(1)?; - Some(mode::parse(x, considering_dir, get_umask()).map_err(|err| { + Some(mode::parse(x, considering_dir, 0).map_err(|err| { show_error!( "{}", translate!("install-error-invalid-mode", "error" => err)