fix(libkernel): resolve original .prx names to relinked .guest.prx in lstat #5401

Closed
EagleBearerYS wants to merge 0 commits from upstream-pr/5401 into main
EagleBearerYS commented 2026-10-13 18:50:24 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-13T18:50:24Z.


What

#4688 made stat, sceKernelStat, read-only sceKernelOpen and sceKernelCheckReachability find X.guest.prx when a title asks for X, the name the relinker replaced, and listed lstat as not covered. lstat still answered ENOENT for the same path, so code that checks for a plugin with lstat saw it missing while stat and dlopen found it.

lstat now resolves the name through File::PathOrRelinkedModule, as sceKernelCheckReachability does. An existing X, including a dangling symbolic link, is still reported as it is; only a missing X falls back to X.guest.prx.

#4938 and #4691 both rewrite lstat_nid_postfix. Whichever of them lands after this carries the one line over.

No title is claimed.

Related: #4225

Tested

On GitHub's runners from my fork, on main at 18c438b10 (run):

  • Linux: Ubuntu 24.04.5, GCC 13.3.0, Release with CI's configure flags and -DANYPS5_ENABLE_SPIRV_TOOLS=ON.
  • Windows: Windows Server 2025, WinLibs MinGW-w64 GCC 15.2.0 r7 (UCRT), Release with CI's configure flags.

On both:

  • TestRelinkedModuleNames in guest_filesystem gains two lstat checks: ENOENT while neither name exists, and the relinked file's size once X.guest.prx exists. With main's Stdio.cpp the test aborts at the second check, where lstat still reports ENOENT. With the change it passes 20 runs in a row.
  • Every test registered under core/libs/prx/libc and core/libs/prx/libkernel passes: 69 and 124 on Linux, 90 and 127 on Windows.
  • tools/check_conventions.py --base origin/main passes.
  • Not tested: macOS, any title.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4847933732 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5401). Originally posted by [EagleBearerYS](https://github.com/EagleBearerYS) on 2026-10-13T18:50:24Z. --- ### What #4688 made `stat`, `sceKernelStat`, read-only `sceKernelOpen` and `sceKernelCheckReachability` find `X.guest.prx` when a title asks for `X`, the name the relinker replaced, and listed `lstat` as not covered. `lstat` still answered `ENOENT` for the same path, so code that checks for a plugin with `lstat` saw it missing while `stat` and `dlopen` found it. `lstat` now resolves the name through `File::PathOrRelinkedModule`, as `sceKernelCheckReachability` does. An existing `X`, including a dangling symbolic link, is still reported as it is; only a missing `X` falls back to `X.guest.prx`. #4938 and #4691 both rewrite `lstat_nid_postfix`. Whichever of them lands after this carries the one line over. No title is claimed. Related: #4225 ### Tested On GitHub's runners from my fork, on `main` at 18c438b10 ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/38448699930)): - Linux: Ubuntu 24.04.5, GCC 13.3.0, Release with CI's configure flags and `-DANYPS5_ENABLE_SPIRV_TOOLS=ON`. - Windows: Windows Server 2025, WinLibs MinGW-w64 GCC 15.2.0 r7 (UCRT), Release with CI's configure flags. On both: - `TestRelinkedModuleNames` in `guest_filesystem` gains two `lstat` checks: `ENOENT` while neither name exists, and the relinked file's size once `X.guest.prx` exists. With `main`'s `Stdio.cpp` the test aborts at the second check, where `lstat` still reports `ENOENT`. With the change it passes 20 runs in a row. - Every test registered under `core/libs/prx/libc` and `core/libs/prx/libkernel` passes: 69 and 124 on Linux, 90 and 127 on Windows. - `tools/check_conventions.py --base origin/main` passes. - Not tested: macOS, any title. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Unblocks: none - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-13 19:10:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-13T19:10:33Z.


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.

Pull request Conflicting files (lines on main) Same exports Same new files
#4691 core/libs/prx/libkernel/File/src/Stdio.cpp L863-867
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6153142691 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5401#issuecomment-6153142691). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-13T19:10:33Z. --- <!-- pr-overlap --> 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**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | #4691 | `core/libs/prx/libkernel/File/src/Stdio.cpp` [L863-867](https://github.com/boykopovar/AnyPS5/blob/71c71f50b7a42ad1a62b78d9cd24f5a356965557/core/libs/prx/libkernel/File/src/Stdio.cpp#L863-L867) | | |
oneandonlydean commented 2026-10-14 02:27:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T02:27:29Z.


Closing: no title is known to reach this. With the queue at 700+ open PRs, please hold off on new PRs that don't name a title needing the change until it's down. If a title stops on this on current main, reopen with the title ID and the log line.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6159524668 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5401#issuecomment-6159524668). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-14T02:27:29Z. --- Closing: no title is known to reach this. With the queue at 700+ open PRs, please hold off on new PRs that don't name a title needing the change until it's down. If a title stops on this on current main, reopen with the title ID and the log line.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!5401
No description provided.