Skip to content

fix: master CI red (macOS kill tests, trap-signal-matrix golden) - #1711

Merged
caomengxuan666 merged 3 commits into
masterfrom
fix-ci-code
Oct 26, 2026
Merged

caomengxuan666 merged 3 commits into
masterfrom
fix-ci-code

Conversation

@arookieofc

@arookieofc arookieofc commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Fixes two of the three red jobs on master (38062f5), each with a distinct root cause.

1. Rust tests (macOS): kill sigspec tests hardcoded Linux SIGUSR1

posix_sigspec_tests::mixed_case_prefixed_names_translate and mixed_case_prefixed_specs_decode expected sigusr1 -> 10. The SIGNALS table itself is cfg-gated per platform (USR1 is 10 on Linux/Android, 30 on macOS/FreeBSD), so the implementation was right and the tests were wrong. Both expectations now follow libc::SIGUSR1.

2. GNU goldens: trap-signal-matrix (async-child trap regression)

A compound background body ({ trap ... INT; sleep 2; } &) could no longer trap INT/QUIT. The #1035 async-child entry ignore (SIG_IGN at spawn, mimicking GNU setup_async_signals) was folded by seed_startup_traps into ORIG_IGN, making set_trap a silent no-op (SIG_HARD_IGNORE) — defeating the spawn site's own design ("compound bodies stay trappable; only the kernel ignore, which a later trap overrides"). GNU's forked async child lists trap -- '' SIGINT yet still lets a later trap override it (trap.c ASYNCSIG special-case).

Fix: apply_async_child_entry_ignores records an async-child marker; the entry fold skips INT/QUIT for async children (exec-like bodies still arrive hard via the ORIG_IGN transport, so background_script_cannot_trap_entry_ignored_int still passes); seed_startup_traps then seeds plain empty entries for async INT/QUIT after the ORIG_IGN-promoting loop, so trap -p keeps listing them without making them hard.

Verification (local, Linux)

  • golden_trap_signal_matrix: pass; issue1035_1036 file: 9/9 (incl. the exec-body refusal).
  • cargo test --lib: 771 passed + 1 pre-existing baseline failure (ownership_unary_operators_check_existing_file, fails on clean master too).

Not in this PR

  • The cross-target job (signal-hook's C shim needs zig for darwin + NDK r27 for Android; both verified locally) lives on branch fix-ci-master-red and cannot be pushed with the current gh token, which lacks the workflow scope — pushing any ref that touches .github/workflows/ci.yml is rejected. It will follow once the token is refreshed with that scope.
  • The remaining 23 Windows golden failures need Windows-side diagnosis (signatures: missing externals under the harness's airtight System32-only PATH, Windows socket error wording vs the WSL-GNU recordings, WSL-with-no-distro output, plus elided diffs). Deliberately not guessed at here.

Follow-up fix (8aad5fe): Windows compile break in the kill tests

The first version used libc::SIGUSR1 in the two posix_sigspec tests. The test module also compiles on Windows, where libc is a unix-only dependency, so the goldens job (which runs cargo test --lib first) failed with E0433 before any golden ran. Replaced with cfg-selected literals: 30 on macOS/FreeBSD, 10 elsewhere (the not(unix) SIGNALS table speaks Linux numbering and carries USR1 as 10).

Two of the three red jobs on master, both verified locally:

1. Rust tests (macOS): posix_sigspec_tests hardcoded the Linux
   SIGUSR1 number (10) in mixed_case_prefixed_names_translate and
   mixed_case_prefixed_specs_decode. The SIGNALS table itself is
   cfg-gated per platform (USR1 is 10 on Linux/Android, 30 on
   macOS/FreeBSD), so the implementation was right and the tests
   were wrong. Both expectations now follow libc::SIGUSR1.

2. GNU regression goldens (trap-signal-matrix): a compound
   background body ({ trap ... INT; sleep 2; } &) could no longer
   trap INT/QUIT. The #1035 async-child entry ignore (SIG_IGN at
   spawn, mimicking GNU setup_async_signals) was folded by
   seed_startup_traps into ORIG_IGN, making set_trap a silent
   no-op (SIG_HARD_IGNORE) — defeating the spawn site's own design
   ("compound bodies stay trappable; only the kernel ignore, which
   a later trap overrides"). GNU's forked async child lists
   `trap -- '' SIGINT` yet still lets a later trap override it
   (trap.c ASYNCSIG special-case). Fix: apply_async_child_entry_ignores
   records an async-child marker; the entry fold skips INT/QUIT
   for async children (exec-like bodies still arrive hard via the
   ORIG_IGN transport, so background_script_cannot_trap_entry_ignored_int
   still passes); seed_startup_traps then seeds plain empty entries
   for async INT/QUIT after the ORIG_IGN-promoting loop, so
   `trap -p` keeps listing them without making them hard.

Verification: golden_trap_signal_matrix passes; the whole
issue1035_1036 file passes (9/9, incl. the exec-body refusal);
cargo test --lib is 771 passed + the 1 pre-existing baseline
failure (ownership_unary_operators_check_existing_file, fails on
clean master too).
The two posix_sigspec_tests used libc::SIGUSR1 to follow the
platform USR1 number (10 on Linux/Android, 30 on macOS/FreeBSD).
The test module also compiles on Windows, where libc is a unix-only
dependency, so the goldens job (which runs cargo test --lib first)
failed to compile on windows-latest with E0433 before any golden
ran. Replace both uses with cfg-selected literals: macOS/FreeBSD
30, everything else 10 (the not(unix) SIGNALS table speaks Linux
numbering by design and carries USR1 as 10).
@caomengxuan666

Copy link
Copy Markdown
Member

Verification complete on two master baselines (7fafd23 and fafdd35 + this PR):

  • posix_sigspec targeted: 7/7; issue1035_1036: 9/9 (including the exec-body hard-refusal pin); golden_trap_signal_matrix: PASS with the PR, deterministic FAIL on clean fafdd35 — the discriminating pair holds, and the golden matches the GNU bash 5.3.20 oracle output byte-for-byte.
  • lib full suite: 771 passed / 1 failed (ownership_unary_operators_check_existing_file only — the known pristine baseline failure) / 1 ignored on both baselines.
  • diffcorpus 306 failure set identical to baseline ({ms10} + ps06 timing flake).
  • SIGUSR values byte-checked against the oracle (USR1=10 / USR2=12, untrapped suicide rc=138); the PR binary reproduces them end to end.
  • On this PR's own CI the macOS Rust-tests job is green; the two remaining red jobs are pre-existing master failures outside this PR's scope.
  • Cross-check against the in-house sig-trap cluster work: no overlapping hunks, no semantic conflict on the trap/signal surface.

One blocking nit, in code this PR itself adds: src/builtins/kill.rs — the ASYNC_CHILD_ENTRY static is split across two lines where rustfmt joins it into one (exactly 100 chars), one new fmt hunk (the file's other two hunks are pre-existing master drift, not yours). I'm pushing that single-line join as a fixup commit to this branch and merging; everything else needs no re-verification beyond a rustfmt --check on kill.rs. Thanks — this takes master's last functional CI red off the board.

Fixup on top of the PR's own hunk only; the two remaining rustfmt
diffs in this file are pre-existing master drift.
@caomengxuan666
caomengxuan666 merged commit e796e40 into master Oct 26, 2026
9 checks passed
@caomengxuan666
caomengxuan666 deleted the fix-ci-code branch October 30, 2026 01:41
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.

2 participants