VFS: preserve external destination when overlay move fails #168

Merged
mstr-vinegar merged 1 commit from upstream-pr/171 into main 2026-11-23 20:51:52 +00:00
mstr-vinegar commented 2026-11-23 18:45:43 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by mstr-vinegar on 2026-11-23T18:45:43Z.


Problem

Moving an overlay file to a same-volume non-game path can overwrite the destination even when the move fails: copying succeeds, then deleting a source opened without delete sharing fails.

Use a native same-volume rename for this case so Windows checks sharing before replacing the destination. Preserve the existing fallback for cross-volume moves. This complements #160, which handles moves between game paths.

Verification

  • On base 956a476, the new regression failed because the destination contained the source bytes after the failed move.
  • On this branch, cargo test --locked -p xcl vfs -- --test-threads=4: 16 passed, 0 failed (Windows 11, Rust 1.100.0 MSVC).
  • The test checks the locked-source failure, retry after closing the handle, preservation of the original game file, and an overlay-only source.

Cross-volume and delayed moves retain their existing behavior and are not covered by this fix. AI-assisted implementation and testing.

<!-- greyfinch-sync:ivall/xcl:issue:6566392154 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/171). Originally posted by [mstr-vinegar](https://github.com/mstr-vinegar) on 2026-11-23T18:45:43Z. --- ## Problem Moving an overlay file to a same-volume non-game path can overwrite the destination even when the move fails: copying succeeds, then deleting a source opened without delete sharing fails. Use a native same-volume rename for this case so Windows checks sharing before replacing the destination. Preserve the existing fallback for cross-volume moves. This complements #160, which handles moves between game paths. ## Verification - On base `956a476`, the new regression failed because the destination contained the source bytes after the failed move. - On this branch, `cargo test --locked -p xcl vfs -- --test-threads=4`: 16 passed, 0 failed (Windows 11, Rust 1.100.0 MSVC). - The test checks the locked-source failure, retry after closing the handle, preservation of the original game file, and an overlay-only source. Cross-volume and delayed moves retain their existing behavior and are not covered by this fix. AI-assisted implementation and testing.
upstream-sync closed this pull request 2026-11-24 06:57:30 +00:00
ivall commented 2026-11-24 07:04:16 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ivall on 2026-11-23T20:52:37Z.


Merged (main 2abc562), together with #160 - not a duplicate of it: #160 covers a destination inside the game folder, this one a destination outside it. The conflict was resolved by keeping both paths; the external one now calls #160's commit_overlay_removal(sr) instead of delete_file(sr) (same effect: the original stays hidden and the move is recorded). Both tests are kept and pass. Checked on an RX 9070 (RDNA4) with the 11 PRs merged together on main 38b05b7: cargo build --workspace && cargo test --workspace -- --test-threads=4 - 547 unit tests passed, 0 failed (19 ignored); the integration and e2e tests passed too.

<!-- greyfinch-sync:ivall/xcl:comment:7113681854 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/171#issuecomment-7113681854). Originally posted by [ivall](https://github.com/ivall) on 2026-11-23T20:52:37Z. --- Merged (main 2abc562), together with #160 - not a duplicate of it: #160 covers a destination inside the game folder, this one a destination outside it. The conflict was resolved by keeping both paths; the external one now calls #160's `commit_overlay_removal(sr)` instead of `delete_file(sr)` (same effect: the original stays hidden and the move is recorded). Both tests are kept and pass. Checked on an RX 9070 (RDNA4) with the 11 PRs merged together on main 38b05b7: `cargo build --workspace && cargo test --workspace -- --test-threads=4` - 547 unit tests passed, 0 failed (19 ignored); the integration and e2e tests passed too.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!168
No description provided.