Skip to content

Windows device path and long-path meta issue. #9770

Open
@ehuss

Description

This is a meta issue to coordinate the different issues related to handling device paths and long paths on Windows (such as \\?\ or \\.\). There are several places where Cargo does not handle these well, but it is not clear exactly how they all should be approached. Changes for these require careful consideration, and it's not clear what a general good approach would look like. Some rough thoughts to consider:

  • Where exactly are the problems? (Making a very clear overview would be an extremely helpful way to help here!)
  • To what degree should we strive for long-path support? Having the target directory exceed MAX_PATH seems like it would be quite difficult due to issues like Windows: Allow running processes whose path exceeds the legacy MAX_PATH rust#86406. Manifests require a registry setting that is off by default.
    • If we don't or can't support MAX_PATH paths, does it make sense to ever use device paths? Can they just be converted to normal paths and make Windows handle its regular normalization?
    • Is supporting long paths feasible without a manifest?
  • Should the fixes be primarily done to the standard library?
  • Should Cargo use an external library (like dunce), or should it all be internal? What should be done with normalize_path?
  • How to approach normalization/canonicalization? There are classic issues like whether to follow symlinks, but also the troubles of using's Rust's canonicalize function on Windows.
  • Should Cargo try to avoid device (aka verbatim) paths as much as possible?
  • Are there other ways to lean on Win32 normalization (like \\.\ or GetFullPathNameW)?
  • Should it try to use \\?\GLOBALROOT\ style paths (see Windows: Fix fs::canonicalize to work with legacy drivers rust#86447)?
  • Is it feasible to just translate \\?\ paths to \\.\, and rely on the Win32 API to do normalization? This would not support long-paths, but there are many other problems with long paths. (Probably not, just tossing out the idea.)

Linking issues and PRs:

Metadata

Assignees

No one assigned

    Labels

    A-filesystemArea: issues with filesystemsE-hardExperience: HardO-windowsOS: WindowsS-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions