uucore: support realtime signals (RTMIN/RTMAX) in signal_by_name_or_value

`signal_by_name_or_value()` only looked up signals from the static
ALL_SIGNALS array, which doesn't include realtime signals. This caused
`timeout -s RTMAX`, `kill -s RTMIN`, and `env --default-signal=RTMAX`
to reject valid signal names.

Extend the function to fall back to realtime_signal_bounds() for both
name lookups and numeric values in the realtime range, matching the
behavior already present in signal_list_value_by_name_or_number().

Also fix timeout's report_if_verbose() to use signal_list_name_by_value
instead of signal_name_by_value, so verbose output doesn't panic for
realtime signal numbers.

Fixes GNU test: tests/env/env-signal-handler.sh

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Kevin Burke
2026-03-31 14:48:50 +02:00
committed by Daniel Hofstetter
co-authored by Claude Opus 4.6
parent f6451c7d20
commit 6e18efb218
4 changed files with 55 additions and 4 deletions
+18
View File
@@ -286,3 +286,21 @@ fn test_foreground_signal0_kill_after() {
.args(&["--foreground", "-s0", "-k.1", ".1", "sleep", "10"])
.fails_with_code(137);
}
#[test]
#[cfg(any(target_os = "linux", target_os = "android"))]
fn test_realtime_signal_names() {
// timeout should accept RTMIN and RTMAX as valid signal names
new_ucmd!()
.args(&["-v", "-s", "RTMAX", ".1", "sleep", "1"])
.fails()
.stderr_contains("sending signal RTMAX to command");
new_ucmd!()
.args(&["-v", "-s", "RTMIN", ".1", "sleep", "1"])
.fails()
.stderr_contains("sending signal RTMIN to command");
new_ucmd!()
.args(&["-v", "-s", "SIGRTMAX", ".1", "sleep", "1"])
.fails()
.stderr_contains("sending signal RTMAX to command");
}