VFS: preserve the destination when an overlay rename fails #157

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

Imported from ivall/xcl. Originally posted by ebarr24 on 2026-11-23T18:00:45Z.


A title that replaces an overlay file can lose the destination's contents even when its move returns failure. For an open source file without delete sharing, XCL's copy succeeds and overwrites the destination. Deleting the source then fails.

Use the native same-volume rename when the source already lives in the overlay and the destination is another game path. Windows checks delete sharing before replacing the destination. After a successful rename, XCL records the destination write and hides the game file that was under the source. Win32 MoveFileExW contract

Verification

Windows 11 25H2 (26200.9711), Rust 1.100.0 x86_64-pc-windows-gnu, RTX 3080 (driver 616.92), DXC 1.9.2609.5.

  • The regression fails on db5dc26 because the destination contains the source bytes after the move returns an error.
  • On c00a305 the locked move reports ERROR_SHARING_VIOLATION and preserves both files. Retrying after the source handle closes succeeds. The regression also checks the physical game files and the source whiteout.
  • cargo test --locked -p xcl vfs -- --test-threads=4 passes all 16 matching tests. The test uses a single NTFS volume.
  • The full workspace suite on c33521c with the two independent fixes reported 570 passes, zero failures and 39 ignored. Two native-wave64 tests and the unconfigured retail-sample tests returned early. Fixture test fix #157 · CreateFile status fix #158

AI-assisted patch preparation and verification.

<!-- greyfinch-sync:ivall/xcl:issue:6565594297 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/160). Originally posted by [ebarr24](https://github.com/ebarr24) on 2026-11-23T18:00:45Z. --- A title that replaces an overlay file can lose the destination's contents even when its move returns failure. For an open source file without delete sharing, XCL's copy succeeds and overwrites the destination. Deleting the source then fails. Use the native same-volume rename when the source already lives in the overlay and the destination is another game path. Windows checks delete sharing before replacing the destination. After a successful rename, XCL records the destination write and hides the game file that was under the source. [Win32 MoveFileExW contract](https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-movefileexw) ## Verification Windows 11 25H2 (26200.9711), Rust 1.100.0 `x86_64-pc-windows-gnu`, RTX 3080 (driver 616.92), DXC 1.9.2609.5. - The regression fails on `db5dc26` because the destination contains the source bytes after the move returns an error. - On `c00a305` the locked move reports `ERROR_SHARING_VIOLATION` and preserves both files. Retrying after the source handle closes succeeds. The regression also checks the physical game files and the source whiteout. - `cargo test --locked -p xcl vfs -- --test-threads=4` passes all 16 matching tests. The test uses a single NTFS volume. - The full workspace suite on `c33521c` with the two independent fixes reported 570 passes, zero failures and 39 ignored. Two native-wave64 tests and the unconfigured retail-sample tests returned early. [Fixture test fix #157](https://github.com/ivall/xcl/pull/157) · [CreateFile status fix #158](https://github.com/ivall/xcl/pull/158) AI-assisted patch preparation and verification.
upstream-sync closed this pull request 2026-11-24 06:57:26 +00:00
mstr-vinegar commented 2026-11-24 06:57:27 +00:00 (Migrated from github.com)

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

Review: COMMENTED


Reviewed c00a305 and the surrounding VFS move, staging, and whiteout code. No blocking findings in the same-volume overlay-to-overlay path.

I copied the new regression test into base db5dc26 (qualifying GetLastError for the base imports): it failed because the destination had been overwritten with the source bytes after the move failed. On the PR head, the regression passed and cargo test --locked -p xcl vfs -- --test-threads=4 reported 16 passed, 0 failed on Windows 11, Rust 1.100.0 MSVC.

The test covers a single-volume overlay-to-overlay move; I did not validate cross-volume or external-destination behavior. AI-assisted review and testing.

<!-- greyfinch-sync:ivall/xcl:review:6027326912 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/160#pullrequestreview-6027326912). Originally posted by [mstr-vinegar](https://github.com/mstr-vinegar) on 2026-11-23T18:36:04Z. **Review:** COMMENTED --- Reviewed `c00a305` and the surrounding VFS move, staging, and whiteout code. No blocking findings in the same-volume overlay-to-overlay path. I copied the new regression test into base `db5dc26` (qualifying `GetLastError` for the base imports): it failed because the destination had been overwritten with the source bytes after the move failed. On the PR head, the regression passed and `cargo test --locked -p xcl vfs -- --test-threads=4` reported **16 passed, 0 failed** on Windows 11, Rust 1.100.0 MSVC. The test covers a single-volume overlay-to-overlay move; I did not validate cross-volume or external-destination behavior. AI-assisted review and testing.
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:36Z.


Merged (main 2abc562), together with #171 - they are not duplicates: this one covers a destination inside the game folder, #171 one outside it (T:, temp). 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:7113681413 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/160#issuecomment-7113681413). Originally posted by [ivall](https://github.com/ivall) on 2026-11-23T20:52:36Z. --- Merged (main 2abc562), together with #171 - they are not duplicates: this one covers a destination inside the game folder, #171 one outside it (T:\, temp). 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!157
No description provided.