-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows device path and long-path meta issue. #9770
Comments
Since my PR was linked here, I would add that I'd really love to fix this issues in the standard library so everyone can benefit by default. My thinking at the moment is that Rust should auto-convert to
Btw, in case it helps someone, I've started writing about Windows paths which attempts to go in to some detail. It's still a work in progress so sorry if there's any mistakes or anything is unclear. |
Thanks for posting your writeup! I think it would be great to have a resource like that. Microsoft's own documentation is a little scattered and lacking, and having one place clearly describing things would be great. Let me know if you ever want feedback on it. |
Sure, I'd very much welcome feedback! I admit I mostly wrote it for myself which is why it's currently a "secret" gist so I'd appreciate any help in making more useful for others. |
@ChrisDenton Instead of fiddling around with NT paths and unnecessarily making life harder, why not use Embedded Manifests per executable ? Embedded Manifests were designed for a reason. |
@mshaikhcool Enabling the manifest option for long paths would be great! However, it has several limitations which means it doesn't solve all problems. It only works in Windows 10 version 1607 and newer. It requires the user to have admin rights and to change a registry entry. It doesn't fix the issue with broken drivers if you actually do want to resolve symlinks or get an absolute path. |
The person who will be installing Rust in the first place will most likely be A Programmer, so this point is moot.
Ah, Classic. Symlinks were introduced in Vista. By that logic, we should not also use symlinks because XP didn't support it. The point here is, Why are you even bothering in supporting an
NT UNC(\\?\) is designed to be used by Subsystems themselves and Drivers, not user mode programs. Both has different purposes, Rust should implement both as a system programming lang. |
As I said, using the However, it alone does not fix all the issues here nor in all circumstances. So other solutions need to be explored as well. Nobody is talking about using undocumented APIs. The use of |
I think there's a fundamental misunderstanding here . Use
I hope it's clear now. |
I would suggest reading Win32 File Namespaces because it feels like we're talking about different things. |
can you point me exact win32 apis/scenarios where Manifest file couldn't work but works otherwise ? |
The manifest option is not sufficient to solve all issues listed here. For example:
|
this point is already moot because of Rust's potential usecases. not sure why it's being thrown around each time. Note that : Windows will always be a backward-compatible OS by default. Users must perform changes by themselves to make it forward-compatible. To use long paths Users must use windows 10 and must enable group policy or registry. Note: this is the Microsoft recommended way.
this is absolutely horrible implementation. the amount existing softwares break because of UNC, including Microsoft's owns is enough big of a reason to abandon UNC and the "the Excuse" presented above. there are already proposals for abandoning that in favor of returning win32 absolute paths.
Ah, now realized where the confusion is. this
manifest just removes hard coded static buffer size from
Explorer doesn't accept
I guess you meant RAM Disk by that. creating RAM Disk requires a KMDF Device Driver, Device Drivers use win32 device paths
the Now with Manifest support , one doesn't even need to attach |
Hi. Can someone point me to the origin of this statement? Are there any MS docs which can be linked?
Maybe i'm doing it wrong, or has this changed in newer Windows Versions? |
Here's a brief guide Windows paths, some of the issues involved and what the standard library has done and is doing to address them. None of this is cargo specific but I hope it helps nonetheless. I'll try to keep this short but I fear I might fail. Terminology cheat sheet
NT kernel paths are what both verbatim and the non-verbatim paths end up as but aren't otherwise usable in most user space APIs. So when I say "non-verbatim paths" I mean the first three paths in the table and not including kernel paths. Verbatim pathsVerbatim paths are passed almost directly to the kernel (except The term "verbatim" is not official terminology but it's the one used by the Rust standard library for lack of an official name. Non-verbatim pathsUnlike a verbatim path, other paths are subject to limits (such as
Path Issues
Filesystem issue
Rust standard libraryRust's standard library is addressing these issues in a number of ways:
Outstanding issuesThe standard library does not provide a public API to convert between verbatim and non-verbatim paths. Currently the best option would be to use a third party crate for this. The current directory is always limited by |
How is enabling long path awareness when the application manifest enables it but the register doesn't not backwards-compatible? If the apllication itself opts in, why is there an additional system wide opt in necessary for backwards compatibility? |
I think we can only guess, I haven't seen any explanation from Microsoft. I suspect it is because other programs may fail to access those paths. For example, I believe when it was first added, Explorer couldn't handle those long paths. It introduces an environment where various programs would suddenly start breaking in unpleasant ways when interacting with programs that are long-path aware. It could also be a security issue similar to how symbolic links are restricted. |
Verbatim paths on Windows are not well supported, e.g. "\\\\?\\C:\\Users..." while technically valid, causes some fs api's like `exists` to fail errantly. The fix is to use a third party lib normpath to normalize the path to the wasm binary. Related issue: rust-lang/cargo#9770 Signed-off-by: Bailey Hayes <[email protected]>
Verbatim paths on Windows are not well supported, e.g. "\\\\?\\C:\\Users..." while technically valid, causes some fs api's like `exists` to fail errantly. The fix is to use a third party lib normpath to normalize the path to the wasm binary. Related issue: rust-lang/cargo#9770 Signed-off-by: Bailey Hayes <[email protected]> Co-authored-by: Victor Adossi <[email protected]>
Verbatim paths on Windows are not well supported, e.g. "\\\\?\\C:\\Users..." while technically valid, causes some fs api's like `exists` to fail errantly. The fix is to use a third party lib normpath to normalize the path to the wasm binary. Related issue: rust-lang/cargo#9770 Signed-off-by: Bailey Hayes <[email protected]> Co-authored-by: Victor Adossi <[email protected]>
Verbatim paths on Windows are not well supported, e.g. "\\\\?\\C:\\Users..." while technically valid, causes some fs api's like `exists` to fail errantly. The fix is to use a third party lib normpath to normalize the path to the wasm binary. Related issue: rust-lang/cargo#9770 Signed-off-by: Bailey Hayes <[email protected]> Co-authored-by: Victor Adossi <[email protected]>
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: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.dunce
), or should it all be internal? What should be done withnormalize_path
?canonicalize
function on Windows.\\.\
orGetFullPathNameW
)?\\?\GLOBALROOT\
style paths (see Windows: Fixfs::canonicalize
to work with legacy drivers rust#86447)?\\?\
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:
\\?\
verbatim paths break idiomatic use of OUT_DIR andinclude!
#13919 — Windows\\?\
verbatim paths break idiomatic use of OUT_DIR andinclude!
The text was updated successfully, but these errors were encountered: