Skip to content

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

Merged
ivall merged 1 commit into
xcl-dev:mainfrom
ebarr24:fix/vfs-locked-overlay-move
Nov 23, 2026
Merged

ivall merged 1 commit into
xcl-dev:mainfrom
ebarr24:fix/vfs-locked-overlay-move

Conversation

@ebarr24

@ebarr24 ebarr24 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

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.

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.

@mstr-vinegar mstr-vinegar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

ivall commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator

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 up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants