VFS: reject removal of non-empty virtual directories #1016
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!1016
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1016/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@anakatt on GitHub · 2026-11-24 10:24 UTC · original
anakatt:vfs/reject-nonempty-directories→main· +76 −2 · 3 files · 1 commits · closed without mergingRemoveDirectoryW could hide a non-empty game directory permanently because removal checked only overlay contents. This change checks visible original children before changing the overlay or publishing a whiteout. Fixes #997.
What is in it
crates/xcl/src/vfs.rs: reject visible original children, preserve the overlay on failure, and cover merged contents, whiteouts, subdirectories and persistence.crates/xcl/src/vfs_hooks.rs: update directory-enumeration coverage to empty a directory before removing it.README.md: document directory-removal behavior.Tested
cargo test -p xcl --lib vfs -- --test-threads=4on macOS exited with code 101 while compiling Windows dependencies. No tests executed in that attempt.Regression run
xcl-smokeblocks from main and clean PR headac25fd121b7761605955491accf4e2c208f9ebaa, using the same title and duration.Not tested
AI use
openai-codex/gpt-6-astra) to investigate the issue, write the implementation, regression tests and documentation, attempt local validation, and prepare this description. I ran the Windows 11 tests myself.@emirduran707 on GitHub · 2026-11-24 10:39 UTC · original
AMD test report for
ac25fd1(this PR's head, onmain6efdabc), with the counts and smoke blocks the description still asks for. Feel free to copy them into it; they are from my machine.Tested
x86_64-pc-windows-msvc; DXC 1.9.2602.17; debug for the suite, release for the runs.cargo test --workspace -- --test-threads=4atac25fd1: 729 passed, 0 failed, 41 ignored; noSKIPPEDlines.scripts/smoke.ps1 -Game <retail title>, 60 s, no input,mainthen this PR, back to back. Thegpu:line names a virtual display adapter of this machine (#281 / #282 / #285); XCL's log names the RX 9060 XT.main:
PR:
(On this title the peak commit swings between about 16 and 22 GB from run to run, as short peaks at about 16 s and 33 s. Here both runs caught them.)
Review: I made the same fix for #997 locally before I saw this PR, and the two check the same things: visible game children, and the overlay through
fs::remove_dir. One note:recreating_removed_directory_does_not_resurrect_original_childrennow deletes the children one by one before removingdata. So it no longer covers what it was written for: a folder whited out as a whole while it still had game entries. Runs before this change saved exactly such whiteouts to.xcl_whiteouts, andremove_whiteout's push-down still has to handle them.Not tested: NVIDIA; Wine; a title that removes a non-empty folder of its own.
Tested and written with Claude Code (Claude Opus 5.5). The runs were made on my machine.
@ivall on GitHub · 2026-11-24 11:04 UTC · original
Merged as
47efa2e(your commit, without its README sentence: the README tells users what works, and this is how Windows behaves anyway) – thanks, and thanks to @emirduran707 for the counts and smoke runs. Checked: without the twocheck_original_dir_emptycalls, 4 tests fail (directories,remove_dir_checks_both_layers_before_removing_overlay,remove_dir_rejects_visible_subdirectories,find_first_on_whited_out_and_recreated_directory). Tested on the merged batch (#990, #1037, #951, #1016):cargo test --workspace --no-fail-fast -- --test-threads=4: 741 passed, 0 failed, 41 ignored, no SKIPPED. Retail title, 90 s with scripted presses, againstmainbefore the batch the same way: exit 0, no crash, no device removal, 1500 frames, peak process commit 27.7 GB against 29.2 GB.@thehollowedone on GitHub · 2026-11-24 11:20 UTC · original
I checked the pre-fix overlay case raised in the review above on Windows 11 at 47efa2e.
A synthetic fixture started with only a directory-level whiteout in
.xcl_whiteouts. Recreating the directory kept the original files and nested directory hidden. An overlay file blocked removal withERROR_DIR_NOT_EMPTY. After deleting that file, removal succeeded, the directory stayed hidden after reopening the VFS, and the original file bytes were intact.Offline workspace build passed. All 22 stock VFS and hook tests passed, as did the separate fixture. AI-assisted. Codex (GPT-6) added and ran the scratch fixture.
Pull request closed