Skip to content

Fix master CI: cross-target darwin checks + goldens job (windows lane) - #1771

Merged
caomengxuan666 merged 5 commits into
masterfrom
fix/master-ci-goldens-crosstarget
Oct 26, 2026
Merged

caomengxuan666 merged 5 commits into
masterfrom
fix/master-ci-goldens-crosstarget

Conversation

@caomengxuan666

@caomengxuan666 caomengxuan666 commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

What this PR does

Fixes the two master-CI jobs in this line's scope: GNU regression goldens and canaries and the cross-target checks. (The macOS Rust-tests job and everything around kill.rs / the trap-signal-matrix golden belong to PR #1711 and are untouched here.)

Full analysis: turn-red points, per-failure root causes for all 24 golden failures at master tip 160e7928, and the snapshot evidence trail are in the line report (~/workspace/rubash-ci-fix/REPORT.md, held by the main session).

Cross-target

The old Cross-target check (linux/darwin/android) job had three stacked failure shapes:

  1. darwin: signal-hook's build script (cc gained via 333cbd66) invokes cc with clang flags on an ubuntu runner. Pinning clang on Linux was tried first and falsified by CI (no macOS SDK → host glibc headers). Fix: the darwin steps move to a new Cross-target check (darwin) job on macos-latest; the ubuntu job becomes Cross-target check (linux/android). ⚠️ The check-name set changes — branch protection keyed on the old name needs updating at merge time.
  2. android (latent behind darwin): cc-rs looks for the NDK compilers, which are not on PATH. Fix: a ci.yml step locates the runner's NDK ($ANDROID_NDK_HOME/.../llvm/prebuilt) and exports CC/CXX/AR for both android targets, failing loudly if the NDK disappears.
  3. android (latent behind Track GNU Bash upstream test progress in CI #2): src/executor/external_inner.rs compared st_mode (u32) against bionic's S_IFMT (u16). Fix: widen both sides through u32::from(...), matching the existing idiom in src/fd/unix.rs. Semantics unchanged.

Goldens (24 failures at master tip → 0)

Root causes, in short (details + per-test table in the report):

Verification (round 4, run 40288440970)

  • Cross-target check (darwin) ✅ · Cross-target check (linux/android) ✅ · GNU regression goldens and canaries ✅ (lib 851 passed; regression 120 passed / 0 failed)
  • Rust tests (macOS) still fails with exactly the two known fix: master CI red (macOS kill tests, trap-signal-matrix golden) #1711 kill tests (mixed_case_prefixed_names_translate, mixed_case_prefixed_specs_decode) — untouched by this branch.
  • Note: golden_trap_signal_matrix failed at master tip but passed in this PR's rounds 2 and 4. This branch contains zero trap/kill changes, so the pass is not attributable here — it looks environment/order-sensitive; flagging for fix: master CI red (macOS kill tests, trap-signal-matrix golden) #1711's verifier rather than claiming it.

Please do not merge until the main session has reviewed the CI results and the check-name change.

The cross-target job cross-compiles aarch64-apple-darwin from an
ubuntu host. cc-rs passes clang-style flags (-arch arm64,
-mmacosx-version-min) to the resolved C compiler; on the runner that
is gcc, which rejects them, so the job dies inside signal-hook's
build script (failed to run custom build command for signal-hook
v0.3.18) before any darwin code is checked. signal-hook only gained
its cc-based build step when cc 1.9.0 entered Cargo.lock (333cbd6),
which is why this failure shape replaced the earlier E0425 one.

Pin CC/CXX/AR for the darwin target to the runner's clang toolchain
(both dashed and underscored spellings; cc-rs accepts either) on the
two darwin steps only. No other job changes.
…o a macOS runner

Cross-target: the clang-pin attempt proved on this PR's first CI run
that a Linux host cannot service a darwin C build at all — with CC
pointed at clang, signal-hook's extract.c compile falls back to the
host glibc headers and dies in bits/wordsize.h (no macOS SDK). The
darwin steps therefore move to a macos-latest job (Cross-target check
(darwin)), where cc is clang with the SDK by construction; the ubuntu
job keeps the linux/android checks and is renamed accordingly.

Goldens (windows lane), three harness-level root causes:

1. Poison cascade: HEAVY_TEST_LOCK was taken with .lock().unwrap(),
   so one panicking heavy test (trap-signal-matrix) manufactured
   PoisonError failures in seven unrelated tests. The lock guards no
   data, only mutual exclusion; acquire it poison-tolerantly via a
   new heavy_lock() helper.

2. Tool absence: the GNU captures were made with real coreutils on
   PATH, but the harness minimal PATH is System32-only and, since the
   emulated-external stand-down (rubash#1545), emulated coreutils run
   only when their name resolves — head/wc/mkdir/grep resolve nowhere
   in System32, so a dozen fixtures lost their tools. Append Git for
   Windows' usr/bin (part of the standard runner image, real
   coreutils) to minimal_path() when present; System32 keeps
   precedence and the path degrades gracefully without Git.

3. Three goldens pin bytes a Windows lane cannot produce:
   issue1227-argv0 (needs /bin/dash, a real sh and bash; the lane's
   bash is the WSL launcher stub), issue1338-bash-argv0 (the child
   must be a real bash; the stub prints its no-distro banner), and
   issue1237-net-redir (glibc strerror/gai_strerror wording and
   service-name resolution baked into the pinned stderr). Gate the
   three to non-Windows with the reason recorded at each site;
   coverage continues on non-Windows runs.

Product fix (rubash#1212, Windows half): rusage_counters() returned
zeros on every non-unix platform, so 'time' always reported
user/sys 0m0.000s on Windows. Implement the SELF half of GNU's
SELF+CHILDREN sum via GetProcessTimes — that is where rubash's
no-fork subshell/builtin CPU lands; children accumulation is
documented as still open in the code comment.
The android steps were the third latent head of the same failure:
they only ever ran in CI when the darwin step ahead of them passed,
and since cc entered Cargo.lock (333cbd6) signal-hook's build script
compiles C for the android targets too, with cc-rs looking for
aarch64-linux-android-clang, which is not on PATH. Resolve the
API-suffixed compiler names from the NDK that ships with the runner
image and export CC/CXX/AR for both android targets (dashed and
underscored spellings); the step fails loudly if an image ever stops
shipping an NDK.
Bytes are the CI record-leg output (run 40286708672 artifact). Per
the re-record protocol, the change that shifted each slice:

- case: harness world, not engine. case3.sub renders its headers
  through od/awk; the 2026-09-27 recording was made where those
  tools produced nothing, fusing the header with the ok-run. With
  real coreutils on the harness PATH (this PR), the slice now
  prints soh/stx/del exactly as GNU's case.right:43/51/59 requires.
- errors: engine fixes from the 2026-10-24/25 parity waves. The
  subshell after a readonly assignment error now terminates
  (errors.right has no 'after assignment error' lines; the old
  recording printed them), and the break/continue/return status
  lines now surface with status 2 (errors.right:274-304; the old
  recording lacked them).
- exp: the carrier-byte/control-character expansion fixes (e.g.
  be6c9cb, rubash#1261: prefix/suffix removal counts carried
  bytes as one character). Control characters now survive into
  recho output and declare rendering exactly where exp.right has
  them (exp.right:48 'argv[2] = <b>', exp.right:250 the
  var=x\001y\177z line); the old recording dropped those lines.
- redir: redirection diagnostics gained the GNU 'Bad file' wording
  in the fd/redirection wave (rubash#1592/#1594 family), so
  redir11.sub's grep -q 'Bad file' now matches on all nine shapes
  and the 'redir11 bad N' markers are gone (redir.right has none);
  the bix function's 'echo foo | cat' call now delivers its 'foo'
  line, as in redir.right.

Every delta was checked against the slice's GNU .right file before
re-recording: in all four slices the new bytes move TOWARD the GNU
expectation, none pins a divergence.
The android cross check (unblocked by the NDK cc-rs step) reached
the lib and failed at fd_is_anonymous_pipe: bionic types the S_IF*
constants as u16 while stat.st_mode is u32, so the raw comparison
is a type error there. Use the same u32::from widening the sibling
checks in src/fd/unix.rs already use.
@caomengxuan666
caomengxuan666 merged commit fafdd35 into master Oct 26, 2026
8 of 9 checks passed
caomengxuan666 added a commit that referenced this pull request Oct 26, 2026
…half (rubash#1776)

PR #1771 gave Windows time the SELF half (GetProcessTimes on the
current process); GNU reports SELF+CHILDREN, so time over a CPU
burning external command still read low. Windows has no
getrusage(RUSAGE_CHILDREN), so each child's times are now sampled
from its process handle at the reap point — foreground wait
(including the signal-abort reap), pipeline members (including
the lingerer kill), capture-pipeline members, background-job
observation and explicit wait — into a process-wide accumulator
deduped by (pid, creation time), which rusage_counters adds to
SELF. Known bounds: a capture pipeline's last member is consumed
by wait_with_output before any sample point (its CPU stays
uncounted), and sessions sharing a process share the sum (a
per-Session split rides the 1.5.0 state-view work).
@caomengxuan666
caomengxuan666 deleted the fix/master-ci-goldens-crosstarget 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.

1 participant