You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
XGameSave: a long valid container name makes every save to it fail #326
XGameSaveCreateContainer stores a container in a folder named enc(name) under the provider root (crates/xcl/src/hle/xgameruntime/gamesave.rs on main85bdf21: enc() at line 73, folder created in apply() at line 567). valid_container_name_length (line 254) allows up to 256 characters, matching the GDK maximum, but Windows caps each path component at 255 characters, and enc() expands every / (which the GDK allows in container names) into %2F (3 characters).
Examples accepted by XGameSaveCreateContainer (S_OK) whose folder cannot be created:
Container name
Name length
enc(name) length
256 ASCII letters
256
256
"a/" × 85 + "x"
171
341
Because XGameSaveCreateContainer returns S_OK, create_dir_all later fails in apply() and every XGameSaveSubmitUpdate to that container returns E_FAIL.
Repro (clean-room, Linux):
Copied enc() unchanged into a standalone program and called create_dir_all (Linux shares the 255-byte component limit): both the 256-char and 341-char names failed with File name too long.
Suggested fix:
When enc(name) exceeds ~200 characters, store the container under a shortened folder name (e.g. truncated prefix + hash of the full name) and persist the exact container name in a metadata file inside the folder for each_container to read back. Separately, enforcing the GDK's allowed character set in XGameSaveCreateContainer (returning E_GS_INVALID_CONTAINER_NAME for disallowed characters like spaces or :) would match console behavior more closely.
Not tested: on Windows or with a game.
AI use: Initially found and reproduced with Claude Code; re-verified against main (85bdf21) with Antigravity (Gemini 4 Neon).
Claim — shortened folder when enc(name) exceeds the path component limit
Plan: When enc(name) is longer than 255 bytes (Windows/Linux component max), store the container under a short folder (xcl- + SHA-256 prefix of the encoded name) and write the exact container name into a metadata file inside that folder so each_container / enumeration still round-trip. Keep valid_container_name_length at the GDK 256-char max so XGameSaveCreateContainer stays S_OK for valid names; only the on-disk folder is shortened. Unit tests for the 256-ASCII and "a/"×85+"x" cases (folder creates, enumerate returns the original name, submit works).
I'll take this one. Plan: container_dir_name() returns enc(name) while it fits (~200 chars, matching the suggestion — longer encodings never fit a Windows path component in practice anyway), otherwise ~xcllong.<sip-hash> (the ~ can't appear in enc() output, so no collision). The real name goes in a name file inside the folder, written atomically by apply() (self-healing, since apply gets the name through the Update), and each_container reads it back for ~xcllong.* dirs. delete_path/CreateContainer use the same mapping. Unit test: a 256-char name and an "a/"-heavy name round-trip through create → submit → enumerate → delete.
Opened a fix PR: uses a hashed ~xclc.<fnv> folder when enc(name) is too long, and stores the exact name in container_name for enumeration. Tests cover the 256-char case from the issue.
Comparison of the open PRs for #326 (#481, #492; #623 was closed by its author in favour of these), to help pick one.
Both store a container whose enc(name) is longer than 200 characters under a hashed folder and keep the real name in a file inside it. Both merge cleanly into mainf4ce27c and touch only gamesave.rs. I read the diffs before running them and found nothing outside the save folder and the test temp folders. Their own tests pass on the merge with main.
Neither one fixes long names fully. Below the 200-character threshold, the full path of a blob passes MAX_PATH long before the 255-character component limit. replace_file's MoveFileExW is called without the \\?\ prefix and refuses paths of 260 characters or more, so a 190-character name still fails on both PRs and on main. With the test data folder, that name gives a 267-character container folder and XGameSaveSubmitUpdate returns E_FAIL. The 256-character case in their tests passes only because the hashed folder is short. I opened XGameSave: a save whose blob path passes MAX_PATH fails (MoveFileExW without the verbatim prefix) #722 for that, with a failing test and a fix. With it, the 190-character name saves on its own. With XGameSave: a save whose blob path passes MAX_PATH fails (MoveFileExW without the verbatim prefix) #722 in, the threshold here only has to keep each component under 255.
A hash collision between two long names (64-bit, so unlikely) would put two containers in one folder. Neither PR compares the stored name when opening a container, so the second would read and write the first's blobs. Checking the name file against the requested name on open would turn that into an error instead.
Suggestion: #492 passes the checks and keeps the change to hashed folders only. It can be merged once DefaultHasher is replaced by a fixed hash (FNV-1a as in #481). Then close #481. #722 is a separate fix and works with either.
Tested on an i7-12700H with an RTX 3070 Ti Laptop, Windows 11 build 26200. Toolchain: rustc 1.100.0 x86_64-pc-windows-gnullvm, debug, cargo test -p xcl --lib gamesave on each PR merged into mainf4ce27c, plus a 190-character-name save test. Not tested: the MSVC toolchain, cargo test --workspace, smoke runs.
Written with Claude Code (Claude Opus 5.5). I checked each point against the diffs and the runs above.
Adjudication of the two PRs (design review + one measurement, 2026-11-24):
Both converge on the right shape — names whose enc() fits stay in their current folder (existing saves untouched, no migration), only over-long names move to a hash folder, and both handle the enumeration read-back (XGameSaveEnumerateContainerInfo must report the container's name, not the hash folder). Neither can collide with an enc() folder (~ is percent-encoded by enc, so both prefixes are reserved).
strip-prefix in enumeration, with enumerate-based tests
✅ success
The measurement I added: #492's choice of DefaultHasher::new()looks risky — a randomly-seeded hasher would give a different folder every process launch and silently orphan long-name saves across game sessions (worse than the original bug). It isn't: DefaultHasher::new() is deterministically seeded — I hashed the issue's ("a/"*85)+"x" case in 10 separate processes, 10/10 identical — so #492's folder mapping is run-stable. #481 doesn't need the argument (FNV has no seed at all), but its description check is red and its apply()-signature change touches more surface than the defect needs.
Recommendation: merge #492; #481's author's stored_container_name framing is the more future-proof read-back, worth cherry-picking if LONG_PREFIX ever grows — as-is it's a description-fix and a smaller-diff duplicate away from #492.
Activity
Grimkaaah commentedon Nov 24, 2026
Claim — shortened folder when
enc(name)exceeds the path component limitPlan: When
enc(name)is longer than 255 bytes (Windows/Linux component max), store the container under a short folder (xcl-+ SHA-256 prefix of the encoded name) and write the exact container name into a metadata file inside that folder soeach_container/ enumeration still round-trip. Keepvalid_container_name_lengthat the GDK 256-char max soXGameSaveCreateContainerstaysS_OKfor valid names; only the on-disk folder is shortened. Unit tests for the 256-ASCII and"a/"×85+"x"cases (folder creates, enumerate returns the original name, submit works).AI-assisted (Cursor / Composer). Working now.
DavidM1911 commentedon Nov 24, 2026
I'll take this one. Plan:
container_dir_name()returnsenc(name)while it fits (~200 chars, matching the suggestion — longer encodings never fit a Windows path component in practice anyway), otherwise~xcllong.<sip-hash>(the~can't appear inenc()output, so no collision). The real name goes in anamefile inside the folder, written atomically byapply()(self-healing, sinceapplygets the name through theUpdate), andeach_containerreads it back for~xcllong.*dirs.delete_path/CreateContaineruse the same mapping. Unit test: a 256-char name and an"a/"-heavy name round-trip through create → submit → enumerate → delete.XGameSave: long container names use a hashed folder (ivall#326)
Grimkaaah commentedon Nov 24, 2026
Opened a fix PR: uses a hashed
~xclc.<fnv>folder whenenc(name)is too long, and stores the exact name incontainer_namefor enumeration. Tests cover the 256-char case from the issue.XGameRuntime: save containers whose names do not fit a Windows path c…
XGameRuntime: save containers whose names do not fit a Windows path c…
XGameRuntime: save containers whose names do not fit a Windows path c…
XGameRuntime: save containers whose names do not fit a Windows path c…
XGameSave: blobs past MAX_PATH are moved into place
XGameSave: blobs past MAX_PATH are moved into place
lordon1a commentedon Nov 24, 2026
Comparison of the open PRs for #326 (#481, #492; #623 was closed by its author in favour of these), to help pick one.
Both store a container whose
enc(name)is longer than 200 characters under a hashed folder and keep the real name in a file inside it. Both merge cleanly intomainf4ce27c and touch onlygamesave.rs. I read the diffs before running them and found nothing outside the save folder and the test temp folders. Their own tests pass on the merge withmain.PR descriptioncheckstd::collections::hash_map::DefaultHasherPoints:
DefaultHasher, which is not stable across Rust releases. The std docs say its algorithm "is not specified, and so it and its hashes should not be relied upon over releases". The hash names a folder on disk. If a toolchain update changes it, an XCL built with the new compiler looks for long-named containers under a different folder. Those saves stop showing up, while the old folder still holds them and still enumerates through itsnamefile. XGameSave: long container names use a hashed folder (#326) #481's FNV-1a (and XGameRuntime: save containers whose names do not fit a Windows path component #623's) does not depend on the compiler. Replacing the hasher in XGameRuntime: store over-long XGameSave container names in hashed folders #492 with a fixed function is a few lines.container_nameinto every container on every update, not only the hashed ones, andeach_containerthen counts a folder holding only that file as an existing container. That changes the on-disk layout of every save made from then on. It does not break anything I found, but keeping the file only in hashed folders, as XGameRuntime: store over-long XGameSave container names in hashed folders #492 does, keeps existing saves as they are.replace_file'sMoveFileExWis called without the\\?\prefix and refuses paths of 260 characters or more, so a 190-character name still fails on both PRs and onmain. With the test data folder, that name gives a 267-character container folder andXGameSaveSubmitUpdatereturnsE_FAIL. The 256-character case in their tests passes only because the hashed folder is short. I opened XGameSave: a save whose blob path passes MAX_PATH fails (MoveFileExW without the verbatim prefix) #722 for that, with a failing test and a fix. With it, the 190-character name saves on its own. With XGameSave: a save whose blob path passes MAX_PATH fails (MoveFileExW without the verbatim prefix) #722 in, the threshold here only has to keep each component under 255.namefile against the requested name on open would turn that into an error instead.Suggestion: #492 passes the checks and keeps the change to hashed folders only. It can be merged once
DefaultHasheris replaced by a fixed hash (FNV-1a as in #481). Then close #481. #722 is a separate fix and works with either.Tested on an i7-12700H with an RTX 3070 Ti Laptop, Windows 11 build 26200. Toolchain: rustc 1.100.0
x86_64-pc-windows-gnullvm, debug,cargo test -p xcl --lib gamesaveon each PR merged intomainf4ce27c, plus a 190-character-name save test. Not tested: the MSVC toolchain,cargo test --workspace, smoke runs.Written with Claude Code (Claude Opus 5.5). I checked each point against the diffs and the runs above.
pickles976 commentedon Nov 24, 2026
Adjudication of the two PRs (design review + one measurement, 2026-11-24):
Both converge on the right shape — names whose
enc()fits stay in their current folder (existing saves untouched, no migration), only over-long names move to a hash folder, and both handle the enumeration read-back (XGameSaveEnumerateContainerInfomust report the container's name, not the hash folder). Neither can collide with anenc()folder (~is percent-encoded byenc, so both prefixes are reserved).~…stored_container_name()via theapply-signature plumbingDefaultHasher::new()(SipHash-1-3, fixed seed)~xcllong.The measurement I added: #492's choice of
DefaultHasher::new()looks risky — a randomly-seeded hasher would give a different folder every process launch and silently orphan long-name saves across game sessions (worse than the original bug). It isn't:DefaultHasher::new()is deterministically seeded — I hashed the issue's("a/"*85)+"x"case in 10 separate processes, 10/10 identical — so #492's folder mapping is run-stable. #481 doesn't need the argument (FNV has no seed at all), but its description check is red and itsapply()-signature change touches more surface than the defect needs.Recommendation: merge #492; #481's author's
stored_container_nameframing is the more future-proof read-back, worth cherry-picking ifLONG_PREFIXever grows — as-is it's a description-fix and a smaller-diff duplicate away from #492.