Windows sceKernelStat returns ENOENT for an existing file under a long host path (PPSA99902) #7195
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Imported from boykopovar/AnyPS5. Originally posted by Amoenus on 2026-10-17T15:45:03Z.
Failure
A valid short guest path can return
0x80020002(ENOENT) fromsceKernelStaton Windows when its resolved host filename exceeds MAX_PATH. The host file exists. This is separate fromfopen's native open correction in #7182 / #7187.Found while validating Sonic Unleashed Recompiled, PPSA99902 (#3036, discussion #4443): the existing
WorldMap.arlhas a 266-character resolved host path and is288 bytes. A control links the actual unpatched host libraries built at3811293e76755982fda9dc0d66afd8fabe5142ae(the #7187 review follow-up).libkernel/File/src/Open.cppand libc path resolution are byte-identical to current mainf51724078f975a60c8f9985e547b6259acdcab64;git diff main..3811293 -- Open.cpp General.cppis empty. The fopen-only changes do not alter this stat call.Direct exported-API reproduction
Map the same short guest prefix to the parent of the same real file, first using an ordinary drive path, then the extended Unicode spelling. Call
sceKernelStaton the same guest filename each time:The leaf adds13 characters, so ordinary full path length is266. Only the host alias spelling changes; file contents and guest path remain unchanged. The control uses
AddPathAlias_nid_no_patch,FileStatand the realsceKernelStatexport, not a mock or symbol-presence check.Independent same-toolchain native controls confirm the underlying lookup behavior:
Windows11 Enterprise26200, WinLibs GCC15.2.0 r7, Release host libraries. CPU/filesystem result; no GPU attribution. The observed wrong result is unchanged-main code behavior isolated through the export; this is not a plain-main whole-title result.
Relevant implementation and overlap
core/libs/prx/libkernel/File/src/Open.cpp::sceKernelStatpasses the resolved host spelling tostd::filesystem::status; the failed lookup is then reported as a missing file. An extended spelling succeeds. Microsoft's Win32 namespace documentation describes long Unicode paths.A proposed correction is to prepare a Windows native long-path spelling for the filesystem metadata operations, preserving guest/archive path identity and error behavior. MarcZX100 has implemented the ordinary-path correction in PR #7196. Our validation confirms it on the real266-character game file and with30 focused passes on each of Windows/Linux. The initial existing-namespace regression was corrected in head
28eaa5bdad25ec393110696ec94782bdcf8ea722: it now passes the same6 independent controls, and both ordinary/extended aliases return success and size288 for the actual game file. Full Windows/Linux builds and30 focused passes on each were repeated on this published head. No duplicate implementation PR is proposed. #7187 explicitly only changes fopen's native opener and does not fix this metadata path. #4618 only optedrelinker.exeinto long paths.#6648 and #6942 improve ELOOP/ENAMETOOLONG translation after failed lookups. They do not make this existing266-character host file discoverable; their scope is different. They touch the same function and should be considered when preparing a fix. Searches found no existing issue/PR for this valid-file stat failure.
Game scope
An exact-runtime directory-layout control (all127 PRXs/executable/guest module/dependencies retained, fresh original assets/user data) reaches the earlier GPU stop from a short physical root: NVIDIA28.293s, resident8x DCC refusal; AMD70.664s, Vulkan device loss-4. Both last captures remain NOW LOADING. The long-root comparison reaches its120s limit. This implicates additional layout-sensitive file behavior, but does not establish this one stat call as the sole cause of the remaining loading stop. #3036 / #5336 maintain the GPU observations. No menu/gameplay/FPS claim.
AI-assisted: yes, Codex; author responsible.
Current composed title validation
Integrationc784faf893 includes #7196 head28ea and #7187cf84 on main667, with full Windows/Linux builds and51/33 focused passes. Fresh long-root game runs reach the older GPU stops: RTX5080 resident8x DCC refusal at28.656s; AMD Radeon Graphics device loss-4 at70.750s. Last captures remain NOW LOADING. All127 libraries match the build and across GPUs, standard a515 conversion retained, original inputs/configs unchanged, no timeout. The target metadata filename is274/271 characters. #3036 maintains hardware and coverage limits. The real-export controls above establish this metadata correction independently; the composed title observation does not isolate one correction or establish a common GPU cause.