fix(libkernel): stat files under long Windows paths #7196
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7196"
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 MarcZX10 on 2026-10-17T15:46:52Z.
What
Prepare long Windows paths for
sceKernelStatmetadata lookups using the extended path namespace, and use that same path for the subsequent native stat call. Add a Windows regression test that stats an existing file under a path longer thanMAX_PATHthrough a short guest alias, confirms a missing long path still returnsENOENT, and confirms a trailing-slash directory stat remains a directory.Tested
python3 tools/check_conventions.py --base f51724078f975a60c8f9985e547b6259acdcab64passed locally.git diff --checkpassed locally.3d18c946f7270678256683ec8a5fbf1989c55803passed the full relinker/system-library build and 30 focused CTest runs, including the ordinary long-path stat fixture. A follow-up now preserves already-extended\\?\aliases and adds a regression for them; that follow-up has passed MinGW syntax checks, but its Windows runtime rerun is pending.Checklist
main; no open PR implements long-pathsceKernelStatsupport.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-17T15:57:22Z.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
core/libs/prx/libkernel/File/src/Open.cppcore/libs/tests/GuestFilesystem.cppcore/libs/prx/libkernel/File/src/Open.cppcore/libs/prx/libkernel/File/src/Open.cppcore/libs/prx/libkernel/File/src/Open.cppcore/libs/prx/libkernel/File/src/Open.cppImported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T16:01:37Z.
I manually reviewed the three files the overlap check could not compare. #6484 adds rename-semantics tests in GuestFilesystem.cpp; #6044 reorganizes the filesystem test target/file; neither changes or tests long-path stat behavior. #5021’s Open.cpp change is an Apple-specific O_CREAT directory check, unrelated to Windows extended paths or sceKernelStat. I found no duplicate implementation in those PRs. The Windows runtime check for this PR remains pending because the hosted application lane was skipped and I cannot dispatch that workflow without repository admin rights.
Imported from boykopovar/AnyPS5. Originally posted by Amoenus on 2026-10-17T16:12:32Z.
@MarcZX100 retested the published follow-up
28eaa5bdad25ec393110696ec94782bdcf8ea722, based on main66702f1c. The existing-namespace regression is corrected.No menu/gameplay or whole-title result is implied by these metadata controls. Thank you for the quick correction; our #7187 now has the corresponding prefix preservation and regression too.
Current composed title follow-up: integrationc784, main667 plus retained fixes/#7187cf84/#7196 head28ea, reaches the older GPU stops from long physical roots: NVIDIA28.656s resident8x DCC refusal; AMD70.750s Vulkan device loss-4. Last captures remain NOW LOADING, no timeout/input or protected-file changes. #3036 carries full scope; the independent metadata controls above establish the fix separately.
One source-review error-path point:
FilesystemError(error)already returns guest errno, whileSceErrorFromErrnomaps values above34 to EIO.SceKernelError(FilesystemError(error))would preserve that mapping (for example guest ENAMETOOLONG63) in the new absolute-resolution failure branch, as the resolver branch just above does. I have not induced that absolute-resolution failure in these runtime tests; this is a source-review edge, separate from the verified success paths.Earlier validation and failing control at3d18c946
@MarcZX100 Windows validation at exact head
3d18c946f7270678256683ec8a5fbf1989c55803: full relinker/system-library build passes, and 10 relevant CTest groups ×3 = 30 passes, including yourguest_filesystemlong-path case, timestamps, POSIX I/O and archive/plain/mmap controls. Ubuntu24.04/GCC13.3: the same build and 30 focused passes. Windows11 Enterprise26200, WinLibs GCC15.2.0 r7, Release.The ordinary-path correction also works on the actual #7195 file: ordinary root253/full266 characters now returns success and size288. However, the already-extended alias regresses: extended root257/full270 returns
0x80020002, size0, whereas it succeeds on main. The same real file is used and its hash is unchanged.An independent fixture confirms that extended-path failure in 3 same-drive and 3 split-drive runs. A small native control confirms the cause on this toolchain:
Could
NativeMetadataPathpreserve an existing\?\or\.\namespace before callingabsolute, and add that alias as a control? The check afterabsoluteis too late here. I found the same operation in our #7187 and am adding the early check there too. This is an additional input case, not a request to duplicate or replace your fix. No menu/gameplay or whole-main title result is implied by the metadata control.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T16:16:37Z.
Good catch.
std::filesystem::absolutewas rewriting an already-extended\\?\spelling before the later prefix check. I pushed a follow-up on this PR that preserves\\?\and\\.\inputs before callingabsolute, and added an already-extended-alias regression for both existing and missing files. The branch is rebased onto currentmain(66702f1).check_conventions.py,git diff --check, and MinGW syntax checks forOpen.cppandGuestFilesystem.cpppass. Your Windows run covered the prior head; this added Windows regression still needs a runtime rerun. Thanks for providing the independent reproduction and the concrete diagnosis.