Skip to content

Commit 6190978

Browse files
authored
Merge branch 'main' into patch-2
2 parents 4ddefec + 7f4d902 commit 6190978

File tree

4 files changed

+29
-14
lines changed

4 files changed

+29
-14
lines changed

.github/workflows/CICD.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -273,10 +273,7 @@ jobs:
273273
target: aarch64-unknown-linux-gnu
274274
- uses: taiki-e/install-action@nextest
275275
- uses: Swatinem/rust-cache@v2
276-
- name: Install/setup prerequisites
277-
shell: bash
278-
run: |
279-
sudo apt-get -y update ; sudo apt-get -y install libselinux1-dev
276+
# Test build on the system missing libselinux (don't install libselinux1-dev at here)
280277
- name: Run sccache-cache
281278
uses: mozilla-actions/[email protected]
282279
- name: "`make build`"

GNUmakefile

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -195,15 +195,11 @@ HASHSUM_PROGS := \
195195

196196
$(info Detected OS = $(OS))
197197

198-
# Build the SELinux programs only on Linux
199-
ifeq ($(filter $(OS),Linux),)
200-
SELINUX_PROGS :=
201-
endif
202-
203198
ifneq ($(OS),Windows_NT)
204-
PROGS := $(PROGS) $(UNIX_PROGS)
205-
# Build the selinux command even if not on the system
206-
PROGS := $(PROGS) $(SELINUX_PROGS)
199+
PROGS += $(UNIX_PROGS)
200+
endif
201+
ifeq ($(SELINUX_ENABLED),1)
202+
PROGS += $(SELINUX_PROGS)
207203
endif
208204

209205
UTILS ?= $(filter-out $(SKIP_UTILS),$(PROGS))

src/uu/install/src/install.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ use uucore::display::Quotable;
2525
use uucore::entries::{grp2gid, usr2uid};
2626
use uucore::error::{FromIo, UError, UResult, UUsageError};
2727
use uucore::fs::dir_strip_dot_for_creation;
28-
use uucore::mode::get_umask;
2928
use uucore::perms::{Verbosity, VerbosityLevel, wrap_chown};
3029
use uucore::process::{getegid, geteuid};
3130
#[cfg(feature = "selinux")]
@@ -339,7 +338,7 @@ fn behavior(matches: &ArgMatches) -> UResult<Behavior> {
339338

340339
let specified_mode: Option<u32> = if matches.contains_id(OPT_MODE) {
341340
let x = matches.get_one::<String>(OPT_MODE).ok_or(1)?;
342-
Some(mode::parse(x, considering_dir, get_umask()).map_err(|err| {
341+
Some(mode::parse(x, considering_dir, 0).map_err(|err| {
343342
show_error!(
344343
"{}",
345344
translate!("install-error-invalid-mode", "error" => err)

tests/by-util/test_install.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,29 @@ fn test_install_mode_symbolic() {
243243
assert_eq!(0o100_003_u32, PermissionsExt::mode(&permissions));
244244
}
245245

246+
#[test]
247+
fn test_install_mode_symbolic_ignore_umask() {
248+
let (at, mut ucmd) = at_and_ucmd!();
249+
let dir = "target_dir";
250+
let file = "source_file";
251+
let mode_arg = "--mode=+w";
252+
253+
at.touch(file);
254+
at.mkdir(dir);
255+
ucmd.arg(file)
256+
.arg(dir)
257+
.arg(mode_arg)
258+
.umask(0o022)
259+
.succeeds()
260+
.no_stderr();
261+
262+
let dest_file = &format!("{dir}/{file}");
263+
assert!(at.file_exists(file));
264+
assert!(at.file_exists(dest_file));
265+
let permissions = at.metadata(dest_file).permissions();
266+
assert_eq!(0o100_222_u32, PermissionsExt::mode(&permissions));
267+
}
268+
246269
#[test]
247270
fn test_install_mode_failing() {
248271
let (at, mut ucmd) = at_and_ucmd!();

0 commit comments

Comments
 (0)