Loader: stage each prepared image under its own name, then publish #1446
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1446"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from fxceless/victory-fork. Originally posted by CwWwWwW on 2026-11-27T08:39:27Z.
Problem
victory-loader'swrite_if_changedstaged every prepared title image in one deterministic.tmpfile next to its target. Two victory processes loading the same title from the same cache folder stage the same name: one truncates the other's staging file and the first rename takes it away, so the other's rename fails withENOENT- a second instance cannot start - and a loader can map a partly written image. Prepared copies are content-addressed (victory-image-<hash16>.dll), so the racing copies hold the same bytes.Fix
Stage each process and call under its own name (
<pid>.<serial>.tmp), rename into place, treat "the target is already published with these bytes" (another process won the race) as success, and remove the staging file on every path including write and rename failures.Regression test
windows::tests::concurrent_preparations_publish_a_complete_imageruns eight preparations of a 1 MiB image under one path: on the old code one fails renaming (ENOENT); with the change all publish, the path holds the complete bytes and no.tmpis left.Verification
cargo test -p victory-loader --lib --locked: 29 passed, 0 failedcargo clippy -p victory-loader --all-targets --locked -- -D warnings: cleancrates/victory-loader/src/windows.rs(+61/-5)Implemented independently from the target tree; no external code was copied.
The PR's Clippy check fails on main already: at
9a9091dcargo clippy --workspace --all-targetsfails invictory-shader(wave64_after_loop.rs precedence, valu_tests.rs simplifiable/negated partial-ord comparisons); open PR #1440 fixes exactly those lints. This diff touches none of those files, and the touched crate's own tests and clippy are clean locally.Imported from fxceless/victory-fork. Originally posted by CwWwWwW on 2026-11-27T16:21:30Z.
Superseded on the VIctory-NVIDIA tree that replaced main: the loader already stages prepared images in per-writer files and publishes with an atomic rename, with tests (crates/victory-loader/src/publish.rs; windows.rs uses it). Closing; the branch cannot be rebased onto the new tree meaningfully.
Pull request closed