Repository navigation
WIP: fix(trap): key transported entry-ignores by signal number at startup (#2193, lands #1124 pins) - #2198
Merged
Conversation
__RUBASH_TRAP_ORIG_IGN consumption (seed_startup_traps) keyed the trap-table rebuild and the hard-ignore checks on the payload's raw spelling, so a bare-number entry (38 — the only spelling a bionic hole has) or a short name (USR1) landed on a phantom trap-table key no lookup ever uses, and set/reset on the signal were not the GNU silent no-ops. Only rubash's own canonical full-name spelling survived the trip. GNU keys entry dispositions by number: original_signals[] is indexed by sig (trap.c:136-150), decode_signal (trap.c:236) resolves every operand spelling to the number, and set_signal returns silently for SIG_HARD_IGNORE (trap.c:852). Canonicalize the transported set through the signal table at the top of seed_startup_traps and store it back: numeric payloads land on their slot, name payloads resolve through SIGNALS to the same slot, dual spellings of one signal collapse, and entries naming no signal in this platform's table (plus the EXIT/DEBUG/ERR/RETURN pseudo-signals) drop. The rebuild, is_hard_ignored, print_traps and the child-boundary re-export all read the one canonical set afterwards. The live SIG_IGN path is untouched — verified byte-identical to GNU 5.3.20 with a preexec SIG_IGN probe. Lands the five held-out issue1124 pins (tests/issue1124_trap_entry_ignore_regressions.rs) with the fix: pins 1-3 assert the number-keyed reconstruction with the platform listing spelling (bionic: bare 38; glibc/Windows wire: SIGRTMIN+4), pins 1-4 are gated to the Linux-numbering platforms (the BSD table has no signals 32/38), pin 5 stays as authored, and a short-name transport pin covers the USR1 leg. Refs #2193 Refs #1124
This was referenced Oct 30, 2026
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.
Refs #2193
Refs #1124
Defect
Startup consumption of the
__RUBASH_TRAP_ORIG_IGNtransport keyed the trap-table rebuild and the entry-ignore bookkeeping on the payload's raw spelling. Every other part of the shell keys signals by the canonical form derived from the signal number (normalize_signal,entry_ignored_key,canonical_trap_order), so:__RUBASH_TRAP_ORIG_IGN=38rebuilt a phantom__RUBASH_TRAP_38entry that no lookup ever finds on tables where slot 38 is named —trap -p 38andtrap -pprinted nothing, andtrap 'echo X' 38was not the GNU silent no-op (it installed the trap).__RUBASH_TRAP_ORIG_IGN=USR1was dropped the same way (USR1vs the canonicalSIGUSR1).SIGRTMIN+4) survived, because writer and reader accidentally agreed on it.The bare number is exactly the payload a bionic/Termux parent must write for a hole signal (32..40 have no name to spell), and the short name is what a foreign parent may write — the chain broke precisely on the spellings it exists to carry. The LIVE path (real SIG_IGN at entry) already matches GNU byte-for-byte and is untouched.
GNU model: entry dispositions are
original_signals[]indexed by signal number (trap.c:136-150);decode_signal(trap.c:236) resolves every spelling to the number;set_signalreturns silently for SIG_HARD_IGNORE (trap.c:852).Fix
canonicalize_orig_ignored_signalsruns at the top ofseed_startup_traps(the single startup consumption point, reached fromExecutor::newand the ENOEXEC fresh-shell path): each transported entry is mapped throughnormalize_signal— numeric payloads land on their slot, name payloads resolve throughSIGNALSto the same slot — and the result is stored back viastore_orig_ignored_signals(sort/dedup collapses dual spellings of one signal). Entries naming no signal in this platform's table, and the EXIT/DEBUG/ERR/RETURN pseudo-signals, are dropped. After that, the rebuild loop,is_hard_ignored,print_traps, and the child-boundary re-export (transport_inherited_ignores) all read one canonical, number-keyed set. No per-spelling exception list.Pins
Lands the five held-out #1124 pins (
tests/issue1124_trap_entry_ignore_regressions.rs, from~/workspace/pin-backfill-batch/issue1124_pins_held_out.rs) plus one #2193 short-name pin:trap -- '' 38(nameless hole), glibc and the Windows wire table listtrap -- '' SIGRTMIN+4(live-path spelling verified against GNU 5.3.20 on glibc) — via a cfg'dSIGNAL_38_LISTINGconstant.linux / android / windows(the platforms whose tables contain signals 32/38; the BSD table has 31 entries). Pin 4 stays meaningful there (a non-ignored hole lists nothing); pin 5 is as authored (vacuous on clean-mask hosts, real on the Termux launcher shape).USR1:SIGUSR1dual-spelling payload lists exactly once as SIGUSR1 and refuses a set silently.Local verification (targeted; full gate via this PR's CI)
cargo test --lib builtins::trap16/16 (3 new unit tests),--lib builtins::kill22/22.trapsubset 11/11.