Repository navigation
test: give fast_io copy_file_range temp files pid-unique names - #8139
Merged
Merged
Conversation
nextest runs each test in its own process and tempfile seeds its name generator from the clock and thread id only, so concurrent test processes can draw the same .tmpXXXXXX name. On Windows a clash with another process's directory or delete-pending file fails with PermissionDenied, which tempfile does not retry, so test_copy_partial_eof failed once in the IOCP job. Create every temp file in the module through a helper that prefixes the name with the process id, so names from live processes are disjoint.
oferchen
enabled auto-merge (squash)
October 8, 2026 08:53
mevanlc
pushed a commit
to mevanlc/rsync-rs
that referenced
this pull request
Oct 14, 2026
…chen#8139) nextest runs each test in its own process and tempfile seeds its name generator from the clock and thread id only, so concurrent test processes can draw the same .tmpXXXXXX name. On Windows a clash with another process's directory or delete-pending file fails with PermissionDenied, which tempfile does not retry, so test_copy_partial_eof failed once in the IOCP job. Create every temp file in the module through a helper that prefixes the name with the process id, so names from live processes are disjoint.
oferchen
added a commit
that referenced
this pull request
Nov 15, 2026
…rd-link detection (#277) (#8387) ## Summary - **#311 (`crates/platform/src/signal.rs`):** Factor Windows console control event dispatch out of the `unsafe extern "system" fn handler` into `dispatch_console_ctrl(ctrl_type, shutdown, graceful) -> bool` with compile-time `const` assertions against Win32 `CTRL_*_EVENT` constants and cross-platform unit tests. - **#277 (`crates/fast_io/src/same_fs.rs`, `crates/engine/src/local_copy/hard_links/windows.rs`, `crates/engine/src/local_copy/executor/file/copy/links.rs`):** - Add `fast_io::same_fs::FileIdentity` and `file_identity(path)` sharing a single `windows_file_info` (`GetFileInformationByHandle`) helper on Windows and `symlink_metadata` on Unix. - Implement Windows `HardLinkTracker` (`existing_target_for_path` / `record_for_path`) keyed by `(volume_id, file_index)` when `nlink > 1`, and wire `source` at local-copy call sites. - Implement `is_already_hardlinked(destination, target)` via `fast_io::same_fs::file_identity` on both Unix and Windows. - Note from audit: **#407** (`test_copy_partial_eof` temp-file pid-unique naming) was already fixed in `7bc2964a4` (#8139), and **#353** (required Windows CI full workspace test surface) landed in `c88299623` (#8316). ## Verification - `cargo fmt --all -- --check` - `cargo test --locked -p platform`: 88 passed, 0 failed - `cargo test --locked -p fast_io --lib same_fs`: 6 passed, 0 failed (1111 filtered out) - `cargo test --locked -p engine --lib local_copy::hard_links`: 50 passed, 0 failed (4559 filtered out) - `cargo clippy --locked -p platform -p fast_io -p engine --all-targets -- -D warnings`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes an intermittent Windows failure in
fast_iocopy_file_range::tests::test_copy_partial_eof. Run 37709885081 failed withNamedTempFile::new()returningPathError { path: ...\Temp\.tmpSxD9oN, os error 5 }. It failed in about 1 of 40 runs.Root cause
The test fails while creating a new temp file, not while using a handle afterwards.
global_rng.rsrandom_seed) seeds the temp-name generator fromInstant::now()and the thread id only. The test thread id is the same in every process, so two processes seeded in the same clock tick generate the same.tmpXXXXXXnames.PermissionDenied. tempfile 3.27.0 (util.rscreate_helper) retries onlyAlreadyExistsandAddrInUse, so the error reaches the test as a panic.Fix
This is a test-only change. Every temp file in the module is now created through
new_temp_file(), which puts.tmp<pid>-at the front of the name. Two live processes always have different pids, so their names can no longer collide. The-also keeps these names apart from tempfile's purely alphanumeric default names.All 15 call sites are converted. There are no retries, sleeps,
#[ignore]s or Windows skips.Verification
cargo nextest run -p fast_io --all-features -E 'test(copy_file_range)'ran 12 tests, all passing. strace shows the new names, for example/tmp/.tmp2865819-zMpeYY.x86_64-pc-windows-gnucross type-check is clean, as are clippy and fmt.Follow-up (not in this PR)
About 49 files in
crates/fast_io/srccallNamedTempFile::new(),tempdir()orTempDir::new()and are exposed to the same collision on Windows. The fix there is a shared test-support helper; that will be its own change.