Skip to content

uucore: handle SIGRTMIN+N and SIGRTMAX-N notation#12149

Open
enr0n wants to merge 4 commits into
uutils:mainfrom
enr0n:rt-signal-notation
Open

uucore: handle SIGRTMIN+N and SIGRTMAX-N notation#12149
enr0n wants to merge 4 commits into
uutils:mainfrom
enr0n:rt-signal-notation

Conversation

@enr0n

@enr0n enr0n commented May 4, 2026

Copy link
Copy Markdown

On Linux, signals in the range SIGRTMIN..SIGRTMAX are valid in addition to SIGRTMIN and SIGRTMAX themselves. The notation SIGRTMIN+N and SIGRTMAX-N is used to reference signals in that range.

Adapt signal helpers to understand this.

Fixes: #11151

@github-actions

github-actions Bot commented May 5, 2026

Copy link
Copy Markdown

GNU testsuite comparison:

Skip an intermittent issue tests/date/date-locale-hour (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/tail/inotify-dir-recreate (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/date/resolution (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/tail/symlink (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/rm/many-dir-entries-vs-OOM is now passing!

@sylvestre

Copy link
Copy Markdown
Contributor

some jobs are failing

@enr0n enr0n force-pushed the rt-signal-notation branch from ff4ee52 to 5aeaabe Compare May 5, 2026 12:08
@enr0n

enr0n commented May 5, 2026

Copy link
Copy Markdown
Author

This is actually not enough to fix #11151 yet. The parsing is fixed, but the signals are not actually blocked, because nix::sys::signal does not understand real-time signals.

@enr0n enr0n force-pushed the rt-signal-notation branch 2 times, most recently from 9bbd658 to c938b58 Compare May 5, 2026 16:50
@enr0n

enr0n commented May 5, 2026

Copy link
Copy Markdown
Author

With the two additional commits, env and kill should both properly support real-time signals.

@enr0n enr0n force-pushed the rt-signal-notation branch 4 times, most recently from 9f8b1f2 to 3af4e8c Compare May 7, 2026 07:45
@enr0n

enr0n commented May 7, 2026

Copy link
Copy Markdown
Author

I think the remaining CI failure is unrelated.

@enr0n enr0n force-pushed the rt-signal-notation branch 2 times, most recently from de761af to cad60c0 Compare May 8, 2026 18:12
Comment thread src/uu/env/src/env.rs Outdated
}
}

#[cfg(unix)]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please move it back where it was. it decreases the diff size

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Comment thread src/uu/env/src/env.rs Outdated
fn block_signal(sig: usize) -> UResult<()> {
// nix::sys::signal::Signal does not cover real time signals, so we need to build
// sigset_t manually using libc.
let set = unsafe {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you do that in a function ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, done.

@enr0n enr0n force-pushed the rt-signal-notation branch from cad60c0 to 023badf Compare May 20, 2026 15:55
@codspeed-hq

codspeed-hq Bot commented May 20, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 323 untouched benchmarks
⏩ 46 skipped benchmarks1


Comparing enr0n:rt-signal-notation (4721a03) with main (542e7af)

Open in CodSpeed

Footnotes

  1. 46 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@enr0n enr0n force-pushed the rt-signal-notation branch from 023badf to 75dc2e8 Compare June 8, 2026 16:17
@enr0n

enr0n commented Jun 8, 2026

Copy link
Copy Markdown
Author

I dropped the kill changes because that appears to be fixed by #12326, but I kept the new tests.

@enr0n enr0n force-pushed the rt-signal-notation branch from 75dc2e8 to 198ae14 Compare June 9, 2026 13:14
@enr0n

enr0n commented Jun 9, 2026

Copy link
Copy Markdown
Author

@sylvestre The remaining CI failures look unrelated. Can you please take another look?

@enr0n enr0n requested a review from sylvestre June 9, 2026 15:47
enr0n added 4 commits June 10, 2026 17:06
On Linux, signals in the range SIGRTMIN..SIGRTMAX are valid in addition
to SIGRTMIN and SIGRTMAX themselves. The notation SIGRTMIN+N and
SIGRTMAX-N is used to reference signals in that range.

Adapt signal helpers to understand this.
The nix::sys::signal::Signal enum type does not cover real-time signals.
In the current env code, this means that trying to block e.g. SIGRTMIN+7
is silently ignored, apply_signal_action() silently drops signals that
cannot be represented as that enum.

However, the enum cannot simply be extended to represent the real-time
signals, because SIGRTMIN and SIGRTMAX cannot be considered constants.

To workaround this, do not use the Signal enum type, and use libc where
needed instead of the wrappers.

Fixes: uutils#11151
@enr0n enr0n force-pushed the rt-signal-notation branch from 198ae14 to 4721a03 Compare June 10, 2026 21:06
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: signal flags do not understand RTMIN+n

2 participants