Skip to content

#1488 wiring wave6: md5sum sha1sum sha256sum sha512sum echo rev to the rust2 staticlib - #1620

Merged
caomengxuan666 merged 7 commits into
mainfrom
rust2/wire-wave6-final
Nov 14, 2026
Merged

caomengxuan666 merged 7 commits into
mainfrom
rust2/wire-wave6-final

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

#1488 mechanical replacement — wiring wave6

6 commands wired to the rust2 staticlib, C++ bodies deleted (one commit per family/command per the wiring discipline):

command commit gates
md5sum sha1sum sha256sum sha512sum 19bdd76 4x33 case tables: 124 strict/exit + 8 win GREEN; ctest slices green
rev 224bb6f 25 rows: 19 strict + 4 win GREEN; -h/-V now GNU byte-exact
echo 430ccc3 40 rows: 38 strict + 2 win GREEN; all escape/flag/POSIX rows byte-match GNU through the dispatcher
rust2(digestsum) fifo bridge 46b9abf mkfifo.md5sum_hashes_writer_bytes fixed (marker reads rendezvous, not the 7 marker bytes)
docs 6bb37c3 rust2/GATE-REPORT.md "Wave6 wiring" section

Three gates (recipe §3)

  • Gate a (GNU oracle): product-mode run-gate.sh — 184 GNU-gated rows + 13 win rows, 197/197 GREEN (RUST_BIN = the wired build-vs exe, CPP_BIN = the pre-wiring baseline exe copy, GNU = WSL coreutils 9.4 / util-linux 2.39.3). Help/version shapes the dispatcher intercepts with the WinuxCmd-branded metadata flipped to win in gen-cases.py; rev -h/-V stayed strict (permissive-shorts policy classifies them as operands, the body prints the probed util-linux bytes).
  • Gate b (ctest): full suite split 1-2000 / 2001-3863 — the failing set equals the pre-wiring baseline set byte-for-byte by name (24 environment-bound rows incl. the 4 rust2-stream-* Not Run lanes; 24 = 24, zero new failures). Total tests 3862 -> 3863 (+1: the new rev_c_locale_reverses_bytes locale-model pin).
  • Gate c (old exe byte matrix): target/issue-suites/results/wave6-wiring/matrix.sh — 157 rows (26 per digest applet incl. the full --check machinery, 34 echo incl. the -e/-n/-E escape matrix + POSIX modes, 19 rev incl. single/multi-file, dash operand, locales), rc+stdout+stderr compared: 147/157 byte-equal; the 10 differing rows all move to GNU (4x digest empty-operand quotef quoting, 3x echo retired -u/--upper/-r/--repeat extensions printed as data, 3x rev -h/-V util-linux text vs the 1.x parse error / WinuxCmd version block). GNU rc parity 156/157 — the one miss (echo -r x) is a declared-retired-extension corner where the old exe returned the same rc 1.

Design notes (dispatcher plumbing retired with the 1.x echo body)

  • echo.c never calls getopt: the rewrite hook that guarded data tokens behind a -- is deleted (it fed the generic parser; the GNU-exact Rust scanner would print the guard), help/version interception narrows to the sole-argument rule (echo.c argc == 2), and echo's option policy turns permissive (no echo argv rejected ahead of the body).
  • rev joins permissive-unknown-shorts (-h/-V reach the util-linux-shaped body; rv14 fixes a 1.x rc-1 parse-error deviation).
  • The digest family keeps the ABI v1 whole-buffer stdin entry this wave (streaming v2 stays a later optimization, per the wave instructions); stdin shape = no FILE operand or a - operand, detected by the registration like fold's.
  • Operand literalism follows the already-wired b2sum_wildcard digest-family pin (the shell globs, the program does not); the 1.x glob-expanding ctests moved to that contract.
  • digestsum gains the fs_win !<fifo> named-pipe bridge on reads (paste.rs precedent) — the ctest-net-caught component fix that motivated commit 1.

Known notes / deferred

  • CI oracle/baseline lanes: environment-bound (WSL interop paths) — same 24 rows fail on the untouched baseline on this machine.
  • The digest family's streaming-stdin swap (v1 slurp is the documented whole-buffer price) is deferred per the wave instructions.
  • Pre-wave6 wiring predates the product-exe help-row convention: sha224sum/sha384sum/b2sum/tac still carry strict driver-era --help rows in their tables — a product-mode gate run for those commands would need the same win flip (noted in GATE-REPORT.md, not touched here).

Refs #1488

