fix(filesystem): remove unreadable empty dirs #23799
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/23799"
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 DonRyuzaki on 2026-11-19T17:20:23Z.
What
Let POSIX
rmdirdecide whether an empty directory can be removed through both the directrmdirexport and directory-relativeunlinkat(..., AT_REMOVEDIR). A nonroot caller can remove an empty mode-000 directory from a writable parent, but the old directory-read prechecks returned guestENOTEMPTY. Windows retains its upstream empty-directory prechecks and the POSIX paths preserve host errno mapping.This is a generic filesystem correction. No title or console behavior is claimed.
Tested
guest_kernel_sys_testsandguest_filesystem_testson the rebased tree; both CTest cases passed. The nativermdircontrol plus direct and directory-relative guest regression run inguest_kernel_sys. The original-head negative control, with production code reverted and the regression kept, failed with guest errno 66 (ENOTEMPTY).guest_kernel_sys_testsandguest_filesystem_testsafter rebasing; both CTest cases passed with host filesystem access. The restricted shell blocked unrelated hard-link and junction fixtures, so those runs are not counted.GuestKernelSys.cppandlibkernel_sys/Export.cppchanges by preserving the Windows tests and empty-directory guard.tools/check_conventions.py,git diff --check, andgit merge-tree --write-tree upstream/main HEADpassed.tools/debt_fold.py --checkreports two pre-existing, duplicate libkernel clock fragments on currentmain(fix-libkernel-clock-id-15.mdanddocs-libkernel-clock-gettime-1360-divergence.md). This PR changes no debt fragments.tools/pr_overlap.py --branchscan fetched 2,278 open heads and probed 2,277 other PRs. No confirmed same-function implementation. The tool could not auto-compare 12 stale branches that already conflict with main; their shared-file patches were manually read. #18190 wrapsrmdirwithout changing removal behavior, and newly opened #24641 changesfutimesin the same file. The other patches concern separate functions or tests.Checklist
main; no other open PR implements the same function fixNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repositoryImported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-19T17:47:05Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
712153d5b7:tools/check_conventions.pypassed.guest_kernel_sys_testsbuilt cleanly.guest_kernel_sys):core/libs/prx/libkernel/File/src/Stdio.cpp,core/libs/prx/libkernel_sys/Export.cppreverted tomainand the new tests kept, the suite fails: Restoring the change makes it pass again.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T22:28:12Z.
Review: APPROVED
Reviewed — looks good
The reviewed change is sound at head
712153d5b72aeecd5179a03dd11815520d22faf8; the available evidence supports merging.What I ran
No commands were run. I read the prepared review bundle and the relevant source ranges through
repo_read.pyat the pinned head. The author reports passing Linux tests and convention checks, plus a Windows compile; those results were not independently run here.Results
Findings
Blocking
None.
Non-blocking
None.
Sources
The POSIX direct
rmdirpath now delegates removal and errno mapping to the host call (core/libs/prx/libkernel/File/src/Stdio.cpp:2041). The directory-relativeunlinkat(..., AT_REMOVEDIR)path likewise calls hostrmdir, preserving its existing guest error conversion (core/libs/prx/libkernel_sys/Export.cpp:1190). The added regression covers native, direct, and directory-relative removal of unreadable empty directories (core/libs/tests/GuestKernelSys.cpp:1437).Not verified
I did not run tests or builds and did not independently verify the author-reported outcomes. The review bundle contained no excluded changed files; all three changed files in the manifest were read.
files.jsonwas not available as a review document; the changed-file inventory came frommanifest.jsonand the review-folder listing.To get this to a good state
Nothing is required.