From 0ab7479f5f1b430279ae45e41fb3d981018c2a2b Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 30 Mar 2026 14:21:50 +0200 Subject: [PATCH] fix(env): skip uncatchable signals on OpenBSD when applying to all signals --- .vscode/cspell.dictionaries/jargon.wordlist.txt | 1 + src/uu/env/src/env.rs | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.vscode/cspell.dictionaries/jargon.wordlist.txt b/.vscode/cspell.dictionaries/jargon.wordlist.txt index 3efb7d3a9..8b6a8c908 100644 --- a/.vscode/cspell.dictionaries/jargon.wordlist.txt +++ b/.vscode/cspell.dictionaries/jargon.wordlist.txt @@ -279,3 +279,4 @@ Nofile rprocess statat getdents +SIGTHR diff --git a/src/uu/env/src/env.rs b/src/uu/env/src/env.rs index 334354425..aa1bcfc70 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