libkernel: unlink and rmdir of a path ending in "." or ".." fail with EPERM or ENOTEMPTY instead of EINVAL #8796

Closed
opened 2026-10-21 00:56:53 +00:00 by xXPBSXx · 0 comments
xXPBSXx commented 2026-10-21 00:56:53 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-21T00:56:53Z.


Windows host, dir an existing directory: unlink("dir/."), unlink("dir/.."), sceKernelUnlink("dir/.") and unlinkat(dirfd, ".", 0) return EPERM; rmdir("dir/..") and sceKernelRmdir("dir/..") return ENOTEMPTY.
Expected (FreeBSD 11.4 lookup(), sys/kern/vfs_lookup.c:750-754 and 823-826: "." or ".." as the last component of a DELETE lookup): EINVAL (22), as rename (#8174) and rmdir(".") already answer.
Test: core/libs/tests/GuestFilesystem.cpp, core/libs/tests/GuestKernelSys.cpp (new cases; the existing unlinkat(base, ".", 0) == EPERM expectation changes to EINVAL).
Fix branch: https://github.com/xXPBSXx/AnyPS5/tree/fix/unlink-rmdir-dot-component
AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5952279892 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/8796). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-21T00:56:53Z. --- Windows host, `dir` an existing directory: `unlink("dir/.")`, `unlink("dir/..")`, `sceKernelUnlink("dir/.")` and `unlinkat(dirfd, ".", 0)` return EPERM; `rmdir("dir/..")` and `sceKernelRmdir("dir/..")` return ENOTEMPTY. Expected (FreeBSD 11.4 `lookup()`, sys/kern/vfs_lookup.c:750-754 and 823-826: "." or ".." as the last component of a DELETE lookup): EINVAL (22), as `rename` (#8174) and `rmdir(".")` already answer. Test: `core/libs/tests/GuestFilesystem.cpp`, `core/libs/tests/GuestKernelSys.cpp` (new cases; the existing `unlinkat(base, ".", 0) == EPERM` expectation changes to EINVAL). Fix branch: https://github.com/xXPBSXx/AnyPS5/tree/fix/unlink-rmdir-dot-component AI-assisted (Claude Code).
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5#8796
No description provided.