…ridge (#1488)

Gate b surfaced it during the wave6 wiring: the wired digest family read
FILE operands with a plain std::fs::File::open, so a `!<fifo>` marker
returned the marker's 7 bytes as the digest and stranded the `tee <fifo>`
writer in open_fifo_write forever (mkfifo.md5sum_hashes_writer_bytes
failed at the 10 s rendezvous cap). open_operand() now routes markers
through fs_win::is_winux_fifo_path + open_fifo_read — the paste.rs
wiring precedent, the rust2 port of the 1.x file_io::open_binary_file
marker branch the wave5 mkfifo cross-checks pin.

rev.rs carries only the operand-literal comment (the b2sum_wildcard
digest-family contract: the shell globs, the program does not — GNU
digest.c / util-linux rev receive shell-expanded operands; the 1.x
md5sum/rev bodies glob-expanded, a GNU deviation the port does not
carry and the 1.x-pinned wildcard ctests drop in the wiring commits).

cargo test digestsum 23/23, rev 15/15; fmt clean.

Refs #1488
…the C++ bodies (#1488)

Mechanical replacement per rust2/REPLACEMENT-RECIPE.md: each handler
body is the stdin-shape election (no FILE operand, or a '-' operand ->
run_command_with_stdin, the ABI v1 whole-buffer entry the digest family
keeps this wave; everything else -> run_command pass-nothing) plus one
call into rust2/crates/winux-cmds/src/digestsum.rs. The whole
*_sum_pipeline namespace (BCrypt hash objects, the build_config
conflict ladder, sum_check plumbing) is deleted per applet; the
REGISTER_COMMAND metadata stays byte-identical (help/man still render
from it). ctx.raw_args passes verbatim because GNU digest.c parses its
own getopt run.

Case-table flips (gen-cases.py digest_rows, one shared function):
a18/a19 --help/--version become win rows — the wired product's
dispatcher intercepts them with the WinuxCmd-branded metadata text, so
the GNU bytes leave the gate; the driver-era rows that gated them were
green pre-wiring (ledger 2026-11-14).

Three gates (build-vs exe vs the pre-wiring baseline exe vs WSL
coreutils 9.4):
- gate a+c harness: 4x33 case tables, 124 strict/exit rows GREEN, 8 win
  rows GREEN (RUST_BIN=the wired product, CPP_BIN=the baseline copy).
- gate c stderr matrix (target/issue-suites/results/wave6-wiring/
  matrix.sh, 26 digest rows per program, rc+stdout+stderr): byte-equal
  old-vs-new except the empty-operand quoting (md5sum: '': ... — the
  GNU quotef shape; the 1.x exe printed the name unquoted), 22/26 rows
  byte-equal per applet incl. the full --check machinery (OK/FAILED/
  bad length/warn garbage/--quiet/--status/--tag conflicts).
- gate b: ctest md5sum/sha1sum/sha256sum/sha512sum slices green; the
  1.x-pinned wildcard rows (md5sum.md5sum_wildcard,
  sha512sum.sha512sum_wildcard, integration.md5sum_wildcard_pipe_sort)
  move to the literal-operand GNU contract of the already-wired
  b2sum_wildcard pin (the shell globs, the program does not).

Refs #1488
Mechanical replacement per rust2/REPLACEMENT-RECIPE.md: the handler is
the stdin-shape election (rev reads fd 0 ONLY with no FILE operand —
util-linux opens '-' literally, never as stdin — hence
run_command_with_stdin there, run_command pass-nothing everywhere else)
plus one call into rust2/crates/winux-cmds/src/rev.rs (the util-linux
rev 2.39.3 model: -0/--zero, locale-driven byte/UTF-8 reversal units,
GNU-shaped option diagnostics). The 1.x helpers (utf8_unit_length,
reverse_record_body, process_stream, expand_file_operands glob) are
deleted; REGISTER_COMMAND metadata stays byte-identical.

rev joins the permissive-unknown-shorts option policy
(command_context.cppm): util-linux owns -h/--help and -V/--version that
the metadata does not spell, so 'rev -h' reaches the wired body instead
of dying as a C++ "invalid option" parse error — rv14 flips from the
1.x rc 1 to the GNU rc 0 util-linux help (ledger r=c:no records it).

Case-table flips (gen-cases.py): sole/first --help/--version LONG tokens
go through the dispatcher's WinuxCmd-branded interception, so rv13/15/18
become win rows; rv14/rv16/rv17 stay strict — the permissive-shorts
policy classifies the short spellings as operands, the body prints the
probed util-linux bytes (GNU-exact, ledger r=g:yes).

rev_unit_test moves to the probed locale model: whole-UTF-8-unit
reversal needs an explicit multibyte locale (LC_ALL=C.UTF-8), the
effective locale with none of LC_ALL/LC_CTYPE/LANG set is C
(setlocale fall-back, probed GNU rev 2.39.3) and reverses bytes — the
1.x body always reversed UTF-8 units, a GNU deviation the port replaced.

Three gates (build-vs exe vs the pre-wiring baseline exe vs WSL
util-linux 2.39.3):
- gate a+c harness: 25 case tables, 19 strict rows GREEN + 4 win rows
  GREEN (rv14/rv16/rv17 strict rows byte-match GNU; rv14's r=c:no is the
  recorded 1.x parse-error deviation).
- gate c stderr matrix (19 rev rows, rc+stdout+stderr): byte-equal
  old-vs-new except -h/-V/-V-extra (GNU util-linux text vs the 1.x
  parse error / WinuxCmd version block).
- gate b: ctest rev slice green (locale-model + literal-operand contract
  updates above; rev_wildcard_file_operands_stay_literal follows the
  b2sum_wildcard digest-family pin).

Refs #1488
Mechanical replacement per rust2/REPLACEMENT-RECIPE.md: the handler is
one winux::rust2::run_command("echo", ctx.raw_args) call into
rust2/crates/winux-cmds/src/echo.rs (coreutils src/echo.c's hand-rolled
leading-[-neE]-only flag scan, the POSIXLY_CORRECT allow_options rule
(argv[1] == "-n" exact match), the sole --help/--version rule and the
measured escape table). The whole echo_pipeline namespace (escape mode
election, build_text, process_escapes, the -u/--upper and -r/--repeat
extensions) is deleted; REGISTER_COMMAND metadata stays byte-identical
(help/man still render from it; the extension spellings remain listed
for help-surface continuity but retire with the body — GNU echo treats
them as data and the rust2 port is GNU-exact).

echo.c never calls getopt, so the dispatcher plumbing built around the
1.x body retires with it (dispatcher.cppm / command_context.cppm):
- the rewrite hook that guarded data-looking tokens behind a "--" is
  gone — it exists to feed the generic parser, which would otherwise
  print the guard as data through the GNU-exact scanner;
- echo's --help/--version interception narrows to the sole-argument
  rule the library implements (echo.c honors them only as the sole
  argument: 'echo -n --version' prints "--version", 'echo --help x'
  prints "--help x" as data), still gated by the POSIX literal-mode
  check (POSIXLY_CORRECT=1 echo --help prints "--help");
- the generic parser turns permissive for echo (allow_long_options off,
  unknown shorts as positionals): no echo argv is rejected ahead of the
  body, and the declared -n/-e/-E still parse for occurrence
  bookkeeping the handler never reads.

echo never reads stdin: the pass-nothing run_command contract keeps fd 0
live for pipeline consumers.

Case-table flips (gen-cases.py): sole --help/--version become win rows
(dispatcher interception prints the WinuxCmd-branded metadata text; the
POSIX-literal help/version rows stay strict — interception is disabled
there and the GNU bytes flow). echo_unit_test moves the retired
-u/--upper and -r/--repeat extension pins to their GNU data forms.

Three gates (build-vs exe vs the pre-wiring baseline exe vs WSL
coreutils 9.4):
- gate a+c harness: 40 case tables, 38 strict rows GREEN + 2 win rows
  GREEN (RUST_BIN=the wired product, CPP_BIN=the baseline copy); every
  escape/flag/POSIX row byte-matches GNU through the product dispatcher.
- gate c stderr matrix (34 echo rows, rc+stdout+stderr): byte-equal
  old-vs-new except the retired -u/--upper/-r extension rows, where the
  new exe prints the GNU data form.
- gate b: ctest echo slice green (the two extension pins updated above).

Refs #1488
md5sum sha1sum sha256sum sha512sum echo rev wired; three-gate numbers
(run-gate product-mode 184 GNU-gated + 13 win GREEN; byte matrix
147/157 old-vs-new with the 10 GNU-moving rows explained; ctest failing
set == the pre-wiring baseline), the digest v1-stdin decision, the echo
dispatcher-plumbing retirement and the deferred streaming-stdin swap
recorded.

Refs #1488
The 17 new zh-CN extra legacy keys are exactly the deleted 1.x strings
of the replaced bodies (verified by hash): the md5sum-family conflict
ladder and BCrypt helper errors, the four digest Try-help lines, rev's
stdin-error wording and echo's repeat-range validation. The GNU wording
the replacements produce lives on the rust2 side, outside the C++
legacy extraction, so the catalog keys became extra. Recorded in the
same PR per the gate contract; baseline commit ffcbe99 passes clean
(181 items), this branch records 198.
@caomengxuan666

Copy link
Copy Markdown
Member Author

i18n-drift lane: the 17 new zh-CN extra legacy keys are hash-verified as exactly the deleted 1.x strings of the replaced bodies (md5sum-family conflict ladder + BCrypt helper errors, the four digest Try-help lines, rev's stdin-error wording, echo's repeat-range validation) — the GNU wording the replacements produce lives on the rust2 side, outside the C++ legacy extraction. Baseline commit ffcbe99 passes clean (181 items), this branch records 198 via the sanctioned --update-baseline in the same PR (65b1429), per the gate's growth-visibility contract.

#1488)

The commit-split dance restored the wired C++ bodies but missed three
updated test files, so the digest/echo wiring commits still carried the
1.x glob-expansion pins for md5sum/sha512sum/integration while the
product already treats wildcard operands as literal (the b2sum_wildcard
digest-family pin) — the x64-default CI ctest leg caught the mismatch
(the local gate-b run had the updated files in the working tree).
Restores the three files from the verified working-tree state: the
wildcard rows pin the GNU literal-operand ENOENT and rc 1, and the
integration pipeline carries sort's rc 0 with the md5sum diagnostic on
stderr.

Refs #1488
@caomengxuan666
caomengxuan666 merged commit 68d2917 into main Nov 14, 2026
15 checks passed
@caomengxuan666
caomengxuan666 deleted the rust2/wire-wave6-final 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