Open
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 legacyMAX_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 withnormalize_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
\\.\
orGetFullPathNameW
)? - Should it try to use
\\?\GLOBALROOT\
style paths (see Windows: Fixfs::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:
- PR Another fix for workspace path joining #8964 — Another fix for workspace path joining
- PR Fix --manifest-path for verbatim paths #8881 — Fix --manifest-path for verbatim paths
- PR Append workspace paths using components #8874 — Append workspace paths using components
- Issue Crash when using \\?\ style path on Windows #8626 — Crash when using \?\ style path on Windows
- Issue Add longPathAware to the app manifest on Windows #7986 — Add longPathAware to the app manifest on Windows
- PR fixed workspaces issues due to non-canonical manifest path #7729 — fixed workspaces issues due to non-canonical manifest path
- Issue Workspace path is not fully resolved #7686 — Workspace path is not fully resolved
- Issue Crash on non-absolute path in Windows #7643 — Crash on non-absolute path in Windows
- Issue "error: path too long" on Windows when doing "cargo install --git" #13020 — Failure to load git dependencies with long file names on Windows
- Issue "Package collision in lockfile" using UNC/root local device/etc paths #6198 — "Package collision in lockfile" using UNC/root local device/etc paths
- Issue Crate failed to unpack on Windows (os error 3) - path name too long #2516 — Crate failed to unpack on Windows (os error 3) - path name too long
- Issue Investigate better Windows long-path error handling #13141 — Investigate better Windows long-path error handling
- Issue Windows
\\?\
verbatim paths break idiomatic use of OUT_DIR andinclude!
#13919 — Windows\\?\
verbatim paths break idiomatic use of OUT_DIR andinclude!