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

Manually merged
github merged 1 commit from gh-pr/160/head into gh-pr/160/base 2026-11-26 04:13:06 +00:00
Owner

@⁠ebarr24 on GitHub · 2026-11-23 18:00 UTC · original
ebarr24:fix/vfs-locked-overlay-move → main · +67 −13 · 2 files · 1 commits · merged 2026-11-23 20:51 UTC

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.

**@⁠ebarr24** on GitHub · 2026-11-23 18:00 UTC · [original](https://github.com/xcl-dev/xcl/pull/160) `ebarr24:fix/vfs-locked-overlay-move` → `main` · +67 −13 · 2 files · 1 commits · merged 2026-11-23 20:51 UTC 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.
Use the native same-volume rename for files already in the overlay. If Windows refuses to delete-share the source, the destination keeps its contents. Record the source whiteout once the move succeeds.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:13:06 +00:00
github manually merged commit c00a305608 into gh-pr/160/base 2026-11-26 04:13:06 +00:00
Author
Owner

@⁠ivall on GitHub · 2026-11-23 20:52 UTC · original

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.

**@⁠ivall** on GitHub · 2026-11-23 20:52 UTC · [original](https://github.com/xcl-dev/xcl/pull/160#issuecomment-7113681413) 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.
Author
Owner

@⁠mstr-vinegar on GitHub · 2026-11-23 18:36 UTC · original · reviewed

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.

**@⁠mstr-vinegar** on GitHub · 2026-11-23 18:36 UTC · [original](https://github.com/xcl-dev/xcl/pull/160#pullrequestreview-6027326912) · **reviewed** 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.
This discussion has been locked. Commenting is limited to contributors.
No description provided.