Skip to content

env: apply the signal options in the order they are given - #15208

Merged
RenjiSann merged 1 commit into
uutils:mainfrom
paoValle:env-signal-order
Oct 21, 2026
Merged

RenjiSann merged 1 commit into
uutils:mainfrom
paoValle:env-signal-order

Conversation

@paoValle

@paoValle paoValle commented Oct 9, 2026

Copy link
Copy Markdown

env applied --default-signal, --ignore-signal and --block-signal in a fixed order, so env --ignore-signal=INT --default-signal=INT --list-signal-handling true left INT ignored where GNU reports DEFAULT, and --ignore-signal --default-signal=INT did the same.

The options are now applied in the order they are given, using the index clap records for each value. An option without a value still applies to every signal.

Closes #15187.

test_env_arg_ignore_signal_all_signals and test_env_arg_ignore_signal_valid_signals fail on macOS here with and without this change (they send a signal right after spawning and assert the process is still alive); everything else in test_env passes.

Comment thread src/uu/env/src/env.rs Outdated
@paoValle

Copy link
Copy Markdown
Author

Hi @RenjiSann — a quick check on this proposal: is it something you'd like to take? Your comment about action_kind being passed twice is addressed in c6889856 (apply_signal_action now takes only the kind and derives the handler inside), and the CI on that commit is green: 93 passed, 4 skipped, no failures.

If there's no interest I'll go ahead and close it in ten days or so, no worries at all — I'd just rather keep the queue here tidy than leave it sitting.

@RenjiSann

Copy link
Copy Markdown
Collaborator

I have no other objection to the code :)

However, maybe you could squash the second commit in the first, that'd help keeping a readable main branch ^^

@RenjiSann

Copy link
Copy Markdown
Collaborator

linting CI is unhappy, you may want to fix that

@paoValle

paoValle commented Oct 20, 2026 •

Copy link
Copy Markdown
Author

Squashed into a single commit as asked — the helper change is described in the body now instead of in a second commit. The tree is otherwise the one the green run describes; the commit was rebased onto main afterwards, so its sha moved (the current head is in the next comment).

GNU applies --default-signal, --ignore-signal and --block-signal in the order
they appear on the command line, so the last one for a signal wins. uutils
applied them in a fixed order (default, ignore, block) whatever their order, so
`env --ignore-signal=INT --default-signal=INT --list-signal-handling` left INT
ignored instead of default, and `--ignore-signal --default-signal=INT` also left
INT ignored.

The three options are now collected with the index clap gives each value and
applied in the order given. An option without a value still applies to every
signal. apply_signal_action now takes only the action kind and derives the
handler inside, so the call sites no longer spell the match out.
@paoValle

Copy link
Copy Markdown
Author

The rebase onto main broke the test target and the checks said so: the merge renamed util::PATH to util::path(), three call sites in these signal tests kept the old name, and eleven jobs went red on cannot find value PATH in this scope. Fixed and squashed back into the single commit — head is now 8981684ee.

cargo test --features env --test tests 'test_env::' → 101 passed, 0 failed. CI is re-running on the new head.

@RenjiSann
RenjiSann enabled auto-merge (rebase) October 21, 2026 11:49
@RenjiSann
RenjiSann merged commit eee5603 into uutils:main Oct 21, 2026
98 checks passed
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: --default-signal, --ignore-signal and --block-signal are applied in a fixed order, not in the order given

2 participants