Repository navigation
test(infra): #767 single helper implementation + #746 fixed-issue catalogue wave + #812 space-free THIS_SH pin - #820
Conversation
… sides, parity-gated
scripts/true-baseline.sh staged two helper implementations into $BASE: the
gcc ELF from third_party/bash/support/{recho,zecho}.c for the oracle and an
independently-written Rust rendering (scripts/test-helpers/*.rs) for the
rubash side, and the old only-if-missing staging kept whichever PE a
previous tree had built. A helper-pair difference then lands in the ledger
as an engine diff (9 of the 21-22 differing suites depend on these helpers;
observed as U+FFFD vs raw-byte renderings of the same argv).
- recho.rs/zecho.rs are now required-byte-exact ports of support/*.c: argv
bytes are decoded from the Windows command line the way rubash writes it
(probed with an encode_wide dumper: every byte < 0x100 travels as U+00nn,
valid multi-byte sequences as their code points, lone DC80-DCFF as bytes),
rendering follows recho.c exactly (^X control mapping, DEL ^?, 0x80-0xFF
raw, first NUL ends the argument). Clean-room behavioural port: no GPL
source text is copied into the MIT tree.
- true-baseline.sh rebuilds BOTH carriers from source every run and runs a
helper-parity preflight before any ledger: each side's own shell builds a
fixed argv matrix (ASCII, control ^X/^?, DEL, raw 0x80-0xFF isolated
escapes, empty argv, multi-arg spacing/indexing) and the od dumps must be
identical, else exit 9. Valid multi-byte UTF-8 escape spellings are
report-only: they hit the engine's byte-reencoding family (#540 class,
printf '\xc3\xa9' lands on the wire as U+00E9), not the helper pair.
Rerun bidirectionally on 5.3.0 (oracle) x {debug,release} arms: 83/83
suites measured both directions through the green gate; the remaining
per-suite profile deltas (builtins/coproc/read) carry zero helper-rendered
bytes - all residual argv-line diffs are engine-side input differences the
unified helpers now render faithfully.
…sue wave, one line each The catalogue skeleton (scripts/regression-catalog, PR #774) predates the wave; this lands the ratchet's PROMOTE step and the first batch of fixed-issue rows, so every fixed issue of the wave carries one catalogue line (README wave table; pointer rows for the faces that live in harness/Rust-test territory per the Scope rule). Promoted to must-match after re-verification on the current arm (13 rows): 703, 733, 738, 742, 743, 744, 745, 753, 755, 758, 761, 761b, loc-l1 (#772). issue-756's row flips too after the case was trimmed to the fixed surface - the residual stderr wording stays with the #551 diagnostic family, where it belongs. New cases (7): issue-714 (read -n/-N decoded-unit limits, PR #775), 723 (pipeline while-read stall, PR #793), 726 (definition-level dup splice + exec group-order escape, PR #783), 776 (read -N keeps embedded newline), 788 (compound operand sets the array attribute, PR #786), 797 (sourced bash-preexec DEBUG-trap assembly keeps the shell executable), 798 (exit inside source terminates, subshell face so the completeness marker stays reachable). #799 is a pointer, not a case: r/R cannot coexist on NTFS and WSL DrvFs is itself case-insensitive, so no differential case is expressible - it stays pinned by tests/issue799_command_name_case_regressions.rs. #780 (startup flag) and #803 (runner CRLF copy predicate) are pointers for the same reason. Rows kept diverges carry refreshed notes naming the live follow-ups (#734, #754, #757, #759, #773, #772-residual, and the #794/#795/#796 post-merge triage on the 735/737 faces). Wiring with fast-path-differential.py (#706): both docstrings now state the contract - ids trace to issues on both sides, and a fast-path known- divergence that starts passing is promoted OUT of CASES into a must-match catalogue row; the lists never both carry a fixed face. Run: all 34 catalogued cases match their declared expectation (arm = current branch release build; gate ok).
…ite snapshots The errors slice's 'after exit:'/'after shift:' status lines (errors.snap:63-80) diverged across Windows hosts both directions while CI stayed green. Two stacked causes, one of them still live on master: 1. (already handled on master by 5892b6f + the stale-build gate) the #759 shift usage-status semantic moved the recorded values; binaries straddling that change recorded different bytes. 2. (this fix) the upstream assets expand ${THIS_SH} UNQUOTED (errors.tests:369 -> errors10.sub:10-16 re-invokes it for every status line), and with no explicit value the engine auto-detects current_exe's FULL path (executor/init.rs:544). When the checkout lives under a path containing a space, every sub-invocation word-splits - verified: running the slice from 'D:\temp-812\rub spaced host' collapses stdout 1037 -> 31 bytes with 'D:/temp-812/no: No such file or directory' on stderr, killing exactly the after-exit/after-shift block. No snapshot normalizer can repair that (the lines are absent, not misspelled), and the asset is GPL upstream - so the runner pins the value instead, the same contractual move true-baseline.sh makes on the GNU side (THIS_SH=$GNU_BASH). run_suite_snapshot now stages a copy of this test's own engine as bash.exe under a space-free directory (scratch first, SystemRoot\Temp fallback, both cleaned up) and exports THIS_SH to the child; the engine's inherited_sh contract keeps a bash-named existing file, so the pinned value wins on every host and a bash-named wrapper is already the blessed conventional-name configuration. Byte evidence, both profiles built at the current HEAD: - host A (space-free checkout): snapshot suite green - bytes unchanged, no re-record needed; - host B simulation (same tree via a junction named with a space): pre-fix the snapshot test FAILED (arith-for collapsed first; the manual errors matrix: 31 vs 1037 bytes), post-fix green - byte-identical to host A and to the committed snapshots; - normalizer untouched: the pinned path never reaches snapshot bytes, so this reuses the #808 machine-stability shape (runner-side determinism) instead of adding a normalizer. CI leg (three-way): the windows regression job on this branch runs the same bytes; the recorded-snapshots artifact is byte-identical to the committed files (see PR description).
|
#812 three-way byte evidence (CI leg landed) CI run 39147238565 (windows-latest, head 99b0f36): GNU regression goldens and canaries job = success, all other jobs green. The
Full three-way table for the record:
The errors |
caomengxuan666
left a comment
There was a problem hiding this comment.
Independent CR of fix/testinfra (99b0f36), base c6f4a9b. Verdict: APPROVE-WITH-NITS — every load-bearing claim independently reproduced; findings below are non-blocking.
Verified
- Semantic port check vs third_party/bash/support/{recho,zecho}.c: strprint is behavior-identical (<0x20 → ^+64, 0x7F → ^?, first NUL ends, 0x80-0xFF raw, argv[1..n] indexing,
>\n); zecho space-join + single trailing newline + per-arg C-string truncation match %s semantics. - Helper-parity preflight self-run under WSL GNU 5.3.0 x debug PE: gate green, 24 OK / 2 report-only. Classification is correct: only
caf\xc3\xa9diverges (code point ≤0xFF collapses to one byte — the #540 engine family);'\xe4\xb8\xad'roundtrips byte-exactly (code point >0xFF re-encodes to identical UTF-8), so its OK is real parity, not misclassification. - Mutation test: single-byte corruption (
b + 64→b + 65) → 3 FAILs with od dumps → FATAL exit 9. Reverted; tree verified clean. The oracle od dump doubles as wire-level byte-class evidence (5e 41 = ^A, 5e 3f = ^?, empty argv<>, tail-arg indexing). - GPL clean-room: zero GPL/FSF license text in the Rust files (grep), no code-structure mirroring (the wire decoder is rubash-specific; strprint is the trivial behavior-mandated mapping); the two descriptive title lines pre-exist this PR.
- Ran the catalogue runner against this branch's build: all 34 cases match declared expectations (22 must-match green, 12 diverges still diverging), stale gate ok.
- Deep spot-checks: issue-743 (
a$w"b"→ [aa][bb] / [a][bb] — pins the wholly-quoted pre-fix defect), issue-776 (read -N keeps [a␊b] verbatim), issue-788 (array attr bit a|2|y ×3, scalar |1, assoc A|1|v). All byte-identical GNU vs arm; each would fail pre-fix. - #706 contract is wired in code, not just prose: fast-path-differential exits 1 on quietly-fixed known cases ("KNOWN CASES NOW MATCHING"), and a static overlap check shows no issue tracked in both lists (differential: 154/383/707/708/709 only).
- Pointer rows resolve: issue_780/issue_753/issue_776/issue_788 mods exist in tests/regression.rs; tests/issue799_command_name_case_regressions.rs exists; #803's CRLF copy predicate is present with the autocrlf rationale. The three exemptions are sound (780 startup-flag face; 799 r/R cannot coexist on NTFS/DrvFs so no differential case is expressible; 803 harness-face).
- Spaced-host sim at engine level: engine under "D:/temp-812/rub spaced host/" with no THIS_SH → word-split collapse ("D:/temp-812/rub: No such file or directory", rc 127, 28 bytes); with THIS_SH pinned to a space-free bash.exe copy → full block, "after exit: 0". Pre-fix FAIL → post-fix PASS reproduced.
- inherited_sh contract (src/executor/init.rs:536-543) verified live: bash.exe-named existing file kept verbatim; wrapper.exe-named and missing-file values both fall back to auto-detect — the pin borrows documented, explicitly-blessed behavior; init.rs is not touched by this PR.
- Bytes: committed snapshots contain zero path/placeholder content; full snapshot lane green on this host with a live pid-bearing pin path — the pin never reaches bytes (and sits inside the scrubbed scratch prefix even if a future suite echoes it).
- No spillover:
.env("THIS_SH", …)exists only in run_suite_snapshot; catalogue runner/cases and the true-baseline rub side (deliberately auto-detecting, per its header contract) are untouched.
Gates
- CI all green at 99b0f36 (stale SKIPPED as usual); MERGEABLE.
cargo test --test regression: 74 passed, 0 failed on this host.cargo fmt --checkclean.- 3 commits, each scoped exactly to its claim (3 / 11 / 1 files); third_party tree unchanged (16ddcc77); no stowaways.
Findings (non-blocking)
-
NIT tests/regression.rs space_free_this_sh (~:463-472): the SystemRoot\Temp fallback pin path lives OUTSIDE the scrubbed scratch prefix (
C:\Windows\Temp\rubash-812-thissh-<pid>\bash.exe). Today unreachable in bytes (no suite prints ${THIS_SH}; verified zero path content in committed snaps), but if a future snapshot suite ever echoes ${THIS_SH}, the fallback spelling would reintroduce pid-bearing machine-dependent bytes. Cheap hardening: also scrub the resolved this_sh path in normalize_snapshot. -
NIT scripts/true-baseline.sh ensure_test_helpers (~:113-118): gcc/rustc builds are
2>/dev/null || true, so a failed rebuild silently keeps the previous carrier — "rebuilt EVERY run" guarantees freshness only on success. Benign while the C source is frozen (parity gate still compares behavior), but a build failure should ideally be loud or surfaced in the parity log. - OBS (adjacent, pre-existing, not introduced here): the true-baseline ledger's rub side runs with auto-detected THIS_SH, so the same unquoted-${THIS_SH} collapse fixed here for snapshots would misattribute errors-suite diff lines to the engine when a checkout lives under a spaced path. Worth a follow-up issue, not a change to this PR.
- ULTRA-MINOR tests/regression.rs: if create_dir_all succeeds on the fallback but the exe copy fails, the created empty dir leaks (the panic path doesn't remove it).
Nothing here blocks merge. Mutation and fixtures used during review were reverted/removed; no merge performed.
Three test-infrastructure tickets, three commits, no product (
src/) changes.#767 - true-baseline: one helper implementation, parity-gated (a5980de)
scripts/true-baseline.shstaged two different helper implementations into $BASE (gcc ELF fromsupport/{recho,zecho}.cfor the oracle, an independently-rendering Rust pair for the arm) and rebuilt neither after the first seed, so helper-pair differences were counted against the engine (9 of the 21-22 differing suites depend on these helpers).scripts/test-helpers/{recho,zecho}.rsare now required-byte-exact ports ofsupport/*.c. Byte-exactness rides on how rubash writes argv onto the Windows command line (probed with anencode_widedumper): every byte < 0x100 travels asU+00nn, valid multi-byte sequences as their code points, loneDC80-DCFFas bytes - so the port decodes the wire back to the producer's bytes and renders perrecho.c(^X/^?, raw 0x80-0xFF, first-NUL stop). Clean-room behavioural port; no GPL text enters the MIT tree.Rerun, bidirectional (oracle GNU bash 5.3.0 x {debug, release} arms): 83/83 suites measured in both directions through the green gate (
helper-parity.log: 24 ok, 2 report-only, each run). Remaining per-suite profile deltas (builtins 0<->341, coproc 4<->6, read 0<->2) carry zero helper-rendered bytes; a whole-ledger scan finds no same-input helper-rendering divergence - every residualargv[...]diff is an engine-side input difference (PATH-rendering, glob verdicts, tokenization) the unified helpers now render faithfully.#746 - regression catalogue: the #750-#810 fixed-issue wave (d8c8e0f)
The skeleton (PR #774) predates the wave; this lands the ratchet's PROMOTE step plus the first batch, so every fixed issue of the wave has one catalogue line (README wave table).
must-match(verified on the current arm, 13 rows): 703, 733, 738, 742, 743, 744, 745, 753, 755, 758, 761, 761b, loc-l1 ($(cat FILE) on non-UTF-8 content yields an empty value plus a bogus "No such file"; ${x:off:len} fabricates PUA marker bytes; read -r strips a trailing CR #772);issue-756flips after the case was trimmed to the fixed face (residual wording stays with [meta] 诊断消息格式族 tracking(C1-C8,约 30 条):stdin line N 前缀缺失 / 回显行重排 / EOF 命名 / [[ ]] 消息形态 / 双重诊断 / 行号取点 / 程序名前缀混用 / write error 前缀 (P3) #551).-O/+Oerrors (rc 2) where GNU lists the shopt table (rc 0) — sibling of the fixed -o case #780 (startup-flag face), [P2][harvest] 命令名解析大小写不敏感:source 纯 gitconfig alias 文件时小写 r 启动了 R.exe,REPL 被 R 吞掉 (asset: kutsan/dotfiles#aliases.gitconfig) #799 (r/R cannot coexist on NTFS and WSL DrvFs is itself case-insensitive - pinned bytests/issue799_command_name_case_regressions.rs), [P1][regression] master goldens red: nquote snapshot stdout differs from golden (upstream_suite_slice_snapshots, 69/70) — red since 98794cb7 or earlier #803 (the snapshot runner's CRLF copy predicate).divergeswith refreshed notes: assoc subscripts via ANSI-C quoting do not match variable lookups, and declare -p leaks U+E401 into the stored key (bytes verified without od) #734, path model: cd ~ uses the startup HOME; mkdir succeeds where cd then fails at ~260 chars; pwd and realpath disagree on spelling #754, prompt expansion incomplete: bare special parameters stay literal and shopt -u promptvars has no effect (plus \! \# HISTCMD PS0 compgen -A signal) #757, builtin divergences:dirs -lshape,shiftbad-operand status, 3 non-bash builtins (setopt/unsetopt), and 17 more #759, limits: fd table caps at 1014 with "cannot duplicate fd: Invalid argument"; read counts NUL bytes where cmdsub drops them silently; closed fd 0 then redirect errors #773, $(cat FILE) on non-UTF-8 content yields an empty value plus a bogus "No such file"; ${x:off:len} fabricates PUA marker bytes; read -r strips a trailing CR #772-residual, and the Post-merge review triage of #790/#789/#791: user-reachable wrapper flag, getppid() race in PID namespaces, carrier-blind quote simulation #794/#789 splitting rework: two field-splitting regressions vs GNU 5.3.0 (nested-quote guard + ${$+<nl>}) #795/2026-10-18 PR wave: 3 byte-level regressions vs GNU 5.3.0 (comsub assign guard byte, @K trailing space, kill-then-wait notice) #796 post-merge triage faces.Run: all 34 catalogued cases match their declared expectation (arm = this branch's release build; stale gate ok).
#812 - errors slice: space-free THIS_SH pin (99b0f36)
The
after exit:/after shift:status lines (errors.snap:63-80) diverged across Windows hosts both directions while CI stayed green. Two stacked causes:dirs -lshape,shiftbad-operand status, 3 non-bash builtins (setopt/unsetopt), and 17 more #759 shift usage-status semantic moved the recorded values (already re-recorded on master by 5892b6f);D:/temp-812/no: No such file or directory.No snapshot normalizer can repair absent lines, and the asset is GPL upstream - so
run_suite_snapshotpins the value instead (the same contractual move true-baseline.sh makes on the GNU side): a copy of the engine asbash.exeunder a space-free directory (scratch first,SystemRoot\\Tempfallback, cleaned up), exported as THIS_SH. The engine's inherited_sh contract keeps a bash-named existing file; the pinned path never reaches snapshot bytes, so the normalizer is untouched (the #808 runner-side-determinism shape, not a new normalizer).Three-way byte evidence (each =
cargo test --test regression upstream_suite_slice_snapshotsagainst the committed snapshots at this HEAD):D:\temp-812\rub spaced hostregression-snapshotsartifact byte-identical to the committed files (evidence posted below once the run lands)Discipline
src/changes; no snapshot re-record required by any commit here.--test regressiontarget green (70/70 on the pre-rebase tree, snapshot suite re-verified on the rebased tree).