fix(libkernel): report ELOOP from sceKernelStat for Windows symbolic link loops #8149
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8149"
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 JJenkx on 2026-10-20T00:23:49Z.
What
On Windows,
sceKernelStatof a symbolic link that resolves to itself returned0x80020002(ENOENT) instead ofSCE_KERNEL_ERROR_ELOOP(0x8002003E), which the Linux build returns.std::filesystem::statusreports such a link as not found, because the CRT mapsERROR_CANT_RESOLVE_FILENAME(1921) to ENOENT. When the status says the path does not exist,sceKernelStatnow opens it once following links (CreateFileW,FILE_READ_ATTRIBUTES,FILE_FLAG_BACKUP_SEMANTICS) and returns ELOOP when Windows fails withERROR_CANT_RESOLVE_FILENAME. Other failures still return ENOENT as before.guest_filesystemalready checks this case (line 899, added in #6992). It only runs where the user can create symbolic links (Developer Mode or administrator), so CI skips it. On such a machinemainaborts there:Tested
Windows 11 Enterprise 22621 (Developer Mode, so symbolic links can be created), WinLibs GCC 15.2.0 r7 UCRT, Release,
BUILD_TESTING=ON, AMD Ryzen 9 5950X.main5907b297a:guest_filesystemfails with exit code 0xc0000409 at line 899 (above). The files involved are unchanged between5907b297aand34b1b77ab.34b1b77ab:guest_filesystempasses.ctest -R "guest_|libkernel|path|stat|file": 563 of 563 pass.tools/check_conventions.py --base origin/main: passed.tools/pr_overlap.py: #5021, #7121, #7201 and #7332 also changeOpen.cppand could not be compared automatically. Checked by hand: they changeOpenNative,sceKernelCloseandsceKernelRead, notsceKernelStator the Windows helpers.Rebased onto
maina98590dec2(2026-10-20), preserving its newNotFoundError_nid_no_patchENOTDIR handling after the Windows loop check. No merge commits; refreshed headafec282b0f.Retested on the same Windows machine and toolchain above, rebuilding
guest_filesystem_testsfor both revisions:a98590dec2:guest_filesystemfails at line 916, the self-referencingstat-loopELOOP assertion (guest errno 2).afec282b0f:guest_filesystempasses (1/1, 0.28 s). This exercises symbolic-link creation; the loop case was not skipped.tools/check_conventions.py --base origin/mainandgit diff --check: passed.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-20T00:34:25Z.
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/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.cpp