VFS: fix Unicode case-folding slicing and verbatim root normalisation #316
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!316
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-316"
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?
@Michael-Glaser on GitHub · 2026-11-23 23:08 UTC · original
Michael-Glaser:fix/vfs-unicode-and-verbatim-root→main· +91 −18 · 1 files · 1 commits · openVfs::classify_withsliced un-lowercasedabsusingself.game_root.len() + 1after.to_lowercase(), which panics or corruptsrelwhen Unicode case folding changes UTF-8 byte length (ẞ,İ,K).Vfs::newalso missedstrip_verbatimongame_rootanddata_root_lc.What is in it
crates/xcl/src/vfs.rs: matchgame_root_lcper\component (strip_path_prefix_ci), applystrip_verbatim+trim_septo roots inVfs::new, and addclassify_handles_unicode_case_folding_and_verbatim_roots.Tested
aarch64-apple-darwin, Rust 1.100.0):cargo check --offline --target x86_64-pc-windows-msvc --workspace --tests(0 errors, 0 new warnings).Not tested
cargo testandscripts/smoke.ps1not run yet.AI use
@0xKaji on GitHub · 2026-11-23 23:49 UTC · original
Reviewed commit
f0bd1eastatically on Linux (not built or executed on Windows; assisted by T3 Code + Gemini 4 Neon).strip_path_prefix_cilooks sound: every slice index is on an ASCII\boundary withinabs, so it eliminates the UTF-8 slicing panics and corruptedrelslices for length-changing case folds (ẞ,İ,K) without introducing regressions on standard paths.A few concrete items before moving this out of draft:
Merge blockers (
CONTRIBUTING.md/PR checks):PR checksis currently failing becausecrates/xcl/src/vfs.rsis runtime code and**Regression run**is missing the twoxcl-smoke v1blocks (mainand PR headf0bd1ea, clean working tree) fromscripts/smoke.ps1.cargo test --workspace -- --test-threads=4counts (and greenCI) are still needed in**Tested**.strip_verbatim(crates/xcl/src/vfs.rs:102-113) mishandles lowercase\\?\unc\...and\??\UNC\...:strip_verbatim, but now also called fromVfs::new(vfs.rs:192, 207, 210).is_device(vfs.rs:157-160) matches\\?\and\??\with ASCII case-insensitiveunc\, whereasstrip_verbatimonly checks exact uppercase"\\\\?\\UNC\\".\\?\unc\server\share\file.binand\??\UNC\server\share\file.binbypassis_device, fall through tostrip_prefix("\\\\?\\")/strip_prefix("\\??\\"), and become relative"unc\\server\\share\\file.bin"/"UNC\\server\\share\\file.bin". That bypasses thep.starts_with("\\\\")UNC guard (vfs.rs:286) and resolves relative to CWD (misclassifying asTarget::Gamewhen CWD is insidegame_root).\\?\or\??\first and then checkingr.get(..4).is_some_and(|s| s.eq_ignore_ascii_case("UNC\\"))would keepstrip_verbatimconsistent withis_device(fine either here or as a small follow-up PR).Minor non-blocking edge cases / test notes:
strip_path_prefix_ci(vfs.rs:143),&abs[pos + 1..]returns a leading\ifabshas repeated separators after the root (e.g.classify_with("C:\\Games\\Title\\\\Data\\a.bin", id)→rel: "\\Data\\a.bin").GetFullPathNameWcollapses\\for normal paths, butabs[pos + 1..].trim_start_matches('\\')guarantees theTarget::Gameinvariant unconditionally.game_rootis a drive root likeX:\or\\?\X:\,trim_sepstores"X:", sooriginal_path("")returns"X:"(drive-relative CWD in Win32) instead of"X:\\".classify_handles_unicode_case_folding_and_verbatim_roots, it would be useful to also assertvc.classify_with("C:\\Games\\Title\\Data\\x.bin", id)(verbatimgame_root_lcnot hijacked by theC:mount) and a mixed/+\Unicode case-folding input.@regiumlepidi on GitHub · 2026-11-23 23:56 UTC · original
A Windows run for this draft, since Not tested says it has not been built or run on Windows yet:
f0bd1eamerged onto currentmaindb1ddb2(clean merge): builds and passes, and the new test fails onmain.Tested
XCL_ADAPTER=radeon(the Ryzen 7 9800X3D's RDNA2 iGPU, driver 32.0.21030.2001).\scripts\test.ps1(cargo test --workspace -- --test-threads=4), noXCL_SAMPLE_*setmaindb1ddb2f0bd1eaondb1ddb2classify_handles_unicode_case_folding_and_verbatim_rootscopied unchanged intomain'svfs.rsfails at its first case, with the corrupted slice the description names:With this PR's
vfs.rsit passes.Not tested
scripts/smoke.ps1(I have no Series title), so the Regression run blocks the PR check asks for still have to come from someone who has one.\\?\unc\/\??\UNC\case raised in the review above.AI use: Claude Code with Claude Opus 5.5 ran the build and tests and wrote this comment; the numbers come from those runs.
@Michael-Glaser on GitHub · 2026-11-24 00:18 UTC · original
Thanks @0xKaji and @regiumlepidi! Rebased onto main (
a6f5f7a, commit ce99a57) and applied the review items: strip_verbatim now handles \?\ and ??\ UNC prefixes case-insensitively, strip_path_prefix_ci trims repeated separators after the root, and added the extra UNC, mixed-separator, and verbatim game_root test cases.@Toons29 on GitHub · 2026-11-25 02:55 UTC · original
Regression run of
a9ce85eaon the retail title, for this PR's Regression run section. Both blocks are fromscripts/smoke.ps1as printed, not edited:mainon4178e888, this PR on its head commit with no uncommitted changes, same title and time.Against the limits in CONTRIBUTING.md: 101 % of
main's frames, 100 % of its peak commit, no crash, no device removal.AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0,
cargo build --release -p xcl, 60 s,XCL_NETWORK=0. This is a regression check only: it does not show whether the run reaches the code this PR changes.AI use: Claude Code (Claude Opus 5.5) built both trees and ran
scripts/smoke.ps1; I checked the blocks before posting.@DavidM1911 on GitHub · 2026-11-25 14:29 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.