Skip to content

WIP: sig-trap re-adjudication pin fixes — 2 wrong pins + 8 echo artifacts (tests-only) - #1813

Merged
caomengxuan666 merged 2 commits into
masterfrom
fix7/sigtrap-pinfix
Oct 27, 2026
Merged

caomengxuan666 merged 2 commits into
masterfrom
fix7/sigtrap-pinfix

Conversation

@caomengxuan666

@caomengxuan666 caomengxuan666 commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

WIP: sig-trap gate re-adjudication pin fixes (tests-only)

Refs #1630, #1631, #1639, #1640, #1654, #1811 — plain references only; nothing here closes an issue.

What this is

The sig-trap final gate left one unadjudicated result line (39 passed; 1 failed). The read-only re-adjudication (GATE-READJUDICATION.md, cluster record) proved that line was a truncated splice of the lib baseline row — and that the six targeted files actually run 23 passed / 11 failed on master, deterministically, with the identical failure set on the merged slice tree (no regression from the merge; the files are never run by CI and the slice's own PTY verification starved in the build-slot queue). The 11 failures adjudicate as: 2 wrong pins, 8 test-construction artifacts, 1 real product divergence.

Baseline re-confirmed on this branch's base 6290f08c before editing: 23 passed / 11 failed, failure names identical to the adjudication, character for character.

Changes (tests only, src/ untouched)

Commit 1 — the two wrong pins (product already matches GNU; the expectations were wrong):

  • issue1631_dash_s_after_bare_spec_still_selects_signal: asserted stderr.is_empty(). GNU bash 5.3.20 prints the job death notice on stderr on every run of this shape. The pin now asserts the GNU notice shape (signal name + job command; the notice's line attribution wobbles between the kill and wait lines, so the line number is deliberately not pinned) and that kill itself emitted no badpid diagnostic.
  • issue1654_plain_self_kill_control_unchanged: asserted code == Some(143). At process level both GNU and rubash die by SIGTERM itself (returncode −15); Rust code() is None for a signal death. 143 is the shell-layer wait status, not a process exit code. The pin now expects None. The deferred-death shapes in the same file do synthesize Some(143) and keep their pins.

Commit 2 — the eight harness artifacts: both PTY files' shared ctrl_c_discards helper asserted !transcript.contains(marker), but the PTY echoes the typed line and every marker is part of that line's text — the assertion was false for any product behavior, while the transcripts prove the discards work. The helper now verifies the typed line's echo is present, strips its first occurrence, and asserts the markers are absent from the remaining output side (a marker that actually ran would print a second time and still be caught; a missing echo fails loudly). Covers the 5 discard shapes in the 1639_1640 file and the 3 in the read_loop_eval file.

Deliberately untouched

issue1639_trapped_int_runs_trap_and_continues_line — the one real product divergence (a trapped SIGINT still discards the rest of the line instead of continuing it). It is filed as #1811; this pin is its regression seed and stays red until that fix lands. It is the only expected failure after this PR.

Verification (all runs through the single build slot, .done markers + logs on file)

  • Baseline on this branch's base 6290f08c, six files --no-fail-fast: 23 passed / 11 failed, failure names identical to the adjudication's 11, character for character.
  • After the re-pins (head 48c3086e), six files --no-fail-fast ×2: 33 passed / 1 failed both runs, failure sets identical across runs; the only failure is issue1639_trapped_int_runs_trap_and_continues_line — the [executor] Trapped SIGINT at a wait point discards the rest of the line instead of continuing (#1639 residual shape) #1811 seed, failing with the adjudicated product shape (trap runs, rest of line discarded). Per file: 1631 4/4 green, 1654 7/7 green, read_loop_eval 3/3 green, 1639_1640 6/7 (seed only).
  • Lib re-check: 771 passed / 1 failed / 1 ignored, the one failure being the baseline-permitted ownership_unary_operators_check_existing_file — baseline shape unchanged.
  • Diff discipline: 4 test files only (+62/−4), src/ untouched, the trapped pin does not appear in the diff at all; rustfmt per-file clean; CR count 0.

…ADJUDICATION A1/A2)

issue1631_dash_s_after_bare_spec_still_selects_signal asserted
stderr.is_empty(), but GNU bash 5.3.20 prints the job death notice
on stderr on every run of this shape (oracle, both script forms,
10/10 runs); the pin now asserts the GNU notice shape (signal
name + job command — the notice's line attribution wobbles
between the kill and wait lines, so the line number is
deliberately not pinned) and that kill itself emitted no badpid
diagnostic. kill_rc=0 / wait_rc=138 assertions unchanged.

issue1654_plain_self_kill_control_unchanged asserted
code == Some(143), but at process level both GNU and rubash die
BY SIGTERM itself (returncode -15 under the same probe) and
Rust's ExitStatus::code() is None for a signal death; 143 is the
shell-layer wait status (128+15), not a process exit code. The
pin now expects None. The deferred-death shapes in the same file
do synthesize Some(143) and keep their pins.

Tests-only; no product change. Refs #1631, #1654.
…-READJUDICATION B)

ctrl_c_discards asserted !transcript.contains(marker), but the
PTY necessarily echoes the typed line and every forbidden marker
is part of that line's text, so the assertion was false for ANY
product behavior — while every transcript proves the discards
themselves work (line dropped, NEXT_130, marker never printed as
output). The helper now verifies the typed line's echo is
present in the transcript, strips its first occurrence, and
asserts the markers are absent from the remaining output side:
a marker that actually ran would print a second time and still
be caught, and a missing echo fails loudly instead of passing
on an unstripped transcript.

Covers the 5 discard shapes in issue1639_1640 (builtin sleep,
external sleep, function frame, subshell frame, or-list rhs)
and the 3 in issue1639_read_loop_eval (read, loop, eval).
The trapped-INT pin (issue1639_trapped_int_runs_trap_and_
continues_line) is untouched: it stays red as the regression
seed for #1811.

Tests-only; no product change. Refs #1639, #1640, #1811.
@caomengxuan666
caomengxuan666 marked this pull request as ready for review October 27, 2026 03:06
@caomengxuan666
caomengxuan666 merged commit a9385b4 into master Oct 27, 2026
10 of 11 checks passed
SpookyWaste pushed a commit to SpookyWaste/rubash that referenced this pull request Oct 29, 2026
…ler pin (unixwin#1824)

Regression introduced by PR unixwin#1809 (commit 5c3abde, merged as
5275dde): pinning an interactive shell's untrapped SIGINT to the
mailbox handler at every command boundary (GNU sig.c:315-316
initialize_terminating_signals — an interactive shell catches
SIGINT itself from startup) invalidated the foreground guards'
arming predicate, which read "a handler is installed" as "the trap
path owns the delivery". With untrapped SIGINT sitting at the
handler from the boundary on, the guards never armed during
in-process blocking waits, so the delivery queued in the mailbox
with no consumer: inside a subshell frame the builtin sleep slept
through the ^C (observe_signals_while_blocked is frame-guarded,
and take_sigint_abort is armed-gated), and a blocked `read` ate
the next input line as its own input while the stranded delivery
discarded the rest of the unit at the next boundary.

Bisect over the four-merge interval: both unixwin#1639 pins green at
a9385b4 (unixwin#1813) and 44ee0ae (unixwin#1815), red at 5275dde (unixwin#1809);
pin texts byte-identical across the whole interval, pins unedited.

Fix the invariant at the shared predicate
(foreground_sigint_needs_protection): protection is needed when
SIGINT is UNTRAPPED — the trap table decides ownership — and the
kernel disposition is one of the two untrapped steady states,
SIG_DFL or our mailbox handler. A trapped SIGINT keeps the trap
path (the guard must not steal its delivery); an entry-ignored
SIGINT stays at SIG_IGN and untouched.

The hold/release pair becomes symmetric: hold_fg_sigint records
the steady state it found (first holder wins) and release_fg_sigint
restores it, so a wait that began under the pin leaves SIGINT at
the Handler instead of flipping it to Default until the next
boundary reconcile re-pins it.

GNU references: sig.c:315-316 (interactive SIGINT catch),
jobs.c:3086-3102 (wait_for records deliveries during a wait),
jobs.c:3315-3316 (ADDINTERRUPT discard classification).
@caomengxuan666
caomengxuan666 deleted the fix7/sigtrap-pinfix branch October 30, 2026 01:42
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.

1 participant