Repository navigation
fix(libkernel): report ENOTDIR from mkdir and rmdir when a path component is a file - #3395
Conversation
…nent is a file On Windows mkdir_nid_postfix returned ENOENT and sceKernelMkdir and sceKernelRmdir returned ENOENT or EIO when a regular file was used as a directory in the path. FreeBSD mkdir(2) and rmdir(2) return ENOTDIR for a path component that is not a directory.
…s in sceKernelMkdir Capture errno before the ENOTDIR lookup, translate EINVAL from a name under a regular file to ENOTDIR, check the parent only once and strip a trailing separator before taking it, and split the dense rmdir return.
|
Checked on Linux: build and ctest green, |
|
Thank you @LeandroLP23 for carrying this, and the %p and signal() changes as well, and thank you @MarcZX100 for the earlier ones: keeping the authorship is much appreciated. One small, optional ask for the remaining fixes from my fork (#2711 fgets, #2725 strtod, #2679 rwlock, #2680 directory lseek, #2702 strftime, #2694 UDP errno, #2703 equeue, #2698 ctype, #2768 inet, #2676 strtol): if it is just as easy, reopening my own PR instead of carrying the commits would help, because the intake check counts merged PRs by author, and the carried ones do not move my count. Carrying is still completely fine and very welcome if reopening is not practical, and I understand the intake limit is there for a reason. AI-assisted: yes. |
|
@husseinkad that makes sense. Reopening another author's PR is something only maintainers can do, so I'll stop carrying the remaining fixes from your fork and leave them for your original PRs; if a maintainer reopens them, I'm happy to run them on Windows (Radeon 860M) and post the results there. #3452 is already under review with the requested changes in, so I'll see that one through. |
|
Thank you @LeandroLP23, that is clear, and thank you for seeing #3452 through. To avoid holding anything up on my account: if the maintainers would rather not reopen the closed ones, carrying the remaining fixes is still welcome and I would not mind at all; the authorship is what matters, and I am happy with either route. Your offer to run reopened PRs on the Radeon 860M would be very useful too. AI-assisted: yes. |
Carrying @husseinkad's fix for #3097 (they can't open PRs yet). The change is theirs:
ec46ae8dand4af85eb9cherry-picked ontomain, authorship kept.mainhad meanwhile fixed part of it with #2743 (mkdir("file/child")already reportsENOTDIR), so the conflicts inStdio.cppwere resolved by keepingmain's helpers and taking husseinkad's version of thesceKernelMkdircheck, which covers both the direct-parent case and the deeper one; their test block sits next tomain's read-only unlink/rmdir checks.What
On Windows,
mkdirandrmdirreturnedENOENTwhen a component further up the path is a regular file (mkdir("file/a/b"),rmdir("file/x"),rmdir("file/")), where FreeBSD returnsENOTDIR. The POSIX andsceKernelforms now reportENOTDIRin those cases, andsceKernelMkdirno longer returns a Win32 error number as an errno.Tested
Windows 11 (26300), WinLibs GCC 15.2.0 r7, Release:
guest_filesystemandguest_kernel_sync(which holds #2743's cases) pass 3/3;guest_filesystemfails withmain'sStdio.cpp(guest errno 2, Win32 error 3at the new deep-path check);ctest -E agc_445/445; conventions pass.Fork CI (run): Windows and the three relinker jobs pass. Linux fails
agc_driver_image_plane_address_on_line_implicit_lodandguest_kernel_stack_protect, the same two in all three runs of this batch (#3111, #3076 and #3097 fixes, unrelated changes), so they come frommain.Fixes #3097
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)