Repository navigation
fix(signals): realtime entries in trap/kill lists + async entry-ignore - #1094
Merged
Merged
Conversation
…rubash#1036, rubash#1035)
GNU ownership:
- support/signames.c:92-139 initialize_signames (RT arithmetic names
SIGRTMIN..SIGRTMIN+x / SIGRTMAX-x..SIGRTMAX from the TARGET's
SIGRTMIN/SIGRTMAX)
- trap.c:236 decode_signal (numeric < NSIG valid, RTMIN+N dynamic forms)
- trap.c:845-852 set_signal ("A signal ignored on entry to the shell
cannot be trapped or reset, but no error is reported", SIG_HARD_IGNORE)
- trap.c:954-956 restore_default_signal, trap.c:1002-1004 ignore_signal
(same hard-ignore refusal)
- builtins/trap.def:294-320 showtrap/display_traps (hard-ignored signals
list as `trap -- '' SIGxxx`)
- execute_cmd.c:5709 setup_async_signals (async children ignore
SIGINT/SIGQUIT while job_control == 0)
- execute_cmd.c:6126 shell_execve (ENOEXEC -> in-process shell-script
fallback, never /bin/sh)
- jobs.c background ignore inheritance for `&` children
on the Termux oracle; bash 5.3.20 lists `41) SIGRTMIN`..`64) SIGRTMAX`,
55 entries), not glibc's 34..64 and not empty. The android trap/kill
tables carried no RT names (kill -l 41 silent, RTMIN invalid). Fill both
tables with the signames.c arithmetic split (41..52 RTMIN..RTMIN+11,
53..64 RTMAX-11..RTMAX, 32..40 holes) and pin the base against
`__libc_current_sigrtmin/max` in unit tests. `trap -l`/`kill -l` output
is now byte-identical to the oracle.
`trap ... INT` installed and fired. Model setup_async_signals:
direct-external bg spawns force SIGINT/SIGQUIT to SIG_IGN in pre_exec
when `monitor` is off; wrapper respawns stamp an async marker the child
consumes at startup (before trap seed + ENTRY_IGNORED capture), and
exec-like bodies (bare simple commands GNU would exec) additionally
merge INT/QUIT into the forwarded ORIG_IGN set so the trap is silently
refused and `trap -p` shows `trap -- '' SIGINT`. Compound bodies stay
trappable (trap.c ASYNCSIG special-case), as do `set -m` children.
Also found while reproducing: foreground/background dispatch of scripts
without `#!` went through libc's posix_spawn /bin/sh fallback (no
`trap -p`, wrong traps); such files now take the ENOEXEC shell-script
fallback exactly like GNU (synthetic ENOEXEC into exec_format_refusal;
direct gate declines them to the wrapper).
Verification: repro scripts byte-compared against bash 5.3.20 (script
files): trap -l/kill -l identical; issue parent (bg INT trap) identical
(refused, `trap -- '' SIGINT`, SURVIVED, wait 0); compound-bg handler
still fires; monitor-mode handler fires; parent `trap '' INT`
propagates. cargo test --lib green (695 + 2 new RT tests); new
tests/issue1035_1036_signal_table_regressions.rs green (11);
executor_tests green except 7 pre-existing Termux env failures (also
red on clean tree); issue866 w1 red on clean tree too (android lacks
PR_SET_PDEATHSIG).
Known approximation: `trap - INT` on a never-trapped async INT resets
to ignored rather than POSIX-751 DFL (the reset-request signal is not
tracked); flagged in code review, unobservable in the issue scope.
caomengxuan666
force-pushed
the
fix/signal-table
branch
from
October 23, 2026 01:26
84e6fc4 to
ff2427b
Compare
Member
Author
|
Rebased onto post-#1181 master and force-pushed as |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1036, closes #1035. (1) trap -l/kill -l now cover RTMIN..RTMAX with RTMIN<->41 mapping (GNU signal tables); kill -l 65 still errors. (2) async-job respawns start with SIGINT/SIGQUIT ignored (GNU execute_cmd.c setup_async_signals), consumed from the spawn-site marker before trap-table seeding; trap -p shows the ignore and handlers can't override it. Tests: lib 695 + 11 new regression + RT/kill/trap subsets + fd_redirects green, executor_tests delta-free vs clean tree; GNU parity byte-identical on both issues (one fd_redirects expectation updated to the GNU shape, oracle-confirmed).