diff --git a/.vscode/cspell.dictionaries/jargon.wordlist.txt b/.vscode/cspell.dictionaries/jargon.wordlist.txt index c468ef0ea74..8b6a8c90858 100644 --- a/.vscode/cspell.dictionaries/jargon.wordlist.txt +++ b/.vscode/cspell.dictionaries/jargon.wordlist.txt @@ -254,3 +254,29 @@ Hijri Nowruz charmap hijri + +csignal +noent +nptl +oldset +ptrs +rdband +rustix +setmask +sigaddset +sigemptyset +sigfillset +sighandler +sigmask +signum +sigprocmask +sigrtmin +sigset +sigsys +esrch +SRCH +Nofile +rprocess +statat +getdents +SIGTHR diff --git a/Cargo.lock b/Cargo.lock index 3b6c0bfaf62..75d96b8de6b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3787,7 +3787,8 @@ version = "0.8.0" dependencies = [ "clap", "fluent", - "nix", + "libc", + "rustix", "uucore", ] diff --git a/Cargo.toml b/Cargo.toml index 75b6b07c855..dc3d5c73448 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -450,9 +450,11 @@ rstest = "0.26.0" rstest_reuse = "0.7.0" rustc-hash = "2.1.1" rust-ini = "0.21.0" -# binary name of coreutils can be hijacked by overriding getauxval via LD_PRELOAD -# So we use param and avoid libc backend -rustix = { version = "1.1.4", features = ["param"] } +# use-libc: route syscalls through glibc instead of direct inline assembly, +# ensuring compatibility with LD_PRELOAD, sanitizers, and glibc optimizations (e.g. getpid cache) +rustix = { version = "1.1.4", default-features = false, features = [ + "use-libc", +] } same-file = "1.0.6" self_cell = "1.0.4" selinux = "0.6" diff --git a/src/uu/env/src/env.rs b/src/uu/env/src/env.rs index 3343544253e..aa1bcfc7017 100644 --- a/src/uu/env/src/env.rs +++ b/src/uu/env/src/env.rs @@ -1080,7 +1080,16 @@ where let Ok(sig) = signal_from_value(sig_value) else { return Ok(()); }; - signal_fn(sig)?; + match signal_fn(sig) { + Ok(()) => {} + Err(_) if !explicit => { + // When applying to all signals, silently skip signals that + // the OS refuses to change (e.g. SIGTHR on OpenBSD). + // GNU env also ignores these. + return Ok(()); + } + Err(e) => return Err(e), + } log.record(sig_value, action_kind, explicit); // Set environment variable to communicate to Rust child processes