From 20f7f8be1eaad967aa785beba88cf2822996d044 Mon Sep 17 00:00:00 2001 From: Don Omondi <282319807+mockydevs@users.noreply.github.com> Date: Sat, 31 Oct 2026 01:35:00 +0300 Subject: [PATCH] Testkit: the temp_dir test pre-makes a private directory, as temp_dir does a_temp_dir_starts_empty_in_a_process_and_stays_for_later_calls pre-created the "earlier process" directory with create_dir_all, which under a usual umask gives others access, so temp_dir refused it as not private and the test failed on every Unix run (main's CI included). The test now makes it with mode 0o700; temp_dir and the assertions are unchanged. --- crates/testkit/src/lib.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/testkit/src/lib.rs b/crates/testkit/src/lib.rs index b76159c2c..d6319a9c6 100644 --- a/crates/testkit/src/lib.rs +++ b/crates/testkit/src/lib.rs @@ -111,7 +111,13 @@ mod tests { fn a_temp_dir_starts_empty_in_a_process_and_stays_for_later_calls() { let tag = "fresh-temp-dir"; let left = std::env::temp_dir().join(format!("vectorcraft-testkit-{tag}-{}", std::process::id())); - std::fs::create_dir_all(left.join("nested")).unwrap(); + // Made private, as `temp_dir` makes it: a directory others can reach is refused, not reused. + #[cfg_attr(not(unix), allow(unused_mut))] + let mut b = std::fs::DirBuilder::new(); + b.recursive(true); + #[cfg(unix)] + std::os::unix::fs::DirBuilderExt::mode(&mut b, 0o700); + b.create(left.join("nested")).unwrap(); std::fs::write(left.join("left.txt"), b"an earlier process").unwrap(); let dir = super::temp_dir(tag); assert_eq!(dir, left);