Repository navigation
Description
Static read of crates/xcl/src/vfs.rs and vfs_hooks.rs on main (508a0c7). In the first two cases a write that Windows would refuse succeeds and leaves an overlay entry of the wrong kind. The overlay is persistent, so the damage outlasts the run.
-
CREATE_ALWAYSon a game directory creates an overlay file that hides it (vfs.rs:585-593)- Only
TRUNCATE_EXISTINGhas a directory check (:568-583). ForCREATE_ALWAYSon a directory that exists only in the game folder,replaces_originalis false (is_file()),prepare_write(rel, false)succeeds and the decision isUse(<overlay>\data). The native open then creates a regular file there. - Trigger:
open_decision("G:\\data", GENERIC_WRITE, CREATE_ALWAYS, 0)on the testFixture. - Result: afterwards
is_dir("data")is false (:454sees the overlay file first), so listingdata\*givesERROR_PATH_NOT_FOUNDand writes below it fail. Expected:Decision::Fail(ERROR_ACCESS_DENIED)and no overlay entry, as in theTRUNCATE_EXISTINGbranch. - Suggested fix: before
prepare_write, fail withERROR_ACCESS_DENIEDwhendisposition == CREATE_ALWAYS && !ov_entry && in_origand the original is a directory.
- Only
-
A write below a game file creates an overlay directory with that file's name (
vfs.rs:512-516prepare_write,:625-629create_dir)- Both call
create_dir_allon the overlay path without checking that the virtual parent is a directory.stage_write(:483-488) has such a check. - Trigger:
open_decision("G:\\data\\hello.txt\\x.bin", GENERIC_WRITE, CREATE_ALWAYS, 0)orcreate_dir("data\\hello.txt\\sub"). - Result: success, and
<overlay>\data\hello.txtis now a directory.read_path_rel("data\\hello.txt")returns that directory, so the game file cannot be read until the overlay is cleaned. Expected:ERROR_PATH_NOT_FOUND, nothing created. - Suggested fix: walk the ancestors of
reland returnERROR_PATH_NOT_FOUNDwhen one exists (overlay or visible original) and is not a directory, beforeprepare_writein the write branch and at the top ofcreate_dir. Missing parents must stay allowed: thedirectoriestest expectscreate_dir("saves\\slot1")to work withoutsaves.
- Both call
-
FindFirstFileon a mount root lists the host folders themselves (vfs_hooks.rs:988-1004), low impact- For
G:\the relative path is empty, sodir_relandpatternare both empty andjoinreturns the bare folder path. The search then finds the overlay folder and the game folder as entries. - Trigger:
collect_game_entries(v, "", real_collect)returnsOkwith an entry named like the game folder. Expected:ERROR_FILE_NOT_FOUND. - Suggested fix:
if rel.is_empty() { return Err(vfs::ERROR_FILE_NOT_FOUND); }at the top ofcollect_game_entries.
- For
Each trigger can be a unit test next to truncate_existing_validation_errors, with the same native CreateFileW reference call deciding the expected error code.
Not tested: nothing was built or run (read on Linux; no game files). The XCL side is traced through the code by hand; the expected Win32 error codes are from memory, not from a run. Not checked: whether a retail title does any of this. Open PR #316 touches vfs.rs for other reasons and does not cover these.
AI use: found and written with Claude Code (Claude Fable 5.2), static code review only, under human review.
Activity
fladit123 commentedon Nov 24, 2026
I'll investigate item 1 on native Windows, using synthetic temporary directories and CreateFileW as the reference.
I'll focus on reproducing the CREATE_ALWAYS directory case, checking the expected Win32 error codes and verifying that a rejected operation leaves the overlay unchanged.
I'll keep items 2 and 3 outside this initial scope.
AI use: ChatGPT (GPT-6.2) assisted with issue selection and investigation planning.
WebIdentity1 commentedon Nov 24, 2026
Draft #618, head
c741a2a, addresses item 2 only: writes and directory creation beneath an existing virtual file must fail without creating overlay parents or hiding the original. Native Win32 returned error 3; both new rejection tests failed with the old runtime and passed with the fix. The third test preserves missing/deleted-parent recreation. Full candidate four-thread workspace: 687 passed / 1 existing CLAMP failure / 41 ignored, four explicit skips. Baseline parallel timeout and serial result, plus the existing focused truncate-test failure, are disclosed in the draft. Retail smoke is still needed.This excludes the CREATE_ALWAYS-on-directory case being investigated by @fladit123 and item 3. #316 touches VFS path classification; its current diff applies cleanly to this branch, but the combined tree was not run.
AI use: Codex (GPT-6), investigation, implementation and native Windows validation.
VFS: reject CREATE_ALWAYS on original directories (ivall#577)
fladit123 commentedon Nov 24, 2026
Item 1 is implemented in #644. The regression test fails on the original runtime and passes with the fix, matching native Win32 error codes.
Full workspace validation on my RTX 4060: 688 passed, 0 failed, 41 ignored (two explicit wave64 capability skips).
Items 2 and 3 remain outside my PR's scope. Independent AMD validation and both retail smoke runs have now passed, thanks to @eizispark. The results are documented in #644, and the PR description check is green.
AI use: Codex (GPT-6) and ChatGPT (GPT-6.2) assisted with implementation, testing and reporting.
pickles976 commentedon Nov 24, 2026
Cross-run adjudication of the open PRs (2026-11-24, Linux cross-build + Wine 9; repros = the two case tests from each PR's head, applied to
mainand to each other's heads):CREATE_ALWAYSon a directory)mainSo the two PRs are complementary, not competing — each passes exactly the case its own test encodes, and neither touches the other's path. Merging one leaves the other defect in. Their README edits collide in one line, trivially.
There is also a third uncovered case:
rel == ""(a search on the bare mount root) classifiesFindFirstFileW("G:\\")asGame { rel: "" }and lists the host overlay/game directories as entries of the title's root. Fix + test in #763 — disjoint from both cases above. Suggest: merge all three (any order; only README lines conflict), then close #577 with the three-way map.Harness for repro: cross-build recipe in #520 (llvm-mingw linker, static libunwind),
cargo test -p xcl --lib --target x86_64-pc-windows-gnuunder Wine — note two of the module's tests need Wine ≥ 11 (they callCopyFile2, which Wine 9 lacks entirely; #175).pickles976 commentedon Nov 24, 2026
Follow-up on the case-3 row: I opened #763 for it, but #761 (upipibi) landed the identical guard ~3 minutes earlier with a stronger test (compares against the live native
FindFirstFileExW("C:\\")rather than a pinned expectation) — I closed mine as a duplicate. The merge recommendation stands with the names fixed: #618 + #644 + #761 covers all three cases of this issue; any pair leaves one defect in.emirduran707 commentedon Nov 24, 2026
One more case of the same kind, not covered by #618 (whose description keeps "automatic creation of missing directories") or #644: a write whose parent folder exists in neither the game folder nor the overlay succeeds and creates that folder. Read on
main47efa2e:prepare_write(vfs.rs:512-516) runscreate_dir_allon the overlay parent without checking that the parent exists in the merged view. This copy is needed when the parent exists only in the game folder, but not when it exists nowhere, or was removed (whited out).CreateFileW("G:\nodir\f.bin", GENERIC_WRITE, CREATE_ALWAYS), andOPEN_ALWAYS/CREATE_NEW(also with read access only), succeeds and createsnodir. Windows fails withERROR_PATH_NOT_FOUND(3).nodirhad been removed,commit_write→remove_whiteoutbrings the folder back, empty. Its original children stay hidden, becauseremove_whiteoutpushes the whiteout down to them.create_dir(vfs.rs:629) does the same throughcreate_dir_all:CreateDirectoryW("G:\a\b")creates a missinga. The CreateDirectoryW docs say it fails withERROR_PATH_NOT_FOUNDwhen an intermediate folder does not exist.stage_write(vfs.rs:484-487), used by copy and move, already checks the parent, soCreateFileWandCopyFileWdisagree on the same path.Suggested fix: in
prepare_writeandcreate_dir, fail withERROR_PATH_NOT_FOUNDunless the virtual parent is a folder (is_dir(parent), the game root counting as one), before anything is created. This touches the same lines as #618, so it would best come after it.Not tested by running; found by reading the code (with Claude Code, Claude Opus 5.5, in an audit of the VFS against Win32), and checked against the lines above.
VFS: fail FindFirstFile on a mount root like a native drive root (xcl…
VFS: a write below a missing parent fails, it does not conjure the fo…