-
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 \\?\
verbatim paths break idiomatic use of OUT_DIR and include!
#13919
Comments
This is only true when calling OS APIs (and only if |
Since Cargo has set |
Hm, I don't think that's used for build scripts? But in any case, when using Rust's The issue with dunce is that it intentionally won't work in a number of cases, including for long paths and |
I would just add that for a long time now |
Some other workarouds appear in rust-lang/rust#75075. |
Add depend crate gpui
But under powershell 6 or command prompt, the build run successfully. |
@golanguage Could you please try the latest nightly Rust? |
Thanks @ChrisDenton.
On powershell 6 , |
Ok, it seems that the original issue is fixed by rust-lang/rust#125205 I think the issue there with gpui comes via the |
I submit a new issue in embed-resource , rust-embed-resource/issues/71
|
Cargo needs to apply the same fixup for all the paths it reads from The only bug in embed-resource is that we execute |
Problem
When Cargo is invoked on Windows in either of the following 2 scenarios, and possibly others:
\\?\
--manifest-path
that begins with\\?\
then the following widespread idiom for including build.rs-generated code does not work.
Because
/
is not a directory separator in verbatim paths, this fails to compile with an error like this:Normally in Windows paths
/
works just as well as\
, but from Maximum Path Length Limitation: File I/O functions in the Windows API convert "/" to "\" as part of converting the name to an NT-style name, except when using the "\\?\" prefix as detailed in the following sections.Steps
The problem can be reproduced in GitHub Actions with the following source code.
The first
cargo check
will succeed. The second two will each fail as shown above.Possible Solution(s)
I hope that someone can make a successful proposal for something like:
which would work in a cross-platform manner by using the correct path separator for rustc's host OS.
Until then, #13914 (comment) proposes a possible way that Cargo could work around this issue some of the time.
(https://docs.rs/dunce/1/dunce/fn.simplified.html)
This is only a partial fix because not all verbatim paths can be converted to something without
\\?\
. If a path is longer than 260 characters,\\?\
is the only way to refer to it.#13914 shows another possible workaround, but that one amounts to boiling the ocean to replace the OUT_DIR/
include
idiom with a substantially more verbose one.Notes
Meta-issue: #9770
The text was updated successfully, but these errors were encountered: