Repository navigation
#1488 wiring-follow-up GNU regressions - #1571
Closed
caomengxuan666 wants to merge 31 commits into
Closed
caomengxuan666 wants to merge 31 commits into
caomengxuan666 wants to merge 31 commits into
Conversation
…rs (#1488) run_command keeps its wave3b shape untouched (declared-reader name list: expand/join/numfmt/tsort/unexpand). Wave3a's stdin readers are CONDITIONAL: tee always; paste/fold/fmt only when there is no file operand or a "-" operand (GNU paste.c:205-215, fold.c:66-77, fmt.c operand walk); ln only when -i/--interactive may prompt (prompt(), ln.c). A name in the declared set would slurp fd 0 on EVERY invocation of the name — `paste f1 f2` from a console would block on EOF where GNU never reads stdin — so the wiring site's per-invocation knowledge needs its own entry. run_command_with_stdin slurps fd 0 through the same one Windows read path the declared readers use (file_io::read_all_stdin: console VEOF ^Z/^D observation, binary mode, broken-pipe EOF), then hands the v1 whole buffer to the shared run_common body. Whole-buffer = slurp-then-run, the accepted v1 tradeoff; streaming stdin (winuxcmd_run_stream, ABI v2) stays the long-term replacement (rust2/REPLACEMENT-RECIPE.md §5). Refs #1488 (wave3a wiring)
…BOOLEAN read (#1488) Two wave3a wiring-gate findings: 1. to_epoch()/from_epoch() used 11,644,473,600,000,000 as the Unix-epoch FILETIME delta; the constant is 116,444,736,000,000,000 (11,644,473,600 s x 10^7 ticks). Round-trips inside the crate canceled the error, so #1560's value-shape tests passed while any CROSS-component epoch value (stat -c %X/%Y of a file touched with -d @seconds) was 10x off. touch matrix row 08 (-d:@1767225600) vs stat -c %X surfaced it at wiring time. 2. CreateSymbolicLinkW returns BOOLEAN (winnt.h: UCHAR, 1 byte), not BOOL (windef.h: int, 4 bytes, like every other function in the block). With an i32 declaration Rust reads the full EAX whose upper bits are undefined for a sub-register return on x64 — a refusal (AL = 0) could masquerade as success and create_hard_link-style retry logic would treat a failed -s creation as created. Declared u8; every BOOL function stays i32. Unit tests: fs_win round-trip (to_epoch(from_epoch(x)) == x) and the 2026-01-02 03:04:05 fixture now assert real epoch values. Refs #1488 (wave3a wiring gate)
… bare-hour -d (#1488) All shapes probed against coreutils 9.4 under WSL (script files, 2026-11-11, rust2/target/gate/w3a/probe/touch-precedence*.sh) while re-deriving the case classification for the wiring: - -t parses INLINE at its argv position: `touch -t garbage --bogus` reports the stamp, not the later bogus option (GNU getopt processes -t's argument when the option is seen). Previously the bad stamp surfaced only after the whole argv walk. - -t combined with any other time source (-d or -r) is "cannot specify times from more than one source" + Try line, checked BEFORE the reference stat (`-r missing -t ok` reports the multi-source error, not the stat failure). touch.c:144-151 stoneskip: the check runs right after getopt, before stat_ref. - -d + -r together is LEGAL: the -d time applies to both fields (probed: rc 0, the mtime equals the -d value, not the reference's). - The reference stat happens before the -d parse and before the missing-operand check (`-r missing -d garbage` reports the stat failure; `-d garbage` with no operands reports the date; `-d ok` reports the operand). - -f is a silently ignored BSD-compat option (probed rc 0; previously "invalid option"). - -d bare hour ("2026-05-06 07") is valid GNU parse-datetime (probed rc 0, 07:00) — accepted. - An explicit -d/-t time wins over -r for both fields; -r alone copies BOTH times from the reference. Unit tests extended for each rule (touch.rs tests). Refs #1488 (wave3a wiring gate)
…file rule (#1488) GNU-probed (coreutils 9.4, WSL script files, 2026-11-11) while re-deriving the ln case rows for the wiring: - --relative/-r: requires --symbolic (ln.c:571-572, bare "ln: cannot do --relative without --symbolic", no Try hint, checked right after the option walk before missing-operand validation); -rs computes the target relative to the destination directory. - A missing SOURCE with -s creates the symlink DANGling (GNU never touches SOURCE for -s, rc 0); hard links keep the "failed to access 'X'" report. - Destinations GNU derives by joining a directory (dir target, -t, the one-operand "." rule) skip the same-file pre-check: `ln f` attempts the link and reports "failed to create hard link '.\f': File exists" while `ln f f` reports "'f' and 'f' are the same file" (probed both). The link_one helper carries a dst_inferred flag from every call site. - ln23-sf-replace re-derived win -> note in the gate table (recipe §4: promote/re-derive once the premise is gone): its -sf replace IS a symlink creation, so on a non-Developer-Mode host even the wired exe refuses and only C++ parity gated the row before. Unit tests: relative_requires_symbolic (order check: `-r` alone errors with the relative message, not the operand one), dangling -s, inferred-dst EEXIST wording. Refs #1488 (wave3a wiring gate)
…le (#1488) GNU-probed (coreutils 9.4 on DrvFs under WSL + the 1.x exe matrix, 2026-11-11) while re-deriving the stat rows for the wiring: - `stat -c %C` on a context-less volume FAILS the entry: rc 1 with "?" on stdout and the stderr note (probed rc 1; #1560 recorded GNU rc 0 — the old row premise was wrong; the 1.x C++ rc stays the recorded divergence). render_format now returns whether a field failure occurred and the driver folds it into the status. - The default (no -c/-t) layout renders through a dedicated function byte-aligned with the 1.x C++ renderer AND coreutils 9.4 on DrvFs: unquoted " File: <name>[ -> <target>]", Size/Blocks/IO Block padding 10/10/6, "Device: <volume-serial>,0", inode padded to 11, single-space "Links:". The old concat!() DEFAULT_FORMAT quoted the name and printed the GNU /proc-style "Dh/%dd" device, which matches NEITHER side. - The -t terse format loses its embedded "\n": GNU appends the terminating newline once after a -t/-c render (probed: `stat -t f` ends in exactly one \n; `stat -c '%n\n'` keeps the escape pair literal and STILL appends a real newline — the append is unconditional), so a format-internal newline would double it. - stat -f with an explicit -c/--printf/-t format goes through the GNU FS directive table (stat.c fs_use_format): %n/%i/%l/%t/%T/%s/%S/%b/%f/%a/ %c/%d over the volume facts; %c/%d are 0 (Windows volumes expose no inode counts), %t prints 0. The default -f shape keeps the 1.x layout. Unit tests realigned (stat-def shape, %C rc). Refs #1488 (wave3a wiring gate)
) Probed coreutils 9.4 at wiring time: `fmt missing` prints fmt: cannot open 'missing' for reading: No such file or directory (quotef quoted), the rust2 library printed the bare name. Test realigned. Refs #1488 (wave3a wiring gate)
…iring (#1488) The wiring gates (gate b) surfaced six ctest regressions against the shipped 1.x corpus: the #1560 parser subset was too narrow and the operand handling lacked three direct-invocation behaviors. Every extension below is probed against coreutils 9.4 (WSL script files, 2026-11-11, rust2/target/gate/w3a/probe/t-*.sh) and cited to the owning GNU code: - -d grammar: compact YYYYMMDD[HHMM[SS]] (probed rc 0 all three), loose single-digit fields ("2026-6-7"), slash dates ("2026/05/06 07:08"), ISO basic "THHMM[SS]" ("T1430"), military zone letters ("1430Z", "9:30j", parse-datetime.y military_table, 'T' excluded), weekday items ("monday", "next monday", "last friday" — issue #1382), relative items ("3 days ago", "+2 hours", "1 fortnight" = 14 days, month/year calendar shifts with GNU's forward day-roll: Mar 31 - 1 month = Mar 3, probed, NOT Feb 28), combined "<base> <relative item>" ("2026-03-31 1 month ago"), and now/today/yesterday/tomorrow. - -r + -d anchors the string per field: the reference ATIME bases the atime parse and the reference MTIME the mtime parse (touch.c:354-360; probed `-r ref -d '+1 day'` lands a day past each reference stamp). Absolute strings parse to the same value either way. - Operands: '-' retimes standard output (POSIX; touch.c:127-128; the module doc's "plain file name" claim was wrong twice over); wildcard operands glob over the named directory like the 1.x utils glob (POSIX matcher, leading-dot blocks, unmatched pattern stays literal — GNU glob default); trailing separators carry GNU's setting-times diagnostics ("setting times of 'f.txt/': Not a directory" on a regular file probed byte-for-byte, ENOENT on a missing path, rc 0 on a directory); the win32_reason table gains ERROR_DIRECTORY=267 -> "Not a directory" for it. - fs_win::api_path folds literal colons in a final component onto the U+F03A carrier (#1283; the 1.x native_path fold_carrier_colons_w, the one-operand-boundary ruling): "D:name" now spells the literal carrier file in the cwd uniformly across every rust2 applet instead of Win32 drive-relative resolution. tests/unit/touch realigned where it encoded the 1.x wording (trailing separator); the other five regressions are pure behavior the lib now matches. winux-cmds lib tests: 339 green. Refs #1488 (wave3a wiring gate)
Mechanical replacement per rust2/REPLACEMENT-RECIPE.md: the 1175-line
C++ body (getopt walk, GNU date parser, SetFileTime pipeline, glob
expansion) is deleted; REGISTER_COMMAND metadata stays byte-identical;
the handler is one winux::rust2::run_command("touch", ctx.raw_args)
call. touch is appended to WINUXCMD_RUST2_COMMANDS.
Three gates (baseline exe = e466808 build kept as
target/gate/wire/baseline/winuxcmd.exe; baseline ctest fail set saved at
target/gate/wire/baseline-ctest-fails.txt, 20 pre-existing failures):
- gate a (GNU oracle): RUST_BIN=wired exe, run-gate.sh touch — 28 strict
rows byte/rc-equal to GNU + 1 win row, all pass (29-case table).
- gate b: ctest -R touch 21/21 (the two trailing-separator tests are
realigned to the GNU-probed "setting times of '<op>': <reason>"
wording — the 1.x "cannot touch" wording was the recorded divergence,
probed coreutils 9.4 `touch f.txt/` / `touch nope/`; 2026-11-11).
- gate c (old vs new exe byte matrix, cmd-matrix.sh + compare.sh, 26
rows + GNU rc ledger from WSL): old-vs-new rc/stdout/stderr 24/26 —
rows 07/18 (-d 'YYYY-MM-DD HH:MM:SS' with the space separator) are the
old exe wrongly rejecting a GNU-accepted form (old rc 1, GNU rc 0,
wired rc 0 empty stderr); every other row is byte-identical.
The wiring surfaced the library gaps fixed in the preceding commits:
FileTime epoch constant, -d grammar, per-field -r anchoring, operand
glob/'-'/trailing-separator, and the #1283 carrier-colon fold in
fs_win::api_path.
Issue: #1488
… boundary (#1488) Wiring-gate findings (gate b/c) on the shipped 1.x corpus, fixed before the ln wiring commit per the recipe. Every change cites its owner: - fs_win::api_path (the one operand boundary, like the 1.x native_path.cppm ruling) now runs the full fold chain: POSIX drive prefixes (/cygdrive/d/, WSL interop /mnt/d/ -> /d/, #1145/#1172), the MSYS drive dialect (/d/... -> D:\\...), the #1283 carrier-colon fold (U+F03A), and a lexical collapse of "." components — the \\?\ prefix gets no NT normalization, so a caller-spelled ".\name" joined against the cwd reached CreateHardLinkW as "...\.\name" and failed ERROR_INVALID_PARAMETER. ".." stays untouched, as in the 1.x. - ln.rs: resolve() routes EVERY operand through api_path (the dialect fold previously reached only file_meta while symlink_metadata and the copy fallback used raw PathBuf spellings); basename_of splits on both separators (`ln sub\source.txt` linked ".\sub\source.txt" onto itself); join_lex joins derived destinations with the native separator ("dest\a.txt", the -v byte-parity shape the corpus pins); WINUX_LN_FALLBACK=copy keeps the #1491 opt-in downgrade (privilege- failed -s on a regular-file source becomes a silent copy; dangling and directory sources keep the GNU refusal); destination removal goes through DeleteFileW (fs_win::delete_file) because std::fs::remove_file silently clears the read-only attribute and would unlink the exact case the corpus pins — `ln -f original link.txt` with a readonly link.txt refuses "ln: failed to remove 'link.txt': Permission denied" rc 1 (GNU-on-Windows/MSYS shape, probed coreutils 9.4, 2026-11-11); the attempted-and-failed removal is RemoveOutcome::RemoveFailed, distinct from the no--f File-exists refusal. winux-cmds lib tests: 339 green. Refs #1488 (wave3a wiring gate)
Mechanical replacement per rust2/REPLACEMENT-RECIPE.md: the 817-line C++
body (CreateHardLinkW / CreateSymbolicLinkW pipeline, -i prompt machine,
backup walk) is deleted; REGISTER_COMMAND metadata stays byte-identical;
the handler is one winux::rust2::run_command("ln", ctx.raw_args) call —
except when -i/--interactive may prompt (prompt(), ln.c reads the answer
from fd 0), where run_command_with_stdin forwards the v1 whole buffer.
ln is appended to WINUXCMD_RUST2_COMMANDS.
Three gates (baseline exe = e466808 build at
target/gate/wire/baseline/winuxcmd.exe; baseline ctest fail set =
target/gate/wire/baseline-ctest-fails.txt, 20 pre-existing failures):
- gate a (GNU oracle): run-gate.sh ln with the wired exe as RUST — 24
strict rows byte/rc-equal to GNU + 1 win row, all pass. The -s
creation rows are record-only notes (Developer-Mode-bound on Windows;
this host lacks the privilege, where the wired exe refuses like the
1.x build — the fs_win create_symlink ALLOW_UNPRIVILEGED_CREATE retry
matches GNU rc 0 wherever the capability exists, the recorded
behavior change vs the 1.x refusal).
- gate b: ctest -R "^ln\." 29/29 (four corpus regressions fixed in the
library commits: drive dialect, #1491 fallback, operand-boundary
resolution, readonly-remove semantics; no test was realigned).
- gate c (old vs new exe byte matrix, cmd-matrix.sh + compare.sh, 25
rows in isolated per-side scratch cwds; GNU rc ledger from WSL):
old-vs-new rc 25/25, stdout 25/25, stderr 25/25 — byte-identical on
every row including the -s refusal rows.
Issue: #1488
…capes (#1488) Wiring-gate (gate b) findings on the shipped 1.x corpus — six ctest regressions, every fix cited: - stat.rs resolve() routes every operand through fs_win::api_path (the one boundary): the drive-dialect folds fix /cygdrive/x/ and /mnt/x/ operands, and the new shell-tree fold (1.x shell_tree_to_native_w) resolves remaining "/"-prefixed operands through the configured shell root (__RUBASH_SHELL_ROOT / NIU_ROOT / WINUXSH_ROOT / RUBASH_ROOT) with the MSYS open order's .exe-leaf retry ("/usr/bin/seq" -> seq.exe). - fold_posix_drive_prefix rebuilt the MSYS spelling as "/{drive}{tail}" and ate the separator ("/d/repo" came back as "/drepo"); the fold now prefixes rest — which already carries "<d>/<tail>" — with "/". A probe test pins all three spellings (cygdrive, /mnt, bare dialect) through api_path. - Direct-invocation glob for wildcard operands: the touch.rs glob helpers move to the shared winux_cmds::glob module (1.x utils wildcard.cppm contract: POSIX matcher, leading-dot blocks, '.'/'..' never match, unmatched pattern stays literal) and stat gains the same operand expansion. - [GNU] stat.c keeps -c/--printf/--format in ONE format slot (last assignment wins: probed `--printf %n -c %s` -> size, `-c %s --printf %n` -> name) and -t as an independent flag an explicit format beats regardless of order (probed `-c %n -t` -> name); printf_escapes records whether the winning assignment was --printf. - [GNU] --printf interprets octal \NNN (1-3 digits) and hex \xHH in addition to the simple escapes (probed: '%n\t\011\010\x41' -> name, tab, tab, backspace, 'A'). winux-cmds lib tests: 340 green. Refs #1488 (wave3a wiring gate)
Mechanical replacement per rust2/REPLACEMENT-RECIPE.md: the 1320-line
C++ body (GNU directive table, -f volume query, terse/default renderers)
is deleted; REGISTER_COMMAND metadata stays byte-identical; the handler
is one winux::rust2::run_command("stat", ctx.raw_args) call. stat is
appended to WINUXCMD_RUST2_COMMANDS.
Three gates (baseline exe = e466808 build at
target/gate/wire/baseline/winuxcmd.exe; baseline ctest fail set =
target/gate/wire/baseline-ctest-fails.txt, 20 pre-existing failures):
- gate a (GNU oracle): run-gate.sh stat with the wired exe as RUST —
11 strict rows byte/rc-equal to GNU + 11 win rows, all pass
(22-case table; device/inode values are platform-bound and win-gated).
- gate b: ctest -R "^stat\." 23/23 (six corpus regressions fixed in the
library commit: shell-tree + drive-dialect operand resolution,
wildcard operands, last-wins -c/--printf/--format slot, octal/hex
--printf escapes; no test was realigned).
- gate c (old vs new exe byte matrix, cmd-matrix.sh + compare.sh, 28
rows in isolated per-side scratch cwds; GNU rc ledger from WSL):
old-vs-new rc 28/28, stderr 28/28, stdout 26/28 — the two stdout rows
(01/02) differ only in the run-instant fields (Inode file index,
Change/Birth stamps of the freshly recreated fixture); an OLD-vs-OLD
rerun of the identical baseline exe shows the same 26/28, so the
fields are unstable identically on both sides and the replacement
changes nothing (GATE-REPORT wave3a note).
Issue: #1488
…1488) The seq wiring gates (issue1368 corpus tests) surfaced the v1 blind spot: the ABI buffers stdout, so a write failure surfaces at the boundary drain, not inside the library. GNU owns the same reporting at its global close_stdout hook, so the boundary implements the same contract, probed coreutils 9.4 (2026-11-11, w3a/probe/closed-stdout.sh): - a command that PRODUCED stdout bytes against a closed fd 1 reports "<name>: write error: Bad file descriptor" and fails rc 1 (`seq 10000000 >&-` -> rc 1 with that line); - a command that wrote nothing stays silent with its own status (`true >&-` -> rc 0). Broken-pipe write failures stay with the streaming v2 ABI (recipe §5); the closed-fd EBADF shape is what the corpus pins. Refs #1488 (wave3a wiring gate)
Mechanical replacement per rust2/REPLACEMENT-RECIPE.md: the 695-line C++
body (arbitrary-precision integer fast path, long-double loop, format
engine) is deleted; REGISTER_COMMAND metadata stays byte-identical; the
handler is one winux::rust2::run_command("seq", ctx.raw_args) call.
seq is appended to WINUXCMD_RUST2_COMMANDS.
Three gates (baseline exe = e466808 build at
target/gate/wire/baseline/winuxcmd.exe; baseline ctest fail set =
target/gate/wire/baseline-ctest-fails.txt, 20 pre-existing failures):
- gate a (GNU oracle): run-gate.sh seq with the wired exe as RUST —
50 strict rows byte/rc-equal to GNU, all pass.
- gate b: ctest -R "^seq\." 37/37 (the two issue1368 closed-stdout
regressions are the bridge close_stdout contract commit, not a seq
behavior change).
- gate c (old vs new exe byte matrix, cmd-matrix.sh + compare.sh, 25
rows in isolated per-side scratch cwds; GNU rc ledger from WSL):
old-vs-new rc 25/25, stdout 25/25, stderr 24/25 — row 19 (-f '%!d')
is the old exe's spurious "Try 'seq --help'" tail on the unknown-%!
diagnostic; GNU probed carries the bare line (w3a/probe/seq19.sh) and
the wired exe matches it byte-for-byte. new-vs-GNU rc oracle: 25/25.
Issue: #1488
…1488) Probed coreutils 9.4 (2026-11-11, w3a/probe/tee-open.sh): tee's fail_output quotes the operand with quotef, which leaves a plain name UNQUOTED — "tee: missing-dir/output.txt: No such file or directory" rc 1, stdout and the surviving outputs keep flowing. The 1.x always-quoted spelling was the recorded divergence; the rust2 library matches GNU and this corpus test is realigned to it (the separator stays the operand's own spelling on Windows). Refs #1488 (wave3a wiring gate)
Mechanical replacement per rust2/REPLACEMENT-RECIPE.md: the 267-line C++
body (output-error mode machine, sink lifecycle) is deleted;
REGISTER_COMMAND metadata stays byte-identical; the handler is one
winux::rust2::run_command_with_stdin("tee", ctx.raw_args) call — tee
always reads stdin, so the v1 whole-buffer entry carries it (the #973
closed-stdin EBADF probe is not representable in ABI v1 and stays with
the streaming v2 adoption). tee is appended to WINUXCMD_RUST2_COMMANDS.
Three gates (baseline exe = e466808 build at
target/gate/wire/baseline/winuxcmd.exe; baseline ctest fail set =
target/gate/wire/baseline-ctest-fails.txt, 20 pre-existing failures):
- gate a (GNU oracle): run-gate.sh tee with the wired exe as RUST —
22 strict rows byte/rc-equal to GNU + 2 win rows, all pass.
- gate b: ctest -R "^tee\." 12/12 (the open-failure diagnostic test is
realigned to the GNU unquoted quotef name, separate test commit).
- gate c (old vs new exe byte matrix, cmd-matrix.sh + compare.sh, 19
rows in isolated per-side scratch cwds; GNU rc ledger from WSL):
old-vs-new rc/stdout/stderr 19/19 byte-identical. new-vs-GNU rc
oracle: 19/19.
Issue: #1488
…ary (#1488) Wiring-gate (gate b) finding on the shipped 1.x corpus (paste_reports_is_a_directory_for_directory_input): GNU probed coreutils 9.4 (2026-11-11, w3a/probe/paste-dir.sh) — `paste indir` fails "paste: indir: Is a directory" rc 1 (the read of an opened directory is EISDIR on POSIX). Windows fails the OPEN with ERROR_ACCESS_DENIED before any read, so the rust2 side mapped it to "Permission denied"; the directory attribute now supplies the POSIX shape for that case. paste's operand open also routed through fs_win::api_path — the one boundary every other wired applet uses (drive dialect, carrier colons, shell tree), replacing the raw cwd join. winux-cmds lib tests: 340 green. Refs #1488 (wave3a wiring gate)
Mechanical replacement per rust2/REPLACEMENT-RECIPE.md: the 387-line C++
body (parallel/serial delbuf pipelines) is deleted; REGISTER_COMMAND
metadata stays byte-identical; the handler is one
winux::rust2::run_command_with_stdin("paste", ctx.raw_args) when the GNU
shape reads stdin (no file operand or a "-" operand; paste.c:205-215) —
every other shape takes run_command and never touches fd 0. paste is
appended to WINUXCMD_RUST2_COMMANDS.
Three gates (baseline exe = e466808 build at
target/gate/wire/baseline/winuxcmd.exe; baseline ctest fail set =
target/gate/wire/baseline-ctest-fails.txt, 20 pre-existing failures):
- gate a (GNU oracle): run-gate.sh paste with the wired exe as RUST —
37 strict rows byte/rc-equal to GNU + 1 win row, all pass.
- gate b: ctest -R "^paste\." 14/14 (the directory-input regression is
the library commit above).
- gate c (old vs new exe byte matrix, cmd-matrix.sh + compare.sh, 21
rows in isolated per-side scratch cwds; GNU rc ledger from WSL):
old-vs-new rc/stdout/stderr 21/21 byte-identical. new-vs-GNU rc
oracle: 21/21.
Issue: #1488
…ry (#1488) Wiring-gate (gate b) finding on the shipped 1.x corpus (fold_directory_input_reports_is_a_directory): GNU probed coreutils 9.4 (2026-11-11, w3a/probe/paste-dir.sh class) — a directory operand fails "fold: indir: Is a directory" rc 1; Windows fails the OPEN with ERROR_ACCESS_DENIED before any read, so the directory attribute supplies the POSIX shape for that case (the same mapping paste 844f23b carries). fold's operand open also routed through fs_win::api_path — the one boundary every other wired applet uses — replacing the raw cwd join. winux-cmds lib tests: 340 green. Refs #1488 (wave3a wiring gate)
…1488) GNU fold has NO -c option (probed coreutils 9.4, 2026-11-11: `fold -c -w 2` -> "fold: invalid option -- 'c'" + Try line, rc 1; the cmd-matrix -c row's GNU ledger pins rc 1). The 1.x build accepted -c as a characters-mode extension; the 2.0 replacement follows GNU and the two corpus tests are realigned to the GNU refusal (byte folding itself stays pinned by fold_default_mode_counts_bytes_for_utf8_input). Precedent: the wave3b unit-test realignments to GNU probes. Refs #1488 (wave3a wiring gate)
Mechanical replacement per rust2/REPLACEMENT-RECIPE.md: the 343-line C++
wrapper is deleted; REGISTER_COMMAND metadata stays byte-identical; the
handler is one winux::rust2::run_command_with_stdin("fold",
ctx.raw_args) when the GNU shape reads stdin (no file operand or a "-"
operand; fold.c:66-77) — every other shape takes run_command and never
touches fd 0. fold is appended to WINUXCMD_RUST2_COMMANDS.
Three gates (baseline exe = e466808 build at
target/gate/wire/baseline/winuxcmd.exe; baseline ctest fail set =
target/gate/wire/baseline-ctest-fails.txt, 20 pre-existing failures):
- gate a (GNU oracle): run-gate.sh fold with the wired exe as RUST —
26 strict rows byte/rc-equal to GNU, all pass.
- gate b: ctest -R "^fold\." 22/22 (the directory-input regression is
the library commit; the two -c tests are realigned to the GNU refusal
in the test commit).
- gate c (old vs new exe byte matrix, cmd-matrix.sh + compare.sh, 20
rows in isolated per-side scratch cwds; GNU rc ledger from WSL):
old-vs-new rc/stdout/stderr 19/20 — row 20 (-c) is the old exe
accepting a GNU-invalid option (old rc 0, GNU rc 1, wired rc 1 with
GNU's "invalid option -- 'c'" diagnostic). new-vs-GNU rc oracle:
20/20.
Issue: #1488
…ary (#1488) Wiring-gate (gate b) finding on the shipped 1.x corpus (fmt_directory_input_reports_is_a_directory): GNU probed coreutils 9.4 (2026-11-11, w3a/probe/fmt-t.sh) — a directory operand OPENS on POSIX and the read fails, so fmt reports the bare "fmt: read error" line, rc 1, no operand name and no errno text. Windows fails the OPEN with ERROR_ACCESS_DENIED; the directory attribute now routes that case to the GNU shape, while a missing file keeps the probed "cannot open 'X' for reading: <reason>" form (e2d9ee5). fmt's operand read also routed through fs_win::api_path — the one boundary every other wired applet uses — replacing the raw cwd join. winux-cmds lib tests: 340 green. Refs #1488 (wave3a wiring gate)
GNU fmt has none of -m (mail-header), -P (skip prefix), -X, -x (exact prefix) or -T (tab width) — probed coreutils 9.4, 2026-11-11 (w3a/probe/fmt-ext.sh, fmt-t2.sh): every spelling fails with "fmt: invalid option -- '<c>'" + Try line, rc 1. The 1.x build accepted them as extensions; the rust2 library already rejects them through its GNU-shaped option walk, and the five corpus tests are realigned from the extension expectations to the GNU refusals (the fold -c precedent, b4dd76a; the wave3b unit-test realignment precedent). GNU's own -p prefix form stays pinned by the remaining prefix rows. Refs #1488 (wave3a wiring gate)
Mechanical replacement per rust2/REPLACEMENT-RECIPE.md: the 1047-line
C++ cost-DP formatter is deleted; REGISTER_COMMAND metadata stays
byte-identical; the handler is one
winux::rust2::run_command_with_stdin("fmt", ctx.raw_args) when the GNU
shape reads stdin (no file operand or a "-" operand; fmt.c operand walk)
— every other shape takes run_command and never touches fd 0. fmt is
appended to WINUXCMD_RUST2_COMMANDS, completing the wave3a batch.
Three gates (baseline exe = e466808 build at
target/gate/wire/baseline/winuxcmd.exe; baseline ctest fail set =
target/gate/wire/baseline-ctest-fails.txt, 20 pre-existing failures):
- gate a (GNU oracle): run-gate.sh fmt with the wired exe as RUST —
25 strict rows byte/rc-equal to GNU + 1 win row, all pass.
- gate b: ctest -R "^fmt\." 22/22 (the directory-input regression is
the library commit; the five extension-option tests are realigned to
the GNU refusals in the test commit).
- gate c (old vs new exe byte matrix, cmd-matrix.sh + compare.sh, 22
rows in isolated per-side scratch cwds; GNU rc ledger from WSL):
old-vs-new rc/stdout/stderr 22/22 byte-identical. new-vs-GNU rc
oracle: 22/22.
Issue: #1488
…#1488) The combined wave3a gate run caught paste pa24 (win): `paste /dev/null f1` failed "paste: NUL: No such file or directory" — map_device translates /dev/null to NUL and api_path then added the \\?\ extension, under which "...\\NUL" is a literal file named NUL, not the null device. DOS device names now pass through api_path verbatim. winux-cmds lib tests: 340 green; the full 240-row wave3a ledger is green after this. Refs #1488 (wave3a wiring gate)
…1488) make-report.sh gains the wave3a section generator (the wave1/wave2/3b generators keep their committed shapes). GATE-REPORT.md records the wiring refresh under the #1560 wave3a section: 240 rows re-measured with the wired exe as rust and the e466808 1.x build as C++ — GNU-gated + win-gated all GREEN, C++ parity 230/240; per-command cmd-matrix rows (isolated per-side scratch cwds, WSL GNU rc ledger), the old-side deviations each correction fixes (touch -d space form, -t .99, seq Try tail, fold -c, fmt -m/-P/-X/-x/-T), the run-instant stat fields proven unstable old-vs-old, the ln -s note class, the corpus realignments, and the rust2-side library fixes the wiring gates surfaced. Refs #1488 (wave3a wiring)
…tes refactor + slurp helper; RUST2 command set union 36)
GNU coreutils 9.4 src/digest.c accepts a length of 0 at the -l case (xdectoumax(optarg, 0, UINTMAX_MAX, ...) at digest.c:1396) and folds it onto the algorithm default after the post-getopt validation (digest.c:1490-1494: 'if (digest_length == 0) digest_length = BLAKE2B_MAX_LEN * 8;'). The wired Rust length parser rejected 0 with a 'minimum digest length is 1 bits' diagnostic, which GNU never emits here. Probed WSL GNU coreutils 9.4: 'b2sum -l 0 f.txt', 'b2sum --length=0' and 'b2sum -l +0' print the 512-bit hex digest byte-identical to '-l 512', rc 0 (target/issue-suites/results/wc-x3/gnu-oracle-probe.out). - parse_length now returns Ok(0); the caller keeps the default bits. The unreachable TooShort variant is removed (wrong invariant, not a guard to extend). - corpus/b2sum/50-length-zero.case passes; gate b2sum 32+2 green. ref #1488
…ort) stat /dev/null (the shell boundary folds the operand to NUL) failed the ordinary snapshot twice over: the null-device handle answers no GetFileInformationByHandle (kernel32 ERROR_INVALID_FUNCTION -> win32_reason 'Operation not permitted'), so the wired Rust stat printed 'cannot statx /dev/null: Operation not permitted' where GNU reports a character special file. The 1.x C++ applet fixed exactly this in #276 (commit 258e700, src/utils/native_path.cppm is_dos_device_name_w / is_character_device_w / file_attribute_data_w): device operands take a synthesized attribute record instead of a CRT/ handle stat. Ported to the shared rust2 operand boundary (fs_win.rs): - dos_device_canonical: whole-operand recognition of the POSIX pseudo-devices (/dev/null|/dev/zero -> NUL, /dev/tty -> CONIN$) and the bare reserved names NUL/CON/PRN/AUX/CONIN$/CONOUT$/COM1-9/LPT1-9 case-insensitively; a name with a separator or extension is an ordinary file (1.x is_dos_device_name_w). map_device/api_path now route every reserved name verbatim, not just NUL. - probe_dos_device: CreateFileW open probe (GENERIC_READ, no FILE_READ_ATTRIBUTES - the null device refuses attribute-only access with ACCESS_DENIED, probed gle 5 vs a valid read-open handle). CI-assertable on NUL without any real device. - dos_device_meta: zeroed record, one link, character_device=true; existence falls back to the GetFileAttributesW gate the 1.x used. stat.rs needed no engine change: %F already ranks character special file above regular empty file and %n keeps the operand text. Probed WSL GNU coreutils 9.4: 'stat -c %F /dev/null' -> 'character special file', %n -> '/dev/null', rc 0 (gnu-oracle-probe.out). corpus stat/04-dev-null-type, 05-dev-tty-type, 06-dev-null-name pass; gate stat 11+11 green. ref #1488
Two GNU contracts the wired parser missed (coreutils 9.4 src/tee.c):
- MODE resolves through XARGMATCH over output_error_args
(tee.c:69-77, order warn/warn-nopipe/exit/exit-nopipe), i.e.
argmatch.c argmatch(): exact match wins, otherwise a unique prefix
is accepted ('warn-n' -> warn-nopipe, probed rc 0), a second prefix
match over a different value is ambiguous ('w'/'ex'/'' ->
'ambiguous argument ... for --output-error'), unknown values report
'invalid argument ...'; both print the Valid-arguments list and the
Try line through usage(EXIT_FAILURE) (argmatch.c
argmatch_invalid/argmatch_valid, probed byte-shape).
- an open failure under the exit modes carries a nonzero error status
inside the tee_files open loop (tee.c: 'error(output_error ==
output_error_exit || output_error == output_error_exit_nopipe,
errno, ...)'), which EXITS there: stdin is never read and later
operands are never opened. Probed '--output-error=exit no/dir/f
good.txt': empty stdout, good.txt not created, rc 1 (same under
exit-nopipe); warn keeps the remaining outputs flowing, rc 1.
corpus tee/06-abbreviation, 07-invalid-mode, 04-exit-open-fatal pass;
gate tee 22+2 green.
ref #1488
Member
Author
|
Superseded by #1570: the three GNU-regression fixes (b2sum -l 0, stat DOS-device probe, tee argmatch abbreviation) are on rust2/wire-wave3a together with the wiring itself — one PR, one gate run. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#1488 wiring follow-up: 4 GNU regressions exposed by the differential corpus
After the wave3a wiring, the corpus runner surfaced real Rust-side regressions against the WSL GNU coreutils 9.4 oracle. All four are fixed here on top of #1570; no corpus expectation was touched (the cases record GNU's measured behavior).
1. b2sum
-l 0(corpus/b2sum/50-length-zero)-lwithxdectoumax(optarg, 0, ...)and digest.c:1490-1494 folds 0 onto the 512-bit default post-getopt.parse_lengthreturnsOk(0); the caller keeps the default bits. The unreachableTooShortvariant was removed.b2sum -l 0 fbyte-identical to-l 512, rc 0.2. stat /dev/null (
corpus/stat/04,05,06) — #276 portGetFileInformationByHandle(ERROR_INVALID_FUNCTION -> "cannot statx '/dev/null': Operation not permitted"). The 1.x C++ applet fixed this in [gap] dd: Silent Truncate Error Suppression (uutils#9745) #276 (258e700,native_path.cppmdevice-aware attribute probes).dos_device_canonical(whole-operand /dev/null|/dev/zero -> NUL, /dev/tty -> CONIN$, bare reserved names case-insensitively),probe_dos_deviceCreateFileW open probe (GENERIC_READ; attribute-only access is ACCESS_DENIED on NUL — probed),dos_device_metasynthesized character-device record.%nkeeps the operand text;%F->character special file.stat -c %F /dev/null->character special file, rc 0.3. tee
--output-error(corpus/tee/04,06,07)warn-n-> warn-nopipe) and missing exit-mode open death (tee.c open-looperror(exit || exit_nopipe, ...)exits before stdin is read).--output-error=warn-nrc 0;w/ex/`` ambiguous;WAR/`bogus` invalid, both with the list; `exit no/dir/f good.txt` -> empty stdout, good.txt uncreated, rc 1.Verification
run-gate.sh b2sum32+2,stat11+11,tee22+2 — all green.cargo testworkspace 374 pass,cargo fmt --checkclean.