Repository navigation
fix(libkernel): open directories whose host path ends in a separator on Windows - #4513
Merged
oneandonlydean merged 1 commit intoOct 12, 2026
Conversation
…on Windows Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Windows test: head AI-assisted (Claude Code). |
10 tasks done
12 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
On Windows,
sceKernelOpenwithO_DIRECTORYfails with0x80020002(ENOENT) on an existing directory when the resolved host path ends in a separator. That covers the guest root/,.,<dir>/and<dir>/... Only<dir>without a trailing separator opens.Found with The Pathless (PPSA01825). At boot, Unreal calls
sceKernelOpen("/app0/..", O_DIRECTORY)to list the parent of the content root. On Windows the call returned ENOENT andgetdentswas never reached:Cause: in
OpenNative(core/libs/prx/libkernel/File/src/Open.cpp), the CRT_wopenfails on a path ending in\with ENOENT, and the fallback toFile::OpenDirectoryDescriptoronly runs whenerrno != ENOENT. A directory whose host path ends in a separator never reaches it.Fix: when the host path has no filename, the fallback runs regardless of the errno. Trailing separators are stripped with the same loop
sceKernelMkdiruses since #2819 (while (!path.has_filename() && path.has_relative_path()) path = path.parent_path()), so a host drive root such asC:\is kept as is. The directory descriptor is then opened on the stripped path. A missing path without a trailing separator still returns ENOENT without an extrastat, and theEEXIST/EISDIRchecks are unchanged. Linux is unaffected becauseopen(2)accepts a trailing slash on a directory.This follows the earlier trailing-separator fixes in libkernel: #2743/#2819 (
sceKernelMkdir) and #2300 (sceKernelStat).Tested
Windows 11, WinLibs GCC 15.2.
guest_filesystemnow opens/,.,<dir>/and<dir>/..withO_DIRECTORYand callssceKernelGetdentsuntil it returns 0. Without the change inOpen.cppthe test fails at the first open (guest errno 2); with it, it passes.ctest -R "guest_|file|kernel": 346 tests passed.open("/app0/..", O_DIRECTORY)now returns a descriptor and the listing completes (getdentsreturns 88 bytes, then 0). The title still stops right after it, in the same place as before:Project file not found: ../../../Pathless/Pathless.uproject, thenPS5 Out of Memory/LowLevelFatalError ... Ran out of memory allocating 5565054976 bytes. That stop has a different cause and is not addressed here: it is the PlayGo chunk enumeration described for Sifu on Sifu (PPSA03001): RenderThread faults popping a free list whose head reads 0xFFFFFFFFFFFFFFFF #3209 and fix(libScePlayGo): accept chunk ids when the dump has no chunk definitions #3238 (the dump has no chunk table, the title queries ever-increasing chunk ids, and the request size is the same).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)