Skip to content

#1488 wave6 - #1583

Merged
caomengxuan666 merged 8 commits into
mainfrom
rust2/wave6
Nov 13, 2026
Merged

caomengxuan666 merged 8 commits into
mainfrom
rust2/wave6

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

WinuxCmd 2.0 wave6 — rust2 library-form batch (#1488)

9 commands: md5sum sha1sum sha256sum sha512sum echo rev factor arch groups (parallel to the wave5 lane; no overlap — wave5 takes du/chcon/runcon/chgrp/link/mkfifo/mknod/date/tty/cksum).

Completion table

command cases strict exit win note GNU-gated C++ parity unit tests
md5sum 33 31 2 0 0 GREEN 31/33 wave6 vectors + family suite
sha1sum 33 31 2 0 0 GREEN 31/33 same
sha256sum 33 31 2 0 0 GREEN 31/33 same
sha512sum 33 31 2 0 0 GREEN 31/33 same
echo 40 40 0 0 0 GREEN 38/40 12 tests
rev 25 23 2 0 0 GREEN 19/25 8 tests
factor 37 32 4 0 1 GREEN 32/37 6 tests
arch 22 9 9 2 2 GREEN 11/22 3 tests
groups 22 5 10 6 1 GREEN 16/22 4 tests

Wave6: 278 cases, GNU-gated 270 PASS / 0 FAIL, win-gated 8 PASS / 0 FAIL.
Full 64-command regression: GNU-gated 1676 PASS / 0 FAIL, win 153 PASS / 0 FAIL.
cargo test 493/493 green, cargo fmt clean, every commit builds green.

Highlights

  • digest family — md5 (RFC 1321) and sha1 (FIPS 180-1) are new std-only in-tree streaming primitives in digest.rs; the round-constant table is generated from the RFC formula (a hand-typed table had two wrong entries — generation caught them). digestsum.rs extends the wave2 --check machinery with the four algorithms; help bodies/texinfo nodes probed verbatim. Two unit-test sha1 vectors that came from memory were caught wrong by the WSL probe and corrected before landing.
  • echo — ported from coreutils 9.4 src/echo.c (C source, not output matrices): allow_options = !POSIXLY_CORRECT || argv[1] == "-n" exactly, \c = mid-output EXIT_SUCCESS, measured octal rules (\0777 → one 0xFF byte).
  • rev — util-linux 2.39.3 semantics (the WSL oracle), -0/--zero accepted though undocumented, - is not stdin, locale (LC_ALL > LC_CTYPE > LANG) decides byte vs UTF-8 unit reversal via the injected env; path operands go through the shell-namespace resolve.
  • factor — exact for 0..=u64::MAX (trial division + deterministic Miller-Rabin + Pollard-Brent rho), probed GNU worst cases (2^64-1, 4295109041) match byte-for-byte.
  • arch/groups — 1.x C++ value model (win rows), GNU rc-gated grammar rows; groups adds netapi32 NetUserGetGroups FFI with the [gap] groups/id/stat: unresolvable group name prints literal 'None' #1024 None-group rule.

Documented subsets (GNU comparison evidence in module docs + commit bodies)

  • factor > u64::MAX: GNU factors via GMP (probed 2^64 = 64 twos rc 0); rust2 rejects rc 1 — note-classified row, never gating.
  • rev: GNU rev 2.39.3 hangs (probed rc 124 under timeout) on invalid byte sequences and directory operands; rust2 reverses byte-wise / reports the open error instead — no gate row can cover those honestly, fallback pinned by unit tests. UTF-8 rows pin LC_ALL (Windows side has no inherited locale).
  • arch -h / groups -h: argopt's lone -h → help is a documented deviation from GNU (both reject -h), note-classified (hostid precedent).
  • factor multi-line stdin rules are unit-pinned (harness stdin column is a single printf %s token).

Commits (一事一 commit)

  1. 4c3fd2da md5sum sha1sum sha256sum sha512sum + md5/sha1 primitives (4x33-case gate)
  2. 81fc9568 echo (40-case gate)
  3. 5f6a5f92 rev (25-case gate)
  4. a4a3db72 factor (37-case gate)
  5. ab9f1415 arch (22-case gate)
  6. 44b1034e groups + winsys netapi32 (22-case gate)
  7. 266323d5 gate: wave6 report section + coverage regeneration

Do not merge — review only (per lane discipline).

util-linux rev semantics (the WSL oracle is rev 2.39.3, not coreutils;
probed 2026-11-12): -0/--zero accepted though undocumented in its --help,
options permute (-V extra still prints the version), - is NOT stdin,
records reverse characterwise with UTF-8 units under a UTF-8 locale and
bytes under C/POSIX — the locale read follows setlocale precedence
(LC_ALL > LC_CTYPE > LANG, default C) through the injected env. Documented
GNU-hang subset (probed rc 124 under timeout): invalid byte sequences and
directory operands make GNU rev 2.39.3 hang; this implementation reverses
byte-wise / reports the open error instead, and no gate row can cover
those honestly — the fallback is pinned by unit tests. File operands go
through the shell-namespace resolve. UTF-8 gate rows pin LC_ALL (the
Windows side has no inherited locale).
GNU coreutils 9.4 factor: operand grammar from the probed source rules
(leading spaces only, one '+', all digits, no trailing chars; 010 is
decimal 10), stdin lines trimmed of spaces/tabs with blank lines skipped
and CR invalid (all probed), invalid operands continue processing with
rc 1, -h/--exponents p^e grouping. Number theory is std-only u64 exact:
trial division by primes < 1000, deterministic Miller-Rabin (the proven
12-base witness set), Pollard-Brent rho with u128 modmul — probed GNU
worst cases (2^64-1, 4295109041) match byte-for-byte. Documented subset:
GNU links GMP and factors arbitrary-precision operands (2^64 probed);
beyond u64::MAX this implementation rejects with rc 1, so that row is
note-classified (record-only), never gating. Multi-line stdin cannot
pass the case harness (stdin column is one printf %s token); those rules
are pinned by unit tests and the operand rows gate the rest.
GNU coreutils 9.4 arch (uname -m variant): getopt_long with ONLY long
help/version options — short -h/-V are invalid in GNU (arch: invalid
option -- 'h'; the shared argopt lone--h->help deviation is note-
classified like hostid), long abbreviations work (--ver probed), options
permute past operands (arch foo --help prints help), any remaining
operand is 'arch: extra operand <x>' rc 1 (#1215 parity with the C++
applet). Output is GetNativeSystemInfo native arch (WOW64-safe, same as
the C++ arch.cpp), platform-inherent so value rows gate win and grammar
rows gate exit; help/version text is strict vs WSL coreutils 9.4.
GNU coreutils 9.4 groups output shape with the C++ applet's Windows
value model (src/commands/groups.cpp): self form prints bare group
names; named form prints '<user> : <groups>' per user, processing
continues past failures with rc 1; unknown user is GNU's 'groups: <user>:
no such user' wording (exit-gated). Membership comes from
NetUserGetGroups (level 0) — the same source as the C++ pipeline — added
to winsys.rs alongside LookupAccountNameW (both std-only raw FFI); the
well-known None group prints its SID-derived numeric id like an
unresolvable gid (#1024). Value rows gate win (Rust rc vs C++ rc);
help/version are strict GNU text. argopt's lone -h->help deviation is
note-classified (GNU groups has no shorts).
…1488)

md5sum/sha1sum/sha256sum/sha512sum/echo/rev/factor/arch/groups: 278 new
gate cases, all GREEN against WSL coreutils 9.4 (util-linux 2.39.3 for
rev). Full 64-command run: GNU-gated 1676 PASS / 0 FAIL, win-gated 153
PASS / 0 FAIL. cargo test 493/493 green; cargo fmt clean.
…o its TSV

- emit list: factor/groups ride the wave4b entries (one definition per
  name; duplicates would double-count the coverage total)
- groups_rows: keep the wave6 gr01-self 22-row table (the validated
  3-way-gated set) instead of the wave4b comment-style block the merge
  had kept by mistake; regenerated groups.tsv now matches the committed
  wave6 TSV byte-for-byte
@caomengxuan666
caomengxuan666 merged commit 949c88f into main Nov 13, 2026
13 of 14 checks passed
@caomengxuan666
caomengxuan666 deleted the rust2/wave6 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