Skip to content

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

Closed
EagleBearerYS wants to merge 1 commit into
boykopovar:mainfrom
EagleBearerYS:fix/libkernel-lstat-relinked-prx
Closed

EagleBearerYS wants to merge 1 commit into
boykopovar:mainfrom
EagleBearerYS:fix/libkernel-lstat-relinked-prx

Conversation

@EagleBearerYS

@EagleBearerYS EagleBearerYS commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

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 18c438b (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

… lstat

boykopovar#4688 made stat, sceKernelStat, read-only open and
sceKernelCheckReachability find X.guest.prx when a title asks for X,
the name the relinker replaced. lstat still answered ENOENT for the same
path, so a title that stats a plugin with lstat saw it missing while
stat and dlopen found it. lstat now resolves the name the same way;
an existing X, including a dangling symlink, is still reported as is.
@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

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

@oneandonlydean

Copy link
Copy Markdown
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants