-
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
Add longPathAware to the app manifest on Windows #7986
Comments
I think this would be a very hard problem to solve, if not impossible. Some issues I can think of:
|
Thanks for the response! Maybe there's a workaround I could apply to handle this? Like setting a custom |
It could be disable by the regedit.msc. so just stopping checking it in the cargo for windows'll be fine. |
If your CI has the MSVC toolsets installed, you have all that you need. Don't have them? Here is the direct download link.
But for the people who DO have it on, it would help. In my opinion, that's a pretty good start! And when developers start seeing that their colleague got it working, they will ask "hey dude, what did you do?", and soon their IT department will turn the switch on for all new dev computers.
If your windows-interfacing APIs are still using a static 260-char buffer, it's past time to fix that code. All Windows APIs have a way to query the required buffer length. The typical way is calling the function with a 0-length buffer, and the return code is the required length. Any skilled Windows developer should know that.
Yep. Let's start with this tool (this issue is about Cargo, right?). When it's done, other executables will copy the solution. Lead by example!
Have you tried? Or are you assuming other tools might not work as an excuse not to try? How will the situation improve if every maintainer used the argument "tool X is not updated, so I'm not updating tool Y" ? I strongly believe that if everyone does their part, the ecosystem will quickly improve for everybody.
Maybe they already do, but unless cargo is updated, we'll never know. And what's the worst-case here? That cargo supports it, and we find out that a downstream tool gives an error. Then we can create an issue and a PR for that downstream tool, and keep making progress.
Good point, excellent explanation. This is not a very good solution. The manifest solution seems a better approach. |
I just ran into this issue because I have a crate with a long name, over 100 characters, so the path to the crate's location in the |
that's because No version of windows's Manifest files are an integral part of Modern Windows. A system programming lang like Rust shouldn't do dilly-dally in this space. |
@ehuss as @RoguePointer80 addresses your points, and regarding Registry Key off by default point, you should know the person installs a system programming lang like in the first place will most likely be A Developer, not a average-joe. so this point is moot. First of all , Rust shouldn't call undocumented apis. |
@nitsky see this post https://gal.hagever.com/posts/windows-long-paths-in-rust/ |
Wah ! Clever. forgot about SxS manifest support. I'm afraid about that "Patch part" i.e the post-patching consequences here, especially about touching core executables |
A manifest allows setting more than just I think at a minimum cargo should set the OSes it supports so as to avoid unnecessary compatibility shims. I'd also advocate for setting the other two options even if they're less likely to be needed in Rust itself (due to using the UTF-16 APIs). |
Closing as #13131 has added a manifest. That is just the beginning of long-path support. See the meta tracking issue at #9770, and #13141 for some more examples of what still doesn't work. For people hitting the issue in git clones, be sure to check out #13020 which has more information (in short, add |
This issue has been solved only for MSVC targets, should the same be done for Windows GNU? |
Last I looked (which was awhile ago) that was more complicated because gnu didn't have linker arguments for adding a manifest so you either had to use a post-build step to edit the binary or else manually construct an object file with the right tables and link them (which is a much more involved process). Maybe that's changed though. |
Oh, that could be a problem, we would nee to use LLD to circumvent it. |
Describe the problem you are trying to solve
On Windows, when the directory where the project files are located is too long, cargo fails with various file-related errors.
Describe the solution you'd like
Rust should handle long path ok. We just have to add a
longPathAware
to the app manifest:https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file
Notes
This issue only occurs if the file paths cargo wants to touch are too long.
This happens with paths like these:
The text was updated successfully, but these errors were encountered: