Wave icon indicating copy to clipboard operation
Wave copied to clipboard

Preserve Windows drive-relative prefixes in basename and dirname copying

Open LunaStev opened this issue 3 weeks ago • 0 comments

Problem

The Windows path policy recognizes drive-relative joins but basename/dirname treat C:foo as an ordinary basename with no parent.

Reproduction and evidence

Audited canonical master 69a67c6e0fb700f37ee6114f5a66d37ee13771a5 (0.0.1-alpha-dev). Matching checkout-built compiler/std were used for compiler probes on Linux amd64 with Rust 1.89.0 and LLVM 21.1.8. Artifact inspection, mocked/projection checks and foreign-target object emission are identified below and are not native execution on those operating systems.

import("std::path::copy")::{path_basename_copy,path_dirname_copy};fun main()->i32{var b:array<u8,64>;path_basename_copy(&b[0],64,"C:foo");println("base={s}",&b[0] as str);path_dirname_copy(&b[0],64,"C:foo");println("dir={s}",&b[0] as str);return 0;}

The audit executed unchanged core/analyze/copy implementations on Linux at O0/O2 with only PATH_WINDOWS selected true: base=C:foo, dir=.; expected base=foo and dir=C:. Original-source objects were also emitted for Windows amd64/arm64 at O0/O2. Native Windows execution was not performed.

Scope

Include the drive-relative volume prefix in component analysis. Keep drive-rooted paths, UNC paths and POSIX separator policy distinct.

Starting points: std/path/analyze.wave:27, std/path/analyze.wave:68, std/path/copy.wave:130.

Completion criteria

  • [ ] C:foo, C:, C:/foo and UNC cases preserve their volume semantics.
  • [ ] Copy buffer boundaries and failure preservation remain covered.
  • [ ] Run the fixture natively on Windows amd64/arm64 before claiming platform execution success.

This is a bounded newcomer task with the starting point and focused negative/positive checks above.

Related: #529, #677, #946, #1039. Related broad trackers or completed implementations are context, not claims that their entire scope is unfinished.

LunaStev avatar Nov 12 '26 12:11 LunaStev