Skip to content

fs_win api_path mangles drive-root paths (C:\. -> \?\C:), shared by stat/rm/touch/du/find and more #1869

Done

Description

@caomengxuan666

Summary

In WinuxCmd's Windows path funnel (fs_win.rs, api_path), a path that lands exactly on a drive root is mangled by the trailing-component truncation: C:\. is cut to a bare C:, producing \\?\C: — an invalid device-namespace path. Every command that resolves operands through api_path inherits the defect at drive roots.

Provenance and evidence status (stated precisely)

  • The sibling face is host-confirmed and already fixed: ls: cannot access '.' when the process cwd is a drive root #1862 (niubash [gap] unexpand: obsolete -1..-9 tab-size flags rejected #1082) — ls failing to resolve . with the process cwd at a drive root, reproduced in pure cmd on the shipped build, fixed via PR fix(ls): keep drive-root separator when a dot collapse lands on the root #1863.
  • The mechanism here is code-located: fs_win.rs:341 (Windows impl) — the tail truncation turns a drive-root landing into the bare drive letter before the \\?\ prefix is applied.
  • The exposure set below is a code survey (captain lane L4, 2026-11-24), not yet a host-confirmed set: A-level (call api_path directly or via internal entry points) — stat, pathchk, ln, rm, touch, tee, du, find, glob; B-level (via file_meta only) — fmt, fold, paste; cp is in scope only on its symlink-creation face. Per-command confirmation on a real Windows host (run matrix) is still owed — the X299 tunnel is down — and a unit-level pin on the pure path transformation is being landed with the fix as the executable evidence for the mechanism itself.

Expected

At a drive root, operands like . / C:\. resolve to the root directory itself (GNU/Windows semantics as in the #1862 fix), for every command sharing the funnel — one fix in api_path, not per-command patches.

Activity

  1. added
    bug
    on Nov 24, 2026
  2. caomengxuan666 commented on Nov 25, 2026

    @caomengxuan666
    MemberAuthor

    CAPTAIN note — the fix has merged (PR #1871): api_path now restores the root separator on bare-drive landings, with the six pins landed via a CI two-stage fail-first (pins-only run: exactly the three discriminating shapes red; with the fix: 1075 pass / 0 fail; full CI 28 pass). This issue stays open until the L4 real-machine matrix (stat/find/touch/pathchk/fmt/fold/paste vs the recorded DEFECT baseline) is re-run after X299 returns.

  3. caomengxuan666 commented on Nov 25, 2026

    @caomengxuan666
    MemberAuthor

    CAPTAIN-VERIFY — closing on the v1.2.3 host matrix; the remaining face is split to #1872.

    Real-host matrix (devin-windows, Windows Server 2022, published v1.2.3 binaries) against the 2026-11-24 baseline recorded for this issue:

    • find: all six shapes rc=0 — green (was DEFECT).
    • pathchk: all six shapes rc=0 — green (was single-shape DEFECT).
    • stat / touch: ., C:\., C:\ and CTRL shapes green — the bare-root api_path defect fix(fs_win): api_path restores the root separator on bare-drive landings #1871 targeted is fixed and verified (A/B: . at root was red in v1.2.2, green in v1.2.3).
    • fmt / fold / paste: . and C:\. are back to the CTRL error class (was class-polluted DEFECT).
    • du / ls / rm / tee: green/unchanged, as baselined.

    What remains red is a different, wider face the baseline shapes happened to cover: any operand containing a .. component (even resolving to an ordinary directory) fails in stat/touch, and the fmt family's .. / explicit-root operands fail with wrong error classes. A/B proves it predates #1871 (identical in v1.2.2), so it is not a regression from this fix; it is tracked as #1872 with the full shape set as its acceptance matrix. This issue's named defect — the bare-drive-root normalization — is done.

  4. added 2 commits that reference this issue on Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions