Closed
Description
I think symlink_junction_inner
sometimes isn't writing to the buffer properly which can cause the DeviceIoControl
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:
diff --git a/library/std/src/sys/windows/fs.rs b/library/std/src/sys/windows/fs.rs
index 37809803828..d7f1a44bdf4 100644
--- a/library/std/src/sys/windows/fs.rs
+++ b/library/std/src/sys/windows/fs.rs
@@ -1409,6 +1409,8 @@ fn symlink_junction_inner(original: &Path, junction: &Path) -> io::Result<()> {
(*db).ReparseTargetLength = ((i - 1) * 2) as c::WORD;
(*db).ReparseDataLength = (*db).ReparseTargetLength as c::DWORD + 12;
+ crate::hint::black_box(slice::from_raw_parts(buf, i));
+
let mut ret = 0;
cvt(c::DeviceIoControl(
h as *mut _,