-
Notifications
You must be signed in to change notification settings - Fork 976
Closed
Labels
C-bugCategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICECategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICEO-windowsOperating system: WindowsOperating system: WindowsS-duplicateStatus: duplicate of another issue or PRStatus: duplicate of another issue or PR
Description
Error message:
d:\temp\LXD\85\foo>cargo fmt
error: couldn't read \\?\D:\temp\LXD\85\foo\src\..\foo.rs: The filename, directory name, or volume label syntax is incorrect. (os error 123)
--> \\?\D:\temp\LXD\85\foo\src\main.rs:2:5
|
2 | mod foo;
| ^^^
Source code:
src\main.rs:
#[path = "../foo.rs"]
mod foo;
fn main() {
foo::hello();
}foo.rs:
pub fn hello() {}Notes:
- The code is valid (
cargo buildis happy). - This only shows up on Windows (my system is Windows 7). This does not reproduce on Linux
- This only happens if there is a
..in the path.
After poking about some MSDN docs, I found this:
For file I/O, the "\\?\" prefix to a path string tells the Windows APIs to disable all string parsing and to send the string that follows it straight to the file system. For example, if the file system supports large paths and file names, you can exceed the MAX_PATH limits that are otherwise enforced by the Windows APIs.
The part about "disable all string parsing" makes me think that we need to canonicalize the path to remove the .. before passing it on to Windows.
Versions
- rustc 1.35.0 (3c235d560 2019-05-20)
- cargo 1.35.0 (6f3e9c367 2019-04-04)
- rustfmt 1.2.0-stable (09940a7 2019-03-27)
Metadata
Metadata
Assignees
Labels
C-bugCategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICECategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICEO-windowsOperating system: WindowsOperating system: WindowsS-duplicateStatus: duplicate of another issue or PRStatus: duplicate of another issue or PR