VFS: honor read-only attributes in DeleteFileW #2809

Open
github-bot wants to merge 1 commit from github-bot/gh-2809 into main AGit
Owner

@⁠CryingLaughing on GitHub · 2026-11-26 14:06 UTC · original
CryingLaughing:fix/vfs-readonly-delete → main · +211 −3 · 4 files · 1 commits · open

DeleteFileW on a virtual game path could report success for a read-only file. Reject deletion of a read-only original with ERROR_ACCESS_DENIED and use native deletion semantics for an overlay copy. A rejected deletion leaves the file visible and preserves its contents. Related delete-by-handle PR #1054

What is in it

  • In crates/xcl/src/vfs.rs, check the original’s read-only attribute before recording a deletion marker. Preserve the move behavior for a read-only original.
  • In crates/xcl/src/vfs_hooks.rs, use native DeleteFileW for overlay deletion, with an extended path when needed. The crates/xcl/tests/vfs_readonly_delete.rs integration test exercises the installed hooks in a child process with synthetic files.

Tested

  • Revision 80cf435643189a0ea2ec31f4e4e5642539b47815 on b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7. Its tree 8a2dc2fcc438ce0c4a94554b5d5ae5d80fd4b8a5 matches the tested overlay. Windows 11 25H2 build 26200.9974, Intel Core i5-13600K, RTX 4080 driver 621.01, Rust 1.100.0 x64 MSVC, and DXC 1.8.2502.11. Debug build and test profiles.
  • The focused delete_file_respects_readonly_attribute test in vfs_readonly_delete failed on the parent (0 passed, 1 failed) because virtual DeleteFileW reported success for readonly-original.txt. The fixed tree passed 1/1. Both readonly-original.txt and readonly-overlay.txt returned ERROR_ACCESS_DENIED and kept their contents. Writable deletion, a path longer than MAX_PATH, a read-only move, native-path behavior, and deletion markers checked after reopening also passed.
  • cargo build --workspace --locked -j 4 passed. cargo test --workspace --locked -j 4 -- --test-threads=4 --show-output reported 1,436 passed, 0 failed, 47 ignored, with 29 explicit skip messages in the pass count across 38 harnesses.

Regression run

Independent retail smoke by Anon64 compared release builds of main and this exact head on an RTX 3060 12 GB (driver 581.80), Core i9-14900KF, and Windows 11 build 26200. The 60-second runs used the same title. The head retained 99.5% of the baseline frames and used 103.1% of its peak commit, with zero crashes or device removals. The run did not establish whether the title reached the changed code.

main:

xcl-smoke v1
commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7
gpu: NVIDIA GeForce RTX 3060
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1461 (PresentX 1462)
presents per 2 s (last 3): 10 1 1
device removals: 0
crashes: 0
peak commit: 23855 MB

PR:

xcl-smoke v1
commit: 80cf435643189a0ea2ec31f4e4e5642539b47815
gpu: NVIDIA GeForce RTX 3060
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1454 (PresentX 1455)
presents per 2 s (last 3): 13 0 1
device removals: 0
crashes: 0
peak commit: 24590 MB

Not tested

  • Retail game file deletion. The integration test used synthetic local files.
**@⁠CryingLaughing** on GitHub · 2026-11-26 14:06 UTC · [original](https://github.com/xcl-dev/xcl/pull/2809) `CryingLaughing:fix/vfs-readonly-delete` → `main` · +211 −3 · 4 files · 1 commits · open `DeleteFileW` on a virtual game path could report success for a read-only file. Reject deletion of a read-only original with `ERROR_ACCESS_DENIED` and use native deletion semantics for an overlay copy. A rejected deletion leaves the file visible and preserves its contents. [Related delete-by-handle PR #1054](https://git.gtahub.st/github/xcl-dev--xcl/pulls/1054) **What is in it** - In `crates/xcl/src/vfs.rs`, check the original’s read-only attribute before recording a deletion marker. Preserve the move behavior for a read-only original. - In `crates/xcl/src/vfs_hooks.rs`, use native `DeleteFileW` for overlay deletion, with an extended path when needed. The `crates/xcl/tests/vfs_readonly_delete.rs` integration test exercises the installed hooks in a child process with synthetic files. **Tested** - Revision `80cf435643189a0ea2ec31f4e4e5642539b47815` on `b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7`. Its tree `8a2dc2fcc438ce0c4a94554b5d5ae5d80fd4b8a5` matches the tested overlay. Windows 11 25H2 build 26200.9974, Intel Core i5-13600K, RTX 4080 driver 621.01, Rust 1.100.0 x64 MSVC, and DXC 1.8.2502.11. Debug build and test profiles. - The focused `delete_file_respects_readonly_attribute` test in `vfs_readonly_delete` failed on the parent (0 passed, 1 failed) because virtual `DeleteFileW` reported success for `readonly-original.txt`. The fixed tree passed **1/1**. Both `readonly-original.txt` and `readonly-overlay.txt` returned `ERROR_ACCESS_DENIED` and kept their contents. Writable deletion, a path longer than `MAX_PATH`, a read-only move, native-path behavior, and deletion markers checked after reopening also passed. - `cargo build --workspace --locked -j 4` passed. `cargo test --workspace --locked -j 4 -- --test-threads=4 --show-output` reported **1,436 passed, 0 failed, 47 ignored**, with 29 explicit skip messages in the pass count across 38 harnesses. **Regression run** [Independent retail smoke by Anon64](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2809) compared release builds of main and this exact head on an RTX 3060 12 GB (driver 581.80), Core i9-14900KF, and Windows 11 build 26200. The 60-second runs used the same title. The head retained 99.5% of the baseline frames and used 103.1% of its peak commit, with zero crashes or device removals. The run did not establish whether the title reached the changed code. main: ``` xcl-smoke v1 commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7 gpu: NVIDIA GeForce RTX 3060 title: 21222967 seconds: 60 exit: 0x0 frames shown: 1461 (PresentX 1462) presents per 2 s (last 3): 10 1 1 device removals: 0 crashes: 0 peak commit: 23855 MB ``` PR: ``` xcl-smoke v1 commit: 80cf435643189a0ea2ec31f4e4e5642539b47815 gpu: NVIDIA GeForce RTX 3060 title: 21222967 seconds: 60 exit: 0x0 frames shown: 1454 (PresentX 1455) presents per 2 s (last 3): 13 0 1 device removals: 0 crashes: 0 peak commit: 24590 MB ``` **Not tested** - Retail game file deletion. The integration test used synthetic local files.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 14:11:13 +00:00
Author
Owner

@⁠Anon64 on GitHub · 2026-11-26 14:44 UTC · original

Regression run of 80cf435 on a newer retail title: no device removal, no crash, frames and commit within the limits.

Setup: RTX 3060 12 GB (NVIDIA 581.80), i9-14900KF, Windows 11 26200, release builds of main b49be18 (this PR's base) and of this PR's exact head, scripts/smoke.ps1 -Game <title> for 60 s with XCL_NETWORK=0 and A pressed every 4 s from 20 s. Main ran before and after a batch of 11 PRs and peaked at 23,855 and 23,844 MB, so the baseline held steady over the batch.

main:

xcl-smoke v1
commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7
gpu: NVIDIA GeForce RTX 3060
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1461 (PresentX 1462)
presents per 2 s (last 3): 10 1 1
device removals: 0
crashes: 0
peak commit: 23855 MB

this PR:

xcl-smoke v1
commit: 80cf435643189a0ea2ec31f4e4e5642539b47815
gpu: NVIDIA GeForce RTX 3060
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1454 (PresentX 1455)
presents per 2 s (last 3): 13 0 1
device removals: 0
crashes: 0
peak commit: 24590 MB

99 % of main's frames, 103 % of its peak commit. One run each.

Not tested: the suite on this head; whether the title reaches the code this PR changes in its first 60 s; AMD.

AI use: Claude Code (Claude Opus 5.5) ran these runs on this machine and wrote this report.

**@⁠Anon64** on GitHub · 2026-11-26 14:44 UTC · [original](https://github.com/xcl-dev/xcl/pull/2809#issuecomment-7195248544) **Regression run of `80cf435` on a newer retail title: no device removal, no crash, frames and commit within the limits.** **Setup:** RTX 3060 12 GB (NVIDIA 581.80), i9-14900KF, Windows 11 26200, release builds of main `b49be18` (this PR's base) and of this PR's exact head, `scripts/smoke.ps1 -Game <title>` for 60 s with `XCL_NETWORK=0` and A pressed every 4 s from 20 s. Main ran before and after a batch of 11 PRs and peaked at 23,855 and 23,844 MB, so the baseline held steady over the batch. main: ``` xcl-smoke v1 commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7 gpu: NVIDIA GeForce RTX 3060 title: 21222967 seconds: 60 exit: 0x0 frames shown: 1461 (PresentX 1462) presents per 2 s (last 3): 10 1 1 device removals: 0 crashes: 0 peak commit: 23855 MB ``` this PR: ``` xcl-smoke v1 commit: 80cf435643189a0ea2ec31f4e4e5642539b47815 gpu: NVIDIA GeForce RTX 3060 title: 21222967 seconds: 60 exit: 0x0 frames shown: 1454 (PresentX 1455) presents per 2 s (last 3): 13 0 1 device removals: 0 crashes: 0 peak commit: 24590 MB ``` 99 % of main's frames, 103 % of its peak commit. One run each. **Not tested:** the suite on this head; whether the title reaches the code this PR changes in its first 60 s; AMD. AI use: Claude Code (Claude Opus 5.5) ran these runs on this machine and wrote this report.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2809/head:github-bot/gh-2809'
git switch 'github-bot/gh-2809'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2809'
git switch 'github-bot/gh-2809'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2809'
git switch 'github-bot/gh-2809'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2809'
git switch 'main'
git merge --squash 'github-bot/gh-2809'
git switch 'main'
git merge --ff-only 'github-bot/gh-2809'
git switch 'main'
git merge 'github-bot/gh-2809'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.