Repository navigation
WIP: fix(path): drive root forms verbatim for every drive (niubash#779 R2 cleanup) - #2458
Merged
Merged
Conversation
…9 R2) The argv funnel's root-form guard exempted drive c: `/c` and `/c/` fell through and were translated to `C:\` for native children while every other drive's root forms stayed verbatim. A root-form token is indistinguishable from a switch in the receiving program's grammar (`/c` is both the C-drive root spelling and cmd.exe's run-and-exit flag); the niubash#779 experiment round (owner ruling 2026-11-01) killed every discriminating rule — unconditional translation and the existence gate score identically on the killing rows — so root forms stay verbatim for all drives (R0), and this change deletes the drive-c exception (R2). It also closes a live data corruption: a native `tr '/c/' X` received `C:\` as its SET1 (tr is not one of the grammar-masked tools). With-components `/X/...` translation (Option B, niubash#124(b)), the legacy-dialect existence gate on the line below the guard, virtual roots, /mnt/X and /dev/null -> nul are unchanged. Spellings that still reach a drive root for a native child: `/X/.`, `/mnt/X/`, `X:/`. Pin: issue779_drive_root_forms_stay_verbatim_for_native_children — root forms verbatim for native children, with-components forms still translated (overreach guard), the tr data case. No existing test asserted the old translated root form, so no assertion was flipped. Refs: unixwin/niubash#779
caomengxuan666
marked this pull request as ready for review
November 1, 2026 09:14
SpookyWaste
pushed a commit
to SpookyWaste/rubash
that referenced
this pull request
Nov 12, 2026
…tion (audit R1) The README (EN+zh) and docs/platform-identity.md still taught the pre-unixwin#748 model: "POSIX-layer children get argv verbatim" and "a native tool gets a valid Win32 path for every operand". Current contract: drive-form operands are translated by the engine funnel for every child class (unixwin#592); native children receive Win32 spellings for classified path-shaped operands, while the bare /, drive-root forms, attached values and grammar-data operands cross verbatim (unixwin#748/unixwin#779, R2 cleanup PR unixwin#2458). Both READMEs now defer to niubash docs/src/windows-path-contract.md as the contract of record. The frozen R2 rollback sentences (__RUBASH_ARGV_DIALECT=legacy) are preserved verbatim; only the stale dialect claims around them moved.
SpookyWaste
pushed a commit
to SpookyWaste/rubash
that referenced
this pull request
Nov 12, 2026
…#779 generation (audit R6) The in-repo contract still presented the 2026-10-13 unixwin#592 model as the latest state, including the L4 absolutism "never half of one argv translated, half not". Updates: header names niubash docs/src/windows-path-contract.md as the argv-dialect contract of record; the L4 row and L4 detail bullets now carry the verbatim classes (bare /, drive-root forms, attached values, grammar data) that cross unchanged per unixwin#748/unixwin#779 (R2 cleanup PR unixwin#2458); the unixwin#592 section gains the 2026-11-01 correction note in the doc's own annotation style; the audit ledger gains the unixwin#748/unixwin#779 entry. The frozen R2 rollback clauses (__RUBASH_ARGV_DIALECT=legacy) are byte-identical to master; only the stale dialect claims moved.
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.
Refs: unixwin/niubash#779 (issue closed as R0 / documented boundary by the owner's 2026-11-01 ruling; this PR is the separately approved R2 cleanup from the same verdict).
The change — exactly one guard
In
src/executor/path.rs,external_argument_path's drive-form branch:Drive c's root forms (
/c,/c/) used to fall through the root-form guard and translate toC:\while every other drive's root forms stayed verbatim. The niubash#779 experiment round (MATRIX/CORPUS/VERDICT, mechanised scoring) proved a root-form token is indistinguishable from a switch in the receiving program's grammar —/cis both the C-drive root spelling and cmd.exe's run-and-exit flag — and that unconditional translation (R1) and the existence gate (R3) score identically DEAD on the killing rows (cmd /c,xcopy /D,robocopy /E). The owner ruled root forms verbatim for all drives (R0) and approved deleting the drive-c exception as a cleanup (R2). The deletion also closes a live data corruption the verdict surfaced: a nativetr '/c/' XreceivedC:\as its SET1 (tr is not one of the grammar-masked tools grep/sed/awk/find/basename/dirname).The comment above the guard is reworded to match: the "explicit POSIX display-path spelling" claim now scopes to with-components forms, and the root-form paragraph records the #779 ruling. The Option B explanation below it is intact.
Hard-limit confirmations
argv_dialect_legacy) is byte-identical — untouched./X/...translation (Option B), virtual system roots,/mnt/X,/dev/null→nul, and the posix-aware / bridge / cmd child classes are unchanged in behavior. (/mnt/c→C:\still happens — through the/mnt/Xarm, not the root-form guard.)shell_path_to_windows("/c/")still maps toC:\for the shell's own operands (cd /c/etc.)./X/.,/mnt/X/, and the nativeX:/form.Pins
New unit pin in
src/executor/path.rstests (extends the existing funnel pin family; no integration file — an end-to-end variant would need either the winuxcmd toolchain or would pin the verbatim-by-class cmd route instead of this funnel):issue779_drive_root_forms_stay_verbatim_for_native_children(#[cfg(windows)], like all funnel pins):/c,/c/,/d,/d/,/C/verbatim for a native child; overreach guards/c/Users→C:\Usersand/d/x→D:\xstill translate; thetr '/c/' Xdata case stays verbatim.Pin hunt result: no existing test asserted a translated root form for a native/applet child, so no assertion was flipped. (The
C:\expectations elsewhere are the/mnt/carm andshell_path_to_windowsmapping tests — both out of scope and untouched. The one behavioral neighbor,drive_form_arguments_translate_for_the_posix_aware_child, already pins/dverbatim and/c/Windowstranslated; both still hold.)Verification (Linux VM; the funnel is
cfg!(windows), so Windows CI is the executing gate for the pin)cargo check --target x86_64-pc-windows-msvc --tests— cannot run here (cc-rs needs a real MSVCcl.exe).cargo check --target x86_64-pc-windows-gnu --tests— Finished (warnings only, all pre-existing in unrelated files). This compile-verifies the changed funnel and the new pin in the Windows configuration.cargo test --lib executor::path→ 9 passed / 0 failed (the module's cross-platform subset; its other ~90 tests are#[cfg(windows)]and run in Windows CI).cargo test --test issue592_argv_translation_completeness→ 0 tests on Linux by that file's own#![cfg(windows)]design; it compiles, and its compile is covered by the windows-gnu check above.rustfmt --checkon the file: clean before and after. LF-only.