fix(libkernel): report lookup errors from truncate instead of ENOENT #4817
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4817"
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 Gashrod1 on 2026-10-12T22:51:34Z.
What
sceKernelTruncate_nid_postfix(andtruncate_nid_postfix, which goes through it) reported every failed lookup as ENOENT:file/,file/innerand a symbolic link loop all failed with ENOENT, andguest_filesystemasserted ENOENT forsized.txt/missing. FreeBSD'skern_truncatelooks the path up withnamei(LOOKUP | FOLLOW)and returns the lookup error: ENOTDIR for a trailing slash on a non-directory or for a component that is not a directory (sys/kern/vfs_lookup.c), ELOOP for a link loop.When the path does not resolve,
sceKernelTruncatenow returns ENOTDIR if a prefix is a non-directory (HasNonDirectoryPrefix, assceKernelMkdirandsceKernelRmdiralready do) or if the path has a trailing separator and names an existing file; otherwise the status error goes throughFilesystemError(ENOENT for a missing path, ELOOP for a loop). A path with a trailing separator that resolves to a file also fails with ENOTDIR instead of being truncated. The ENOTDIR decision does not depend on what the host's lookup reports.guest_truncatecheckssized.txt/andsized.txt/inner(ENOTDIR throughtruncateandsceKernelTruncate) on every platform and a link to itself (ELOOP) in the existing non-Windows block;guest_filesystemnow expects ENOTDIR forsized.txt/missing. Both fail onmainand pass with the change.Tested
Linux (Arch, GCC), Release,
BUILD_TESTING=ON, based onmainee4962190:guest_truncateandguest_filesystemabort onmainand pass with the change (3 runs); full build and fullctestpass. Windows (WinLibs MinGW-w64 GCC 15.2.0 r7, NVIDIA RTX 5060), Release,BUILD_TESTING=ON: full build and fullctestpass (1018 tests, the same 7 skipped as onmain). No title or homebrew run.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T02:37:43Z.
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