Skip to content

env: list the state of the signals, not the actions taken - #15186

Merged
sylvestre merged 3 commits into
uutils:mainfrom
NdekoCode:env-list-signal-handling
Nov 7, 2026
Merged

sylvestre merged 3 commits into
uutils:mainfrom
NdekoCode:env-list-signal-handling

Conversation

@NdekoCode

Copy link
Copy Markdown
Contributor

--list-signal-handling printed the actions env had been asked for, so a signal set to its default was listed as DEFAULT, an ignore inherited from the parent was not listed at all, and a signal both blocked and ignored showed a single state. GNU 9.12 lists every signal that is not at its default once the options are applied, inherited or not, as BLOCK, IGNORE or BLOCK,IGNORE, with the number padded to two characters.

env now queries the disposition and the mask of each signal and prints those; the log of actions only served the listing and goes away. The tests check a line each rather than the whole output, since other tests in the same process change its dispositions while they run and env lists what it inherits. Checked against GNU 9.12; the env suite passes. Part of what env/env-signal-handler.sh from #14705 checks.

Closes #15185.

Comment thread src/uu/env/src/env.rs Resolved
Comment thread src/uu/env/src/env.rs Resolved
Comment thread src/uu/env/src/env.rs Resolved
Comment thread src/uu/env/src/env.rs Resolved
Comment thread tests/by-util/test_env.rs Resolved
@NdekoCode
NdekoCode requested a review from sylvestre October 9, 2026 21:57
@NdekoCode
NdekoCode force-pushed the env-list-signal-handling branch from c7ed1cb to 4fd4639 Compare October 20, 2026 19:33
@NdekoCode

NdekoCode commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor Author

@sylvestre rebased on main, the tests use path() now.

NdekoCode and others added 3 commits November 4, 2026 08:05
--list-signal-handling printed the actions env had been asked for, so a
signal set to its default was listed as DEFAULT, an inherited ignore
was not listed at all, and a signal both blocked and ignored showed one
state. GNU lists every signal that is not at its default once the
options are applied, inherited or not, as BLOCK, IGNORE or both, with
the number padded to two characters.

Query the disposition and the mask of each signal and print those.
The log of actions only served the listing and goes away.
Nothing reads the explicit flag of for_each_signal any more, so drop it.
The last signal to look at is signal_number_upper_bound(), and the state
of a signal is a match on (blocked, ignored) rather than a joined Vec.

The inherited-state test ignored USR1 in the test process itself, which
all the tests share (test_tail sends USR1 to its children): ignore it in
an outer env and list from an inner one instead.
@sylvestre
sylvestre force-pushed the env-list-signal-handling branch from bac466f to a9013f0 Compare November 4, 2026 07:05
@sylvestre
sylvestre merged commit 99f2d8a into uutils:main Nov 7, 2026
136 of 137 checks passed
@sylvestre

Copy link
Copy Markdown
Contributor

Thanks for your PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

env: --list-signal-handling lists env's own changes, not the state of the signals

2 participants