fix(libkernel): report app0 symlinks as their target type in getdirentries #9303
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9303"
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 oneandonlydean on 2026-10-21T17:51:29Z.
What
On Linux,
sceKernelGetdirentries(andsceKernelGetdents, which calls it) copied the hostd_typeinto the guest record. A directory underapp0/that is a host symbolic link was therefore listed asDT_LNK(10). A title that walks its own tree and descends only intoDT_DIRentries skipped it.Inside the
app0/tree, a symbolic link (or an entry whose type the host reports asDT_UNKNOWN) is now reported as the type of its target,DT_DIRorDT_REG, usingfstatat. A consoleapp0contains no links, so links there come from how the title was unpacked. Outsideapp0/, links keepDT_LNK(a guest-made link in/datastays a link), and a dangling link, a link loop or a link to anything other than a file or directory staysDT_LNKtoo.DT_UNKNOWNoutsideapp0/is resolved without following links.errnois preserved around both new host calls.Whether a directory is inside
app0/is decided from the open descriptor's host path (/proc/self/fd) against the canonicalapp0path, so it also works whenapp0itself is a link. One case stays as before, and the debt line says so: a directory opened through a link resolves to the link's target, so links nested inside a linked directory whose target is outsideapp0/keepDT_LNK.docs/user/USAGE.mdno longer says thatapp0/must not contain symbolic links on Linux (#7592 documented the old behaviour). It now describes the new behaviour and that one case.Tested
Linux (CachyOS), GCC, Release.
guest_directory_link_types: a temporaryapp0with a real directory, a linked directory, a linked file and a dangling link, plus a linked directory under/data. Without theStdio.cppchange it fails at the linked-directory check; with it, it passes.guest_directory*,guest_filesystemandguest_kernel_app_archivectests: 7 of 7 passed.app0directories as symbolic links into the unpacked dump: on main8727ddb2it exits with SIGSEGV at about 0 s, after listing/app0and never opening the linked directories. With this change it ran the full 120 s test window with no crash and opened files under all four linked directories (102 underupdate/). The unfixed run was on main8727ddb2; this branch is on745b39462.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)app0layoutRelated: #8726 changes the Windows listing so junctions report
DT_LNK. Without the sameapp0exception, a junction-builtapp0would hit this problem on Windows. #7201 (macOS port) adds a macOS branch to the same function that also copiesd_typeunchanged.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-21T18:15:51Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)core/libs/prx/libkernel/File/src/Stdio.cppL1137docs/dev/debt/libkernel.mdL138Some 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/CMakeLists.txtcore/libs/prx/libkernel/CMakeLists.txtcore/libs/prx/libkernel/File/src/Stdio.cppdocs/dev/debt/libkernel.mddocs/user/USAGE.mddocs/user/USAGE.mdcore/libs/prx/libkernel/CMakeLists.txtdocs/dev/debt/libkernel.mddocs/user/USAGE.mdcore/libs/prx/libkernel/CMakeLists.txtdocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/user/USAGE.mdcore/libs/prx/libkernel/CMakeLists.txtdocs/dev/debt/libkernel.mdcore/libs/prx/libkernel/File/src/Stdio.cppdocs/dev/debt/libkernel.mddocs/user/USAGE.mddocs/user/USAGE.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mdcore/libs/prx/libkernel/CMakeLists.txtcore/libs/prx/libkernel/File/src/Stdio.cppcore/libs/prx/libkernel/File/src/Stdio.cppdocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/user/USAGE.mddocs/dev/debt/libkernel.mddocs/user/USAGE.mdcore/libs/prx/libkernel/CMakeLists.txtcore/libs/prx/libkernel/File/src/Stdio.cppdocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mdcore/libs/prx/libkernel/File/src/Stdio.cppcore/libs/prx/libkernel/CMakeLists.txtdocs/user/USAGE.mddocs/user/USAGE.md