Skip to content

wire wave2b (#1488) - #1568

Merged
caomengxuan666 merged 12 commits into
mainfrom
rust2/wire-wave2b
Nov 11, 2026
Merged

caomengxuan666 merged 12 commits into
mainfrom
rust2/wire-wave2b

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

Mechanical replacement per rust2/REPLACEMENT-RECIPE.md for the wave2b applets: base64 base32 b2sum sha224sum sha384sum tac truncate — each REGISTER_COMMAND keeps its metadata byte-identical, the handler body becomes one winux::rust2::run_command[_with_stdin] call, and the C++ implementation is deleted in the same change (no dual track).

Shared bridge change (rides with the base64 commit): run_command_with_stdin() adopts the ABI v1 whole-buffer stdin; the CALLER applies each command's own GNU operand rule (basenc/digest/tac read fd 0 only when no FILE operand stands or an operand is "-"), so base64 FILE at an interactive console never blocks on a slurp GNU would never do. Deliberately NOT the streaming v2 ABI (recipe §5, later wave). gate/wire/cmd-matrix.sh gains the wave2b fixture + case tables (24-34 cases per command, incl. --check OK/FAILED/bad-line/missing/garbage for the digest family).

Commits (one per command, plus one Rust-side fix and one docs commit):

  • 4b0f520f rust2 wave2b GNU-shape fixes ahead of wiring, all probed byte-identical on WSL 9.4 + MSYS:
    • basenc/digestsum validate -w/-l at the getopt position before extra-operand/read/combo checks (basenc.c:1106-1113, digest.c GETOPT_LENGTH) — base64 -w bogus missing, base64 -d -w bogus mf, b2sum --tag --check -l bogus now match GNU and the pre-wiring exe;
    • digest -b/-t last-wins (b2sum -t -b prints *-);
    • fsutil gnu_open_reason()+quotef(): recover GNU strerror for literal operands Windows-native opens reject (empty → ENOENT, trailing "/" → ENOTDIR-on-file / EISDIR-under-O_CREAT, *.txt → ENOENT, dir → EISDIR);
    • basenc/tac/digest/truncate open failures report GNU shapes (base64: read error: Is a directory, tac: indir: read error: Is a directory, b2sum: checkdir: read error, truncate O_CREAT cannot open name/ for writing);
    • tac empty separator = the tac.c:540 NUL sentinel (printf 'a\0b\0c\0' | tac -s '' → c\0b\0a\0, was echoed verbatim); record-write failures print tac: write error: ... instead of exiting silently.
  • 62b26261 base64 (+bridge+matrix harness), 6db00550 base32, 91921af4 b2sum, 29b16829 sha224sum, 43fa73d3 sha384sum, 11f4a63f tac, 120ed268 truncate, 0eb28bc7 docs(GATE-REPORT)

Three gates per command:

  • a) GNU oracle (WSL script-file runs): run-gate.sh GREEN for all 7 — base64 28 strict+2 win, base32 22+2, b2sum 31+1+2, sha224sum 47+1+2, sha384sum 25+1+2, tac 25+2, truncate 30 (211 GNU-gated + 12 win-only total). Sole --help/--version demoted strict→win (dispatcher-owned branded interception, nproc np10/np21 precedent; product-level byte equality for those rows is proven by the matrix). Added cross-shape rows lock the getopt-order fixes. cmd-matrix GNU rc oracle: 194/194 rows.
  • b) ctest: clean-env full suite on the wired exe = 10 failures, identical list on the baseline exe (swap-proof): cat/cpio/grep/sed .nul_txt (NUL.txt→NUL device on this Win10 19045 runner, [paths] On-disk NUL.txt handled three different ways by cat/grep/sed (device vs file depends on path tier) #1333 family), du issue_1288, nice×2, nohup×3 — none touch the wave2b commands. The 14 unit tests re-pointed at the wired GNU shapes fail ONLY on the baseline exe (they assert the deleted 1.x behavior). rust2 crate 266/266, cargo fmt clean. Differential corpus (WSL oracle): old/new failure sets byte-identical per command (base64 5, base32 2, b2sum 5, tac 6, truncate 2 — WSL→Windows interop argv artifacts; sha224sum/sha384sum have no corpus, covered by the gate tables).
  • c) byte equality vs the old exe (gate/wire/cmd-matrix.sh, rc+stdout+stderr): base64 28/28 rc+stdout (stderr 27/28), base32 28/28 (27/28), b2sum 34/34/34, sha224sum 27/27/27, sha384sum 27/27/27, tac 24/24/24, truncate 26/26 stdout + 25/26 rc/stderr. The four r=c:no rows are explained 1.x-vs-GNU gaps the rust2 side fixes, not wiring regressions: basenc missing-file bare-path wording (1.x said "cannot open 'X' for reading"), truncate -s 1kB grammar (GNU accepts =1000 bytes, 1.x rejected), tac directory-open wording (covered in b), digest -b/-t last-wins (covered in the fix commit).

Raw artifacts: target/issue-suites/results/wire-wave2b/ (mx-gnu/mx-old/mx-new ledgers + per-case .out/.err for all 7 commands, ctest-wired-clean-final.log, ctest-baseline-clean-final.log, wsl-diff-*). CI oracle job: savannah/WSL flakiness is known infra (#1538/#1548/#1551/#1563) — no retry loop needed.

@caomengxuan666

Copy link
Copy Markdown
Member Author

Rebased onto origin/main (31 commits: #1555/#1559/#1560/#1563/#1564/#1565/#1567 incl. wave2a sync + wave3a/wave3b wiring). Union resolutions: CMakeLists rust2-command list (main's hostid..numfmt + wave2b's seven), cmd-matrix.sh fixtures/case tables (both waves), rust2_bridge.cppm (main's kRust2StdinCommands allowlist contract preserved verbatim inside run_command; wave2b's caller-decided run_command_with_stdin kept as a separate entry; shared RAW-writer drain body). Verified post-rebase: clean-env ctest slice base64..truncate+timeout/expand/unexpand/numfmt/join/tsort = 369/369; rust2 run-gate spot check 115 GNU-gated + 6 win GREEN.

The two red checks:

Gate-driven fixes on the wave2 Rust applets before wiring them into the
product; every shape probed byte-for-byte on WSL coreutils 9.4 AND MSYS
(target/wc2b-probe cross-probe.sh / unit-probe.sh / trailing-probe.sh),
where both GNU platforms agree:

- basenc/digestsum: validate -w/--wrap and -l/--length at their getopt
  position, before the extra-operand check, the input read and the
  post-getopt combination checks (basenc.c:1106-1113 xstrtoimax at the
  option case; digest.c GETOPT_LENGTH xdectoumax) — the 1.x bodies
  validated in build_config the same way, so 'base64 -w bogus missing',
  'base64 -d -w bogus mf', 'base64 -w bogus mf extra' and
  'b2sum --tag --check -l bogus' report the option error like GNU and
  the pre-wiring exe, not the file/extra-operand/tag error.
- digestsum: -b/-t last wins (GNU digest.c toggles binary_mode per
  getopt occurrence; 'b2sum -t -b' prints the ' *-' marker).
- fsutil: gnu_open_reason() reconstructs GNU's strerror for literal
  operands Windows-native opens reject (empty name ENOENT, trailing
  slash ENOTDIR-on-existing-file / EISDIR-under-O_CREAT, invalid-name
  '*.txt' ENOENT, existing-directory EISDIR), plus shared quotef().
- basenc/tac/digestsum/truncate: open failures report GNU's shapes
  (basenc 'read error: Is a directory' with no operand; tac
  '{file}: read error: Is a directory'; digest -c checkfile
  '{prog}: checkdir: read error'; truncate O_CREAT
  'cannot open name/ for writing: Is a directory|Not a directory'),
  quotef-quoting names that need it ('*.txt', '').
- tac: an empty separator is the tac.c:540 NUL sentinel — compare
  against the NUL byte so 'printf a\0b\0c\0 | tac -s ""' reverses
  to c\0b\0a\0 (was: echoed verbatim); record-write failures print
  'tac: write error: <strerror>' (tac.c:474 write_error site) instead
  of exiting silently.

cargo test 266/266, cargo fmt clean; rust2 gate GREEN for all seven
commands after the fixes (211 GNU-gated + 12 win-only).
Mechanical replacement: registration metadata byte-identical, handler
is one rust2 call (stdin shapes route through run_command_with_stdin
like base64), C++ body deleted. Gate tsv help/version strict -> win.

Gates: run-gate.sh base32 GREEN (22 strict + 2 win); cmd-matrix
old-vs-new 28/28 rc + stdout, stderr 27/28 (same explained 1.x
missing-file wording row as base64); unit tests re-pointed at the
wired GNU shapes (bare-path missing wording, directory read-error,
literal '*.txt' operand — the shell globs, the program does not,
unlink.c:94 precedent).

# Conflicts:
#	CMakeLists.txt
Mechanical replacement: registration metadata byte-identical, handler
is one rust2 call ('-' operands and a missing FILE operand slurp fd 0
via run_command_with_stdin — the digest.c rule), C++ body deleted
(including the 1.x SHA core; the self-contained digest core lives in
rust2 digest.rs/digestsum.rs with the full --check machinery).

Gates: run-gate.sh b2sum GREEN (31 strict + 1 exit + 2 win) with the
--check OK/FAILED/bad-line/missing/garbage paths gated against GNU;
cmd-matrix old-vs-new 34/34 rc + stdout + stderr byte-identical
(including every --check shape); unit tests re-pointed at the wired
GNU shapes (literal '*.txt' operand).

# Conflicts:
#	CMakeLists.txt
Mechanical replacement: registration metadata byte-identical, handler
is one rust2 call (digest.c stdin rule via run_command_with_stdin),
C++ body deleted. Gate tsv help/version strict -> win.

Gates: run-gate.sh sha224sum GREEN (47 strict + 1 exit + 2 win) with
the --check OK/FAILED/bad-line/missing/garbage paths gated against
GNU; cmd-matrix old-vs-new 27/27 rc + stdout + stderr byte-identical;
unit tests re-pointed at the wired GNU shapes (literal '*.txt'
operand; the check-directory test already asserted GNU's
'checkdir: read error' shape, which the rust2 side now reproduces).

# Conflicts:
#	CMakeLists.txt
Mechanical replacement: registration metadata byte-identical, handler
is one rust2 call (digest.c stdin rule via run_command_with_stdin),
C++ body deleted. Gate tsv help/version strict -> win.

Gates: run-gate.sh sha384sum GREEN (25 strict + 1 exit + 2 win);
cmd-matrix old-vs-new 27/27 rc + stdout + stderr byte-identical; unit
tests re-pointed at the wired GNU shapes (literal '*.txt' operand).

# Conflicts:
#	CMakeLists.txt
Mechanical replacement: registration metadata byte-identical, handler
is one rust2 call (stdin operand rule via run_command_with_stdin), C++
body deleted (glob expansion of operands went with it — GNU tac.c
takes operands literally). Gate tsv help/version strict -> win.

Gates: run-gate.sh tac GREEN (25 strict + 2 win, incl. -r/-s regex
shapes and the NUL-separator sentinel rows); cmd-matrix old-vs-new
24/24 rc + stdout + stderr byte-identical; unit tests re-pointed at
the wired GNU shapes (directory operand 'tac: indir: read error: Is a
directory'; trailing-slash ENOTDIR; the NUL-sentinel empty-separator
test passes against the fixed rust side). issue1368's closed-stdout
write-error diagnostic is unreachable under the ABI v1 buffered
output — the host drain observes fd 1, not the command — so the test
documents the v1 price and the GNU diagnostic is deferred to the
streaming ABI wave (recipe section 5).

# Conflicts:
#	CMakeLists.txt
Mechanical replacement: registration metadata byte-identical, handler
is one rust2 call (GNU truncate.c never reads stdin, so the plain
bridge entry — a v1 slurp would block where GNU returns), C++ body
deleted (the 1.x operand glob expansion went with it — truncate.c
takes FILE operands literally). No gate tsv rows change: the truncate
table already gated strict-only and stayed green.

Gates: run-gate.sh truncate GREEN (30 strict, incl. the -o I/O-block,
--reference relative-only and the SIZE-grammar rows); cmd-matrix
old-vs-new 26/26 stdout, rc 25/26 and stderr 25/26 — the one row is
'-s 1kB', which GNU accepts as 1000 bytes (truncate.c unit table,
probed WSL 9.4) and the 1.x body rejected as Invalid number; the
wired side follows GNU. Unit tests re-pointed at the wired GNU
shapes: 'cannot open name/ for writing' EISDIR/ENOTDIR trailing-slash
wording (replacing the 1.x 'cannot resize') and the literal '*.txt'
operand (GNU would create it; Windows rejects the name — the
platform-inherent shape is asserted, no existing file touched).

# Conflicts:
#	CMakeLists.txt
Supersede the wave2 rows for the seven wired commands (help/version
strict -> win, cross-shape rows added), record the 1.x-vs-GNU gaps the
wiring surfaced (basenc missing-file wording, truncate -s 1kB grammar,
b2sum -b/-t last-wins, tac directory-open wording) and where the
product-level old-vs-new ledgers live.
Deleting the seven wave2b C++ bodies (base64 base32 b2sum sha224sum
sha384sum tac truncate) orphaned their legacy-catalog source strings:
16 new legacy.* extra entries in zh-CN, all introduced by this PR
(merge-base b055b48 checks clean). Same deliberate-growth precedent
as #1547/#1561 and wave3b's numfmt wiring; the catalogs sync on the
next reviewed i18n batch.

# Conflicts:
#	scripts/i18n-drift-baseline.json
@caomengxuan666
caomengxuan666 merged commit 1c407e1 into main Nov 11, 2026
8 of 10 checks passed
caomengxuan666 added a commit that referenced this pull request Nov 12, 2026
… the help-surface sweep (#1488 QC round 2)

- cpp_bin(): the default resolved into rust2/build-vs/... (build-vs is a
  TREE-root sibling, not under rust2/) — every QC-script cpp side
  degraded to 'missing exe' -> rc None until CPP_BIN was exported. Found
  by the round-2 NOTE-QC sweep; the env override still wins.
- rust_bin_for(): the wave2 lane-driver split is retired - #1566/#1568/
  #1570 wired every wave2/3 command to main, so one driver covers all 47
  tables; RUST_BIN_W2 stays only as an override. provenance() now prints
  a single rust= line (splits only when overridden).
- to_mnt() helper extracted from run_gnu_side's inline path mapping.
- qc_note_audit/qc_win_audit re-run templates no longer require
  RUST_BIN_W2.
- NEW gate/qc_help_surface.py -> HELP-SURFACE.md: standing sweep of
  every implemented command (47 gen-cases tables) x
  --help/--version/-h/--bogus, rust2 driver vs GNU 9.4 (batched
  per-command WSL scratch, /tmp/winuxcmd-gate-qc-help).

Round-2 sweep verdicts (188 probes): 15 commands fully ALIGNED on
--help/--version (the #1563 13 + test/bracket), 61 EMPTY-HELP +
19 RC-ONLY findings - all on the LIBRARY/driver surface; the product
exe's help face is covered by dispatcher metadata (verified basename/
mkdir/seq/join/expand/numfmt/tsort/timeout/stat print usage). RC-ONLY
headliners: hostname --bogus rc 1 vs GNU 255 (Debian hostname
contract), getconf --bogus rc 1 vs GNU 2, and -h treated silently rc 0
vs GNU invalid-option rc 1 on the argopt-era commands (same class as
the hostid ho12 / users us17 notes).
caomengxuan666 added a commit that referenced this pull request Nov 13, 2026
… the help-surface sweep (#1488 QC round 2)

- cpp_bin(): the default resolved into rust2/build-vs/... (build-vs is a
  TREE-root sibling, not under rust2/) — every QC-script cpp side
  degraded to 'missing exe' -> rc None until CPP_BIN was exported. Found
  by the round-2 NOTE-QC sweep; the env override still wins.
- rust_bin_for(): the wave2 lane-driver split is retired - #1566/#1568/
  #1570 wired every wave2/3 command to main, so one driver covers all 47
  tables; RUST_BIN_W2 stays only as an override. provenance() now prints
  a single rust= line (splits only when overridden).
- to_mnt() helper extracted from run_gnu_side's inline path mapping.
- qc_note_audit/qc_win_audit re-run templates no longer require
  RUST_BIN_W2.
- NEW gate/qc_help_surface.py -> HELP-SURFACE.md: standing sweep of
  every implemented command (47 gen-cases tables) x
  --help/--version/-h/--bogus, rust2 driver vs GNU 9.4 (batched
  per-command WSL scratch, /tmp/winuxcmd-gate-qc-help).

Round-2 sweep verdicts (188 probes): 15 commands fully ALIGNED on
--help/--version (the #1563 13 + test/bracket), 61 EMPTY-HELP +
19 RC-ONLY findings - all on the LIBRARY/driver surface; the product
exe's help face is covered by dispatcher metadata (verified basename/
mkdir/seq/join/expand/numfmt/tsort/timeout/stat print usage). RC-ONLY
headliners: hostname --bogus rc 1 vs GNU 255 (Debian hostname
contract), getconf --bogus rc 1 vs GNU 2, and -h treated silently rc 0
vs GNU invalid-option rc 1 on the argopt-era commands (same class as
the hostid ho12 / users us17 notes).
@caomengxuan666
caomengxuan666 deleted the rust2/wire-wave2b branch November 18, 2026 05:50
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