From c5dca77da202e8ff377c86842397907caedd85b4 Mon Sep 17 00:00:00 2001 From: Weihang Lo Date: Sat, 4 Oct 2025 18:26:36 -0400 Subject: [PATCH] test: null-terminated path for reserved windows name detection The test is still nightly only to avoid blocking rust-lang/rust. Once we figure it is not flaky anymore we should re-enable it. https://rust-lang.zulipchat.com/#narrow/channel/246057-t-cargo/topic/reserved_windows_name.20test.20failing/ --- crates/cargo-test-support/src/paths.rs | 2 +- tests/testsuite/package.rs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/cargo-test-support/src/paths.rs b/crates/cargo-test-support/src/paths.rs index 10a0283a6d8..742c9b1a9d5 100644 --- a/crates/cargo-test-support/src/paths.rs +++ b/crates/cargo-test-support/src/paths.rs @@ -451,7 +451,7 @@ pub fn windows_reserved_names_are_allowed() -> bool { use std::ptr; use windows_sys::Win32::Storage::FileSystem::GetFullPathNameW; - let test_file_name: Vec<_> = OsStr::new("aux.rs").encode_wide().collect(); + let test_file_name: Vec<_> = OsStr::new("aux.rs").encode_wide().chain([0]).collect(); let buffer_length = unsafe { GetFullPathNameW(test_file_name.as_ptr(), 0, ptr::null_mut(), ptr::null_mut()) }; diff --git a/tests/testsuite/package.rs b/tests/testsuite/package.rs index 3824938e94f..860d3f9ea65 100644 --- a/tests/testsuite/package.rs +++ b/tests/testsuite/package.rs @@ -2935,7 +2935,8 @@ src/lib.rs } #[cargo_test( - ignore_windows = "temporarily disabling due to flakiness: https://rust-lang.zulipchat.com/#narrow/channel/246057-t-cargo/topic/reserved_windows_name.20test.20failing/with/543085230" + nightly, + reason = "temporarily due to flakiness: https://rust-lang.zulipchat.com/#narrow/channel/246057-t-cargo/topic/reserved_windows_name.20test.20failing/with/543085230" )] #[cfg(windows)] fn reserved_windows_name() {