-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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' symlink_junction_inner
mysteriously fails
#107884
Comments
cursed. |
Huh, simplifying that change to |
I had another quick thought and replaced the diff --git a/library/std/src/sys/windows/fs.rs b/library/std/src/sys/windows/fs.rs
index 37809803828..f68cf40c065 100644
--- a/library/std/src/sys/windows/fs.rs
+++ b/library/std/src/sys/windows/fs.rs
@@ -1398,10 +1398,10 @@ fn symlink_junction_inner(original: &Path, junction: &Path) -> io::Result<()> {
// FIXME: this conversion is very hacky
let v = br"\??\";
let v = v.iter().map(|x| *x as u16);
- for c in v.chain(original.as_os_str().encode_wide()) {
+ v.chain(original.as_os_str().encode_wide()).for_each(|c| {
*buf.add(i) = c;
i += 1;
- }
+ });
*buf.add(i) = 0;
i += 1;
(*db).ReparseTag = c::IO_REPARSE_TAG_MOUNT_POINT; |
The IOCTL docs don't state the type that should be passed, but links to EDIT: Looks similar to this Wine patch. |
Hm, this has been the same since forever in Rust so it'd be surprising for it to suddenly break now. Oh! But now I've woken up I realised something. We're not zeroing the structure. I can't believe I missed that! So we're likely putting random data into the reserved parameters. |
But yes, this function is awful and should be rewritten. Good job it's only used in tests... |
Zero the `REPARSE_MOUNTPOINT_DATA_BUFFER` header Makes sure the full header is correctly initialized. Fixes rust-lang#107884
I think
symlink_junction_inner
sometimes isn't writing to the buffer properly which can cause theDeviceIoControl
to fail and thus tests that use it. This function isn't great and is only used in tests. I can reproduce this consistently locally on current master but in CI most PRs seem to test ok (though not all).I've not really investigated yet but on a hunch I added the following which seems to fix it locally, I don't know why or if it's a fluke:
The text was updated successfully, but these errors were encountered: