VFS: reject creation beneath existing virtual files #613

Open
WebIdentity1 wants to merge 1 commit from upstream-pr/618 into main
WebIdentity1 commented 2026-11-24 02:33:37 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by WebIdentity1 on 2026-11-24T02:33:37Z.


Creating a file or directory below an original game file could create overlay directories that hide that file. Check visible ancestors before either operation changes the overlay, and return ERROR_PATH_NOT_FOUND for a file parent. Existing automatic creation of missing directories and replacement of deleted originals are preserved.

Part of #577, item 2 only. Item 1 is being investigated by fladit123; item 3 is outside this patch. #316 changes classification in the same file; its current diff applies cleanly to this branch, but that combined tree was not executed.

Current integration status (November24)
#1259 adds an immediate-parent directory check to prepare_write, overlapping this PR's file-creation protection but deliberately leaving create_dir unchanged. It also rejects missing/removed parents, whereas this patch preserves the old automatic-parent policy and tests it. Do not combine the patches mechanically: reconcile that policy/test interaction first. No integrated result is claimed. Existing branches and evidence are preserved.

What is in it

  • vfs.rs: parent-type check in prepare_write and create_dir, with three synthetic regression tests. README documents the refusal.

Tested

  • Head c741a2a85cc3527a4e15a457d791762dee67f0ef, base cb868b200517d7b11bbfcb0146bf0c787ce632b6. Windows 10 build 19045, Ryzen 7 7800X3D, RTX 3090 driver 591.74 plus AMD integrated graphics driver 32.0.21030.2001, Rust 1.98.1 MSVC, SDK DXC 1.8.2502.11, Agility 1.620.2, debug. Desktop session, XCL_ADAPTER=3090; some upstream fixtures select AMD directly.
  • cargo build --locked --workspace: succeeded for both trees. Candidate cargo test --locked --workspace --no-fail-fast -- --test-threads=4 --show-output: 687 passed, 1 failed, 41 ignored. Only gpu_clamp_and_omod_per_instruction failed, also present on the baseline.
  • Baseline four-thread attempt timed out after 180 s, with gpu_uma_import_check_at_init, large_heaps_get_shared_pages_as_used, slots_copy_and_release, and copy_descriptors_remaps_xbox_extra_cbv_srv_uav_to_pc_enum stalled. Baseline diagnostic with --test-threads=1: 684 passed, 1 failed, 41 ignored, same CLAMP failure. This patch is not claimed to fix the intermittent parallel stall.
  • Four explicit skips in each completed run: gpu_geometry_wave32_prefix_count_over_a_mask and gpu_wave32_program_in_wave64_hardware (no native wave64 on NVIDIA); test_title_draws_with_a_root_signature_under_the_debug_layer and uploads_start_from_each_subresources_state (debug layer unavailable). Unset XCL_SAMPLE_* cases return early.
  • cargo test --locked -p xcl --lib vfs::tests:: -- --test-threads=4 --show-output: old runtime plus the new tests 10/3/0; candidate 12/1/0. Both new rejection tests fail before the fix and pass after; native Win32 rejects with error 3. The third test preserves missing/deleted-parent behavior. The remaining focused failure is the existing truncate_existing_validation_errors (127 vs 5), present in both trees; it passes in the completed full-suite runs. Its first under_wine() call precedes GetLastError() and can overwrite the error.

Regression run
Independent contributor Anon64 supplied these exact-head/main runs, copied verbatim. These are their measurements, not ours. RTX3060 12GB driver581.80, i9-14900KF, Windows11 26200.9974, Rust1.90.0, release; same title/duration, clean source, scripts/smoke.ps1. They did not test whether that title writes below a game file; our synthetic tests cover the error path.

xcl-smoke v1
commit: cb868b200517d7b11bbfcb0146bf0c787ce632b6
gpu: NVIDIA GeForce RTX 3060
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1611 (PresentX 1611)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14564 MB
xcl-smoke v1
commit: c741a2a85cc3527a4e15a457d791762dee67f0ef
gpu: NVIDIA GeForce RTX 3060
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1615 (PresentX 1615)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 14563 MB

Draft retained: conflicts with current main and required CI remains outstanding. The code/head is unchanged; these runs do not qualify any future refresh.

Not tested
By us: retail behavior, release builds, Wine, concurrent namespace changes, or a combined tree with #316. The independent startup smoke above is not direct validation of the changed error path. No claim of the retail title gameplay progress.

AI use
Codex (GPT-6) inspected the issue and overlap, implemented the patch and synthetic tests, ran native Windows validation, and prepared this description.

<!-- greyfinch-sync:ivall/xcl:issue:5464995679 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/618). Originally posted by [WebIdentity1](https://github.com/WebIdentity1) on 2026-11-24T02:33:37Z. --- Creating a file or directory below an original game file could create overlay directories that hide that file. Check visible ancestors before either operation changes the overlay, and return `ERROR_PATH_NOT_FOUND` for a file parent. Existing automatic creation of missing directories and replacement of deleted originals are preserved. Part of #577, **item 2 only**. Item 1 is being investigated by fladit123; item 3 is outside this patch. #316 changes classification in the same file; its current diff applies cleanly to this branch, but that combined tree was not executed. **Current integration status (November24)** #1259 adds an immediate-parent directory check to `prepare_write`, overlapping this PR's file-creation protection but deliberately leaving `create_dir` unchanged. It also rejects missing/removed parents, whereas this patch preserves the old automatic-parent policy and tests it. Do not combine the patches mechanically: reconcile that policy/test interaction first. No integrated result is claimed. Existing branches and evidence are preserved. **What is in it** - `vfs.rs`: parent-type check in `prepare_write` and `create_dir`, with three synthetic regression tests. README documents the refusal. **Tested** - Head `c741a2a85cc3527a4e15a457d791762dee67f0ef`, base `cb868b200517d7b11bbfcb0146bf0c787ce632b6`. Windows 10 build 19045, Ryzen 7 7800X3D, RTX 3090 driver 591.74 plus AMD integrated graphics driver 32.0.21030.2001, Rust 1.98.1 MSVC, SDK DXC 1.8.2502.11, Agility 1.620.2, debug. Desktop session, `XCL_ADAPTER=3090`; some upstream fixtures select AMD directly. - `cargo build --locked --workspace`: succeeded for both trees. Candidate `cargo test --locked --workspace --no-fail-fast -- --test-threads=4 --show-output`: **687 passed, 1 failed, 41 ignored**. Only `gpu_clamp_and_omod_per_instruction` failed, also present on the baseline. - Baseline four-thread attempt timed out after 180 s, with `gpu_uma_import_check_at_init`, `large_heaps_get_shared_pages_as_used`, `slots_copy_and_release`, and `copy_descriptors_remaps_xbox_extra_cbv_srv_uav_to_pc_enum` stalled. Baseline diagnostic with `--test-threads=1`: **684 passed, 1 failed, 41 ignored**, same CLAMP failure. This patch is not claimed to fix the intermittent parallel stall. - Four explicit skips in each completed run: `gpu_geometry_wave32_prefix_count_over_a_mask` and `gpu_wave32_program_in_wave64_hardware` (no native wave64 on NVIDIA); `test_title_draws_with_a_root_signature_under_the_debug_layer` and `uploads_start_from_each_subresources_state` (debug layer unavailable). Unset `XCL_SAMPLE_*` cases return early. - `cargo test --locked -p xcl --lib vfs::tests:: -- --test-threads=4 --show-output`: old runtime plus the new tests **10/3/0**; candidate **12/1/0**. Both new rejection tests fail before the fix and pass after; native Win32 rejects with error 3. The third test preserves missing/deleted-parent behavior. The remaining focused failure is the existing `truncate_existing_validation_errors` (127 vs 5), present in both trees; it passes in the completed full-suite runs. Its first `under_wine()` call precedes `GetLastError()` and can overwrite the error. **Regression run** Independent contributor [Anon64 supplied these exact-head/main runs](https://github.com/ivall/xcl/pull/618#issuecomment-7124531869), copied verbatim. These are their measurements, not ours. RTX3060 12GB driver581.80, i9-14900KF, Windows11 26200.9974, Rust1.90.0, release; same title/duration, clean source, `scripts/smoke.ps1`. They did not test whether that title writes below a game file; our synthetic tests cover the error path. ``` xcl-smoke v1 commit: cb868b200517d7b11bbfcb0146bf0c787ce632b6 gpu: NVIDIA GeForce RTX 3060 title: retail-title seconds: 60 exit: 0x0 frames shown: 1611 (PresentX 1611) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14564 MB ``` ``` xcl-smoke v1 commit: c741a2a85cc3527a4e15a457d791762dee67f0ef gpu: NVIDIA GeForce RTX 3060 title: retail-title seconds: 60 exit: 0x0 frames shown: 1615 (PresentX 1615) presents per 2 s (last 3): 61 60 60 device removals: 0 crashes: 0 peak commit: 14563 MB ``` Draft retained: conflicts with current main and required CI remains outstanding. The code/head is unchanged; these runs do not qualify any future refresh. **Not tested** By us: retail behavior, release builds, Wine, concurrent namespace changes, or a combined tree with #316. The independent startup smoke above is not direct validation of the changed error path. No claim of the retail title gameplay progress. **AI use** Codex (GPT-6) inspected the issue and overlap, implemented the patch and synthetic tests, ran native Windows validation, and prepared this description.
Anon64 commented 2026-11-24 07:06:55 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Anon64 on 2026-11-24T07:01:25Z.


Regression runs for this PR's head c741a2a and for its base main cb868b2, on a retail title (same title, 60 s each), made with scripts/smoke.ps1 (release, clean tree at each commit) and pasted unedited, for Regression run.

main:

xcl-smoke v1
commit: cb868b200517d7b11bbfcb0146bf0c787ce632b6
gpu: NVIDIA GeForce RTX 3060
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1611 (PresentX 1611)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14564 MB

this PR:

xcl-smoke v1
commit: c741a2a85cc3527a4e15a457d791762dee67f0ef
gpu: NVIDIA GeForce RTX 3060
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1615 (PresentX 1615)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 14563 MB

Tested

  • NVIDIA GeForce RTX 3060 12 GB (driver 581.80, wave32), Intel Core i9-14900KF, Windows 11 25H2 26200.9974, Rust 1.90.0

Not tested

  • the unit tests on this machine
  • whether the title writes below a game file; this is a regression check only

Report written with Claude Code (Claude Opus 5.5) from runs on this machine.

<!-- greyfinch-sync:ivall/xcl:comment:7124531869 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/618#issuecomment-7124531869). Originally posted by [Anon64](https://github.com/Anon64) on 2026-11-24T07:01:25Z. --- Regression runs for this PR's head `c741a2a` and for its base `main` `cb868b2`, on a retail title (same title, 60 s each), made with `scripts/smoke.ps1` (release, clean tree at each commit) and pasted unedited, for **Regression run**. main: ``` xcl-smoke v1 commit: cb868b200517d7b11bbfcb0146bf0c787ce632b6 gpu: NVIDIA GeForce RTX 3060 title: retail-title seconds: 60 exit: 0x0 frames shown: 1611 (PresentX 1611) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14564 MB ``` this PR: ``` xcl-smoke v1 commit: c741a2a85cc3527a4e15a457d791762dee67f0ef gpu: NVIDIA GeForce RTX 3060 title: retail-title seconds: 60 exit: 0x0 frames shown: 1615 (PresentX 1615) presents per 2 s (last 3): 61 60 60 device removals: 0 crashes: 0 peak commit: 14563 MB ``` **Tested** - NVIDIA GeForce RTX 3060 12 GB (driver 581.80, wave32), Intel Core i9-14900KF, Windows 11 25H2 26200.9974, Rust 1.90.0 **Not tested** - the unit tests on this machine - whether the title writes below a game file; this is a regression check only Report written with Claude Code (Claude Opus 5.5) from runs on this machine.
DavidM1911 commented 2026-11-25 13:05:17 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T12:55:45Z.


Verification on RTX 3060 Ti (Windows 11): merge conflict with current main — needs a rebase before it can be tested.

<!-- greyfinch-sync:ivall/xcl:comment:7163051149 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/618#issuecomment-7163051149). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T12:55:45Z. --- Verification on RTX 3060 Ti (Windows 11): **merge conflict with current `main`** — needs a rebase before it can be tested.
github-actions[bot] commented 2026-11-29 07:43:10 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-29T07:43:10Z.


Nothing has happened on this PR for 3 days, so it is marked stale and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto main if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.

<!-- greyfinch-sync:ivall/xcl:comment:7252647221 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/618#issuecomment-7252647221). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-29T07:43:10Z. --- Nothing has happened on this PR for 3 days, so it is marked `stale` and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto `main` if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.
Foniass commented 2026-12-01 03:49:09 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T03:49:09Z.


Triage (#1607) – head c741a2a

This fixes part 2 of #577 (a write or create_dir below a game file creates an overlay directory with the file's name); #644 fixes part 1 (CREATE_ALWAYS on a game directory), and #761 (merged) part 3. Main still lacks the check in prepare_write and create_dir.
Overlap: #1259 also adds a parent check to prepare_write, but refuses any parent that is not a directory, so it also refuses missing parents (and does not touch create_dir). This PR refuses only parents that exist and are files, and keeps missing parents allowed as the directories test expects. The two conflict; only one of them should land.
No problems found in the diff.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7300094396 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/618#issuecomment-7300094396). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T03:49:09Z. --- **Triage (#1607)** – head c741a2a This fixes part 2 of #577 (a write or `create_dir` below a game file creates an overlay directory with the file's name); #644 fixes part 1 (`CREATE_ALWAYS` on a game directory), and #761 (merged) part 3. Main still lacks the check in `prepare_write` and `create_dir`. Overlap: #1259 also adds a parent check to `prepare_write`, but refuses any parent that is not a directory, so it also refuses missing parents (and does not touch `create_dir`). This PR refuses only parents that exist and are files, and keeps missing parents allowed as the `directories` test expects. The two conflict; only one of them should land. No problems found in the diff. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/618:upstream-pr/618'
git switch 'upstream-pr/618'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/618'
git switch 'upstream-pr/618'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/618'
git switch 'upstream-pr/618'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/618'
git switch 'main'
git merge --squash 'upstream-pr/618'
git switch 'main'
git merge --ff-only 'upstream-pr/618'
git switch 'main'
git merge 'upstream-pr/618'
git push origin 'main'
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!613
No description provided.