Skip to content

wire wave2a (#1488) - #1566

Merged
caomengxuan666 merged 13 commits into
mainfrom
rust2/wire-wave2a
Nov 11, 2026
Merged

caomengxuan666 merged 13 commits into
mainfrom
rust2/wire-wave2a

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

Mechanical replacement per rust2/REPLACEMENT-RECIPE.md for the remaining wave2a applets: whoami nproc unlink sleep hostname uname id getconf — each REGISTER_COMMAND keeps its metadata byte-identical, the handler body becomes one winux::rust2::run_command call, and the C++ implementation is deleted in the same change (no dual track).

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

Three gates per command:

  • a) GNU oracle (WSL script-file runs, strict/exit rows): run-gate.sh green for all 8 with RUST_BIN=wired product exe — unlink 22/22, sleep 24/24, hostname 22/22, uname 22/22, id 22/22, getconf 23/23. Help/version rows demoted strict->win per the nproc np10/np21 precedent: the dispatcher's branded sole --help/--version interception runs before the handler and is byte-identical old vs new. Known Debian-vs-product classes (hostname net-tools, id USER operand, getconf Windows table) stay win, as classified in the tsv tables.
  • b) ctest: full suite before/after; final clean-env run = 10 failures vs the 17-item recorded base. The 8 base-only entries are the shell_root/issue1364/1385 family that PASSES with the niubash env vars unset (clean-environment discipline); the 2 extra entries (cat/cpio .nul_txt) were proven not wiring-caused by swapping the baseline exe in as the command link and reproducing the failure (NUL.txt resolves to the NUL device on this Win10 19045 runner). Every wired command's own slice is green: unlink 11/11, sleep 12/12, hostname 11/11, uname 6/6, id 14/14, getconf 4/4. rust2 crate suite 264/264, cargo fmt clean.
  • c) byte equality vs the old exe (gate/wire/cmd-matrix.sh, rc+stdout+stderr): unlink 21/21, sleep 17/17, hostname 29/29, uname 24/24, id 25/25, getconf 26/26 rc + 26/26 stderr + 23/26 stdout — rows 10/12/13 (AVPHYS_PAGES, -a) are GlobalMemoryStatus volatility: the old exe drifts the same way between any two runs; all other table lines are byte-identical.

Raw artifacts: target/issue-suites/results/wire-wave2a/ (mx-* ledgers, per-case .out/.err, build logs, ctest-final-clean-full.log). CI oracle job: savannah/WSL flakiness is known infra (#1538/#1548/#1551/#1563) — no retry loop needed.

Mechanical replacement per rust2/REPLACEMENT-RECIPE.md: the REGISTER_COMMAND
metadata stays byte-identical; the handler body becomes one
winux::rust2::run_command("whoami", ctx.raw_args) call and the
whoami_pipeline namespace (GetUserNameA path) is deleted. ctx.raw_args passes
the operands verbatim because GNU whoami.c parses its own argv (extra operand
rc 1, unknown option rc 1, -h rejected).

Gates: run-gate.sh whoami 20/20 green with RUST_BIN=wired product exe,
CPP_BIN=baseline exe (wa05/wa06 demoted strict->win: the wired exe shows the
branded dispatcher help, byte-identical old vs new - the printenv/true-false
precedent for sole --help/--version interception). cmd-matrix.sh whoami 16/16
rc+stdout+stderr byte-equal old vs new, GNU rc oracle consistent. ctest slice
whoami 3/3. Library gate re-run before wiring: 96 GNU-gated + 81 win, 0 fail.
Mechanical replacement per rust2/REPLACEMENT-RECIPE.md: REGISTER_COMMAND
metadata byte-identical; handler body becomes one winux::rust2::run_command
("nproc", ctx.raw_args) call; the affinity/OpenMP/--ignore pipeline
(parse_omp_threads_env, parse_ignore_value) is deleted. ctx.raw_args passes
the operands verbatim because GNU nproc.c parses its own getopt run.

Gates: run-gate.sh nproc 22/22 green with RUST_BIN=wired product exe,
CPP_BIN=baseline exe (np10/np21 demoted strict->win: branded dispatcher
help/version, byte-identical old vs new - the printenv/true-false precedent).
cmd-matrix.sh nproc 19/19 rc+stdout+stderr byte-equal old vs new, GNU rc
oracle matches every row. ctest slice nproc 16/16.
Mechanical replacement per rust2/REPLACEMENT-RECIPE.md: REGISTER_COMMAND
metadata byte-identical; handler body becomes one winux::rust2::run_command
("sleep", ctx.raw_args) call; the strtod duration parse / Sleep() wait
pipeline (sleep_pipeline) is deleted. ctx.raw_args passes the operands
verbatim because sleep.c parses its own argv ('sleep --' still has an
argument, the argc == 1 test).

Gates: run-gate.sh sleep 24/24 green library-side and with
RUST_BIN=wired product exe, CPP_BIN=baseline exe. cmd-matrix.sh sleep
17/17 rc+stdout+stderr byte-equal old vs new, GNU rc oracle matches every
row (durations, invalid suffixes, options, --, empty, mixed operands).
ctest slice sleep 12/12.
The unlink wiring (#1488 wave2a) must be byte-equal to the old C++ body,
whose failure text came from describe_unlink_failure +
win32_posix_error_text(invalid_name_as_missing) (src/commands/unlink.cpp,
src/utils/win32.cppm). Replicate the chain in describe_unlink_failure:
directory bit first (GetFileAttributesW semantics via symlink_metadata,
attributes probed with trailing separators stripped per
operand_target_attributes_w/#1052), then glob metachars (* ? [) mean the
literal name is missing, then the Win32 code table (2/3/123 -> ENOENT,
5 -> EACCES, 267 -> ENOTDIR, 87 -> EINVAL). unlink("") is ENOENT without
touching the cwd (resolve would anchor it at ctx.cwd); a trailing-separator
operand naming a non-directory pre-checks ENOTDIR like the 1.x body and
GNU (probed: 'unlink f//' -> Not a directory, 'unlink .' -> Is a
directory, 'unlink missing//' -> No such file or directory, WSL coreutils
9.4).

Rust-side probe evidence: std::fs::symlink_metadata rejects trailing
separators outright (os error 123/2), so the strip-before-probe helper
probe_path is required for both the pre-check and the describe chain.
Unit tests added for all five classes; crate suite 264/264.
Mechanical replacement per rust2/REPLACEMENT-RECIPE.md: REGISTER_COMMAND
metadata byte-identical; handler body becomes one winux::rust2::run_command
("unlink", ctx.raw_args) call; the DeleteFileW/RemoveDirectoryW removal
pipeline with its glob expansion and error mapping is deleted (the error
mapping moved to the rust2 side in the parent commit). ctx.raw_args passes
the operands verbatim because GNU unlink.c parses its own argv (exactly one
literal operand, no options). The WINUXCMD_RUST2_COMMANDS entry rides the
sleep commit's line edit.

unlink_wildcard_multiple_matches_reports_extra_operand_help_hint asserted
the deleted 1.x glob-expansion path; unlink.c:94 main treats argv operands
literally (WSL coreutils 9.4 probed: 'unlink *.txt' with matches present
-> rc 1, 'No such file or directory'), and the old exe itself stays literal
whenever a shell owns glob expansion (measured via shell_owns_glob_expansion
under Git Bash and in the matrix). The test is renamed to
unlink_wildcard_multiple_matches_stays_literal_gnu_semantics and asserts
the GNU bytes.

Gates: run-gate.sh unlink 22/22 green library-side and with RUST_BIN=wired
product exe, CPP_BIN=baseline exe. cmd-matrix.sh unlink 21/21 rc+stdout+
stderr byte-equal old vs new (including the wildcard-operand rows w1/w*/w?1
and trailing-separator reg//), GNU rc oracle matches every row. ctest slice
unlink 11/11.
Mechanical replacement per rust2/REPLACEMENT-RECIPE.md: REGISTER_COMMAND
metadata byte-identical; handler body becomes one winux::rust2::run_command
("hostname", ctx.raw_args) call; the Winsock lookup, the #1526 -F/--file
read_file/set_name/check_name pipeline and the Debian usage table are
deleted. ctx.raw_args passes the operands verbatim because hostname.c
main() parses its own option run (net-tools rejection, -F operand
conflict, set-operand errors).

The rust2 side gains the dispatcher canonicalization the C++ scan relied
on: a registered long spelling (--short) sets ctx.has("-s") too, so the
net-tools rejection reports the short-form message for both spellings,
scanned in the C++ unsupported[] table order.

Gates: run-gate.sh hostname 22/22 green (5 GNU-gated + 17 win) with
RUST_BIN=wired product exe, CPP_BIN=baseline exe; hn19-help/hn20-version
demoted strict->win per the nproc np10/np21 precedent — the dispatcher's
branded sole --help/--version interception runs before the handler and is
byte-identical old vs new (matrix rows 04/05). cmd-matrix.sh hostname
29/29 rc+stdout+stderr byte-equal old vs new (--help/--version/-h/-V,
--file spellings incl. =value, -F with missing/invalid/operand-conflict
file, -sF bundled value, --). GNU rc oracle: 15/29 rows differ by the
documented Debian-vs-product class (Debian hostname ACCEPTS the net-tools
set and sets from -F as root; the product rejects them and validates
only) — already classified win in hostname.tsv, explained by the module
header. ctest slice hostname 11/11.
Mechanical replacement per rust2/REPLACEMENT-RECIPE.md: REGISTER_COMMAND
metadata byte-identical; handler body becomes one winux::rust2::run_command
("uname", ctx.raw_args) call; the RtlGetVersion/GetNativeSystemInfo value
pipeline (uname_pipeline) is deleted. ctx.raw_args passes the operands
verbatim because coreutils uname.c parses its own option run (extra
operand, #1215). The Rust implementation already models the 1.x C++
Windows value matrix, so gate c holds byte-for-byte.

Gates: run-gate.sh uname 22/22 green (4 GNU-gated + 18 win) with
RUST_BIN=wired product exe, CPP_BIN=baseline exe; un17-help/un18-version
demoted strict->win per the nproc np10/np21 precedent — the dispatcher's
branded sole --help/--version interception runs before the handler and is
byte-identical old vs new (matrix rows 16/17). cmd-matrix.sh uname 24/24
rc+stdout+stderr byte-equal old vs new (all nine flags, obsolescent
--sysname/--release aliases, -snrvm bundle, --, extra operands); GNU rc
oracle matches every row. ctest slice uname 6/6.
Mechanical replacement per rust2/REPLACEMENT-RECIPE.md: REGISTER_COMMAND
metadata byte-identical; handler body becomes one winux::rust2::run_command
("id", ctx.raw_args) call; the OpenProcessToken/LookupAccountSidW identity
pipeline (id_pipeline) is deleted. ctx.raw_args passes the operands
verbatim because coreutils id.c parses its own option run (only-name/
real-ID conflicts, USER operand resolution). The Rust implementation
already models the 1.x C++ Windows value matrix (SID ids, #1024 nameless
None group), so gate c holds byte-for-byte.

Gates: run-gate.sh id 22/22 green (8 GNU-gated + 14 win) with RUST_BIN=
wired product exe, CPP_BIN=baseline exe; id18-help/id22-version demoted
strict->win per the nproc np10/np21 precedent — the dispatcher's branded
sole --help/--version interception runs before the handler and is
byte-identical old vs new (matrix rows 14/15). cmd-matrix.sh id 25/25
rc+stdout+stderr byte-equal old vs new (-u/-g/-G/-n/-r forms and combos,
-a/-Z/-z/--zero, USER operand, --, conflicts). GNU rc oracle: 24/25 rows
match; row 20 (id <current-windows-user>) is the documented Windows value
model (GNU has no such POSIX user -> rc 1; the product resolves the
account and re-prints rc 0), classified win in id.tsv. ctest slice id
14/14.
Mechanical replacement per rust2/REPLACEMENT-RECIPE.md: REGISTER_COMMAND
metadata byte-identical; handler body becomes one winux::rust2::run_command
("getconf", ctx.raw_args) call; the Windows variable table (#1134 ARG_MAX,
MAX_PATH, SYSTEM_INFO page/CPU/memory values) is deleted. ctx.raw_args
passes the operands verbatim because glibc getconf parses its own option
run (-a, -v SPEC, pathconf form). The Rust implementation models the same
1.x C++ value table, so gate c holds byte-for-byte.

Gates: run-gate.sh getconf 23/23 green (5 GNU-gated + 18 win) with
RUST_BIN=wired product exe, CPP_BIN=baseline exe; gc19-help/gc23-version
demoted strict->win per the nproc np10/np21 precedent — the dispatcher's
branded sole --help/--version interception runs before the handler and is
byte-identical old vs new (matrix rows 15/16). cmd-matrix.sh getconf:
26/26 rc + 26/26 stderr byte-equal old vs new; 23/26 stdout — rows 10/12/
13 (AVPHYS_PAGES, -a) drift between ANY two runs because
GlobalMemoryStatus available-pages is volatile: the old exe itself
printed 9090647 then 9316913 minutes later; every other table line is
byte-identical. GNU rc oracle diffs are the documented Windows-value-
model class (glibc rejects the Windows table names with rc 2; glibc's
pathconf-on-missing-path rc 3 vs the deliberate C++ existence check rc
1) — classified win in getconf.tsv, explained by the module header.
ctest slice getconf 4/4.
Record the wave2a product-surface case-table changes (help/version rows
demoted strict->win on the wired exe: hn19/20, un17/18, id18/22, gc19/23),
the hostname dispatcher-canonicalization and unlink Windows failure-text
chain, and the per-command three-gate results with the gate/wire matrix
byte-parity line (getconf AVPHYS_PAGES volatility explained).
The mechanical replacement deletes the C++ bodies of whoami/nproc/
unlink/sleep/hostname/uname/id/getconf, so their source strings are no
longer produced by the extraction: 23 keys disappear from the source
catalog (verified by diffing i18n_batch.extract on origin/main vs this
branch - all 23 belong to the eight wired bodies, e.g. 'sleep: missing
operand', 'unlink: missing operand', 'id: cannot get process identity',
'getconf: no variable specified'; zero keys added). The zh-CN catalog
now carries 21 of their legacy.* strings plus
command.sleep.error.invalid_interval as standing 'extra' drift, exactly
like the #1547/#1561/wave3b wiring precedents; two previously recorded
'missing' drifts (legacy.9b28a3702b3d6726 hostname, legacy.c9d02dd126c4a836
name too long) resolve as a side effect. No new diagnostics are
introduced: new-exe messages ride the rust2 bridge and are GNU-shaped.

Recorded via check_i18n_drift.py --update-baseline after local
confirmation: the same check against the published catalogs is green on
origin/main (e466808) and red only on this branch.

Ref: #1488 (wave2a wiring)
…rity)

The mechanical wiring deleted the 1.x remove_unlink_target branch
(src/commands/unlink.cpp:48) along with the body, leaving a plain
remove_file: a directory symlink operand now hits DeleteFileW-class
rejection and reports 'Is a directory' with the link left in place,
regressing the pre-existing unit test
unlink.unlink_directory_symlink_removes_link_only_if_available
(CI x64-default red, run 42971175302 job 130359757959: exit 1,
stderr non-empty, link still exists). unlink(2) removes the symlink
entry itself, never the target.

remove_unlink_target restores the 1.x invariant ordering:
- reparse point + directory bit -> RemoveDirectoryW (remove_dir),
  which unlinks the link without following it;
- read-only regular file -> pre-clear FILE_ATTRIBUTE_READONLY first
  (DeleteFileW refuses what unlink(2) accepts, coreutils unlink.c
  cited at src/commands/unlink.cpp:56-58);
- everything else -> remove_file.
Non-Windows keeps plain remove_file (remove_file *is* unlink(2)).

Verified locally on the CI-mirrored build (x64 Release, rust2 ON,
FETCHCONTENT pcre2 from a proxy-fetched copy): ctest -R unlink 11/11
including the previously failing #3443, full winux-cmds cargo suite
338/338, wired-exe probes unlink a junction (rc 0, link gone, target
and payload intact) and a read-only file (rc 0).

Ref: #1488 (wave2a wiring)
@caomengxuan666

Copy link
Copy Markdown
Member Author

CI status after the sync-with-main push (83c8f46..1e55930):

@caomengxuan666

Copy link
Copy Markdown
Member Author

Follow-up on this push's re-run (43023400662/43023400676): i18n-drift, oracle, baseline-growth, compare and all build legs so far are green — the two wave2a reds are fixed. The remaining baseline red is inherited from main, not this PR: main's own run on the wave3b merge (e466808, run 43018585227, job 130515784544, 2026-11-11T12:19Z — before this push) fails the gate with the identical 5 cases, all timeout EXIT_DIFF (corpus/timeout/01-02-03, regressions/73-74): subject rc=127, timeout: failed to run command 'echo'/'sleep': No such file or directory, i.e. the wave3b timeout wiring's childproc-shaped resolve does not find bare echo/sleep on the CI runner's PATH. On a clean machine there is no product on PATH to satisfy it (locally the same runner passes 6/6 only because a WinuxCmd install supplying usr/bin/{echo,sleep,timeout}.exe happens to be on PATH — verified on Ubuntu-24.04.4 WSL, GNU_BIN=/usr/bin). Note for the wave3b owner: pre-wiring runs passed because the old C++ timeout rode the same shared childproc contract plus whatever PATH the runner had; the wired resolve needs the dispatcher-own-children fallback (build dir prepended by runner.sh:378 holds only winuxcmd.exe, no entry links, WINUXCMD_PACKAGE_EDITION=default).

@caomengxuan666

Copy link
Copy Markdown
Member Author

Second follow-up — build-windows (x64 default) on this push (job 130531939891): the unlink family is green now (26 unlink tests incl. #3443 absent from the failure list; i18n-drift, oracle, compare, baseline-growth, arm64×2, x64-full all pass). The leg still fails on the same main-inherited wave3b timeout regression as baseline: 25 failures, byte-identical to main's own job on the wave3b merge (130515784819, run 43018585303, e466808) — childproc.timeout_* ×3 + timeout.timeout_* ×22, all children failing to resolve (true/sleep/cmd not found on the CI runner's PATH; no product install or entry links there, WINUXCMD_PACKAGE_EDITION=default). Plus one pgrep_inverse_excludes_matches failure unique to this run's parallel/serial timing (passes locally and on main's job — load flake, unrelated to the wave2a diff, which touches only rust2/crates/winux-cmds/src/unlink.rs + scripts/i18n-drift-baseline.json). Summary: both wave2a reds are fixed with local CI-mirrored verification; every remaining red on this branch reproduces byte-identically on main tip itself (wave3b timeout child resolution on clean machines), so it needs the wave3b owner's decision (dispatcher-own-children fallback vs entry-link materialization for wired timeout), not a wave2a patch.

@caomengxuan666
caomengxuan666 merged commit 8236d59 into main Nov 11, 2026
13 of 14 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-wave2a 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