libc/libkernel: rename of a path that ends in '.' or '..' renames the directory instead of failing with EINVAL #8173

Closed
opened 2026-10-20 01:18:23 +00:00 by xXPBSXx · 0 comments
xXPBSXx commented 2026-10-20 01:18:23 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-20T01:18:23Z.


Repro

Windows host. mkdir("dir"); rename("dir/.", "other") moves dir to other; the same for rename(x, "dir/."), rename(".", x), rename(x, ".") and sceKernelRename.
Expected (FreeBSD 11.4 lookup, sys/kern/vfs_lookup.c, ISLASTCN for DELETE/RENAME): EINVAL (22) for a last component of . or .., for source and destination.
Actual: the guest path resolver drops the . before the host call, so the directory itself is renamed.
Test: core/libs/tests/GuestRenameDot.cpp (fails with 0xc0000409 before the fix).
Fix branch: https://github.com/xXPBSXx/AnyPS5/tree/fix/rename-dot-component-fb
AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5934219459 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/8173). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-20T01:18:23Z. --- ### Repro Windows host. `mkdir("dir"); rename("dir/.", "other")` moves `dir` to `other`; the same for `rename(x, "dir/.")`, `rename(".", x)`, `rename(x, ".")` and `sceKernelRename`. Expected (FreeBSD 11.4 `lookup`, sys/kern/vfs_lookup.c, ISLASTCN for DELETE/RENAME): EINVAL (22) for a last component of `.` or `..`, for source and destination. Actual: the guest path resolver drops the `.` before the host call, so the directory itself is renamed. Test: `core/libs/tests/GuestRenameDot.cpp` (fails with 0xc0000409 before the fix). Fix branch: https://github.com/xXPBSXx/AnyPS5/tree/fix/rename-dot-component-fb 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#8173
No description provided.