libkernel: sceKernelMkdir rejects a trailing slash (ENOENT, nothing created) #2743
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 reyani-dev on 2026-10-10T12:39:03Z.
sceKernelMkdir("dir/", mode)fails withENOENT(0x80020002) and creates nothing, on both Windows and Linux. A second call still returnsENOENT, notEEXIST. FreeBSD'smkdiraccepts a trailing slash, and so does AnyPS5's own POSIXmkdirexport (mkdir_nid_postfix, through_wmkdir/mkdir(2)):mkdir("c/")createsc. OnlysceKernelMkdirrejects it.Cause.
sceKernelMkdir(File/src/Stdio.cpp) checks thatnative.parent_path()exists before callingcreate_directory. For a path with a trailing separator,std::filesystem::pathtreats the trailing slash as an empty file name, so the "parent" is the directory being created. It doesn't exist yet, and the check returnsENOENT.Related: for
mkdir("file/child"), where the parent exists but is a regular file, it reportsENOENT, where FreeBSD reportsENOTDIR(0x80020014).Relevance: 41 of the 48 homebrew catalog titles I relinked import
sceKernelMkdir(1-LFLmRFxxM), which the SDK'smkdirreaches. I haven't found a title known to pass a trailing slash.Fix, ready to cherry-pick.
AchrafReyani:fix/mkdir-trailing-slash(5f74ddba, one commit, merges cleanly ontomainb69270dd). I can't open it as a PR because of the intake check.ENOTDIRis reported when the parent exists but isn't a directory.guest_kernel_syncchecks thatsceKernelMkdir("…/nested/")creates the directory and records it as written. It also checks that a second call returnsEEXIST, and that"…/existing.bin/child"returnsENOTDIR.Checked on Windows (WinLibs GCC 15.2.0, Release, on
main89a1fb4e):guest_kernel_syncfails without the change, at the first trailing-slashmkdir, and passes with it.ctest -E "^agc_|video_out"passes 341/341,check_conventions.pypasses, andpr_overlap.pyreports no overlap.Found with Claude Code.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-10T12:54:33Z.
I refreshed the reviewed
sceKernelMkdirfix onto current upstreammain(de5e541d) ata6ef1a4afb0336a633716b8db00950d859ac33c8. It preserves Achraf Reyani’s original trailing-slash implementation and adds the follow-up error handling and regression coverage for guest root and empty paths.Validation on Linux (GCC 12.2, Release): rebuilt
libkernel.prxandguest_kernel_sync_tests;guest_kernel_syncpassed (1/1).tools/check_conventions.py --base upstream/mainandgit diff --checkpass.The branch is
codex/mkdir-trailing-slash-2743. Achraf’s earlier Windows runs cover the trailing-slash and error-handling cases on the prior78aedb40base, not this current rebased head. I have not opened an upstream PR: the intake workflow requires 20 merged PRs, and my current merged count is 15.Imported from boykopovar/AnyPS5. Originally posted by reyani-dev on 2026-10-10T12:59:51Z.
Fork CI for the branch merged onto current
main(run 38052746387): Linux 700/700, Windows 708/708, relinker jobs green.Imported from boykopovar/AnyPS5. Originally posted by reyani-dev on 2026-10-10T13:11:10Z.
Thanks @MarcZX100. Here is the Windows side for your branch (
986416b3, with myd15ab8abunderneath) merged onto currentmain78aedb40, Windows 11, WinLibs GCC 15.2.0 r7, Release:guest_kernel_syncpasses 3/3 (--repeat until-fail:3), including your follow-up cases;ctest -E "^agc_|video_out"passes 380/380.Imported from boykopovar/AnyPS5. Originally posted by reyani-dev on 2026-10-10T18:25:37Z.
@MarcZX100 with intake at 10 merged PRs now, either of us can open this. Would you like to open your branch (
986416b3, my commit plus your follow-up) as the PR, or should I open it with both commits, keeping you as the author of yours? Happy either way, I just don't want two PRs for it.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-10T21:24:43Z.
Thanks for coordinating. I opened #2819 with your original commit preserved and the follow-up cases on the same PR: https://github.com/boykopovar/AnyPS5/pull/2819. That keeps this to one PR.
Imported from boykopovar/AnyPS5. Originally posted by p38593359-tech on 2026-10-10T22:54:26Z.
At work get get off thank
On Sat, Oct 10, 2026 at 3:25 PM MarcZX10 @.***> wrote: