Repository navigation
fix(libkernel): return EPERM when unlinking a directory - #2289
Merged
oneandonlydean merged 1 commit intoOct 10, 2026
Merged
oneandonlydean merged 1 commit into
oneandonlydean merged 1 commit into
Conversation
FreeBSD's unlink(2) reports EPERM for a directory, but the host call returns EACCES on Windows and EISDIR on Linux, so the guest saw a different error on each host. Check for a directory, not following a symbolic link, before unlinking. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
9 tasks done
Contributor
Author
|
Full Linux and Windows builds and tests for this head (
Run: https://github.com/AchrafReyani/AnyPS5/actions/runs/37946468349 |
This was referenced Oct 9, 2026
oneandonlydean
added a commit
to oneandonlydean/AnyPS5
that referenced
this pull request
Oct 10, 2026
oneandonlydean
added a commit
to oneandonlydean/AnyPS5
that referenced
this pull request
Oct 10, 2026
SleglJan
pushed a commit
to SleglJan/AnyPS5
that referenced
this pull request
Oct 10, 2026
…link-directory-eperm fix(libkernel): return EPERM when unlinking a directory
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
FreeBSD's
unlink(2)fails withEPERMwhen the path is a directory.sceKernelUnlinkpassed the host error through, so the guest got a different code on each host:unlink("dir")onmain_wunlink)EACCES(13), measuredEPERM(1)unlink)EISDIR(21), perunlink(2)EPERM(1)sceKernelUnlinknow checks the path withsymlink_statusbefore unlinking and returnsEPERMfor a directory. A symbolic link to a directory is still unlinked, as on FreeBSD. If the path can't be inspected, the check doesn't match and the nativeunlinkreports its own error as before.unlink(the POSIX wrapper) goes throughsceKernelUnlink, so both are covered.Tested
Windows 11, WinLibs GCC 15.2.0 r7, Release,
-DBUILD_TESTING=ON:guest_filesystem_tests, next to the otherunlinkchecks:unlink(dir)returns -1 with errno 1 and leaves the directory in place, andsceKernelUnlink(dir)returns0x80020001. Onmainthe first fails withguest errno 13.ctest -R "guest_filesystem|guest_kernel_sync|guest_file": 3/3 passed.tools/check_conventions.pypasses, andtools/pr_overlap.py --branchreports no overlap. It also merges cleanly with fix(kernel): return guest errors from scalar file operations #2144, fix(files): isolate guest descriptors from host resources #2170, fix(libkernel): honour open flags when Windows falls back to a directory descriptor #1628, feat(libkernel): open /dev/random and /dev/urandom for reading #1777, fix(libkernel): give flock BSD semantics on Windows #1755, fix(libkernel): return EWOULDBLOCK from a contended LOCK_NB flock #1764, feat(libs): implement font, libc, libkernel and misc prx stubs #2193 and my fix(libkernel): report POSIX rename errors from sceKernelRename #2260, which touch the same files (git merge-tree). fix(libkernel): read and write guest sockets #1727 already conflicts withmainon its own (TechnicalDebt.md).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)🤖 Generated with Claude Code