libkernel: unlink, remove, rename and open fail with ENOENT or EINVAL instead of ENOTDIR for a regular file named with a trailing slash on Windows #8679
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 xXPBSXx on 2026-10-20T20:53:13Z.
Repro
Windows host,
filea regular file:unlink("file/")fails with errno 22,remove("file/")with 2,rename("file/", "other")with 5 andopen("file/", O_RDONLY)with 22. Under a mount alias (/app0/file/) the slash is dropped from the resolved path.Expected (FreeBSD 11.4 lookup, sys/kern/vfs_cache.c:2104-2105): ENOTDIR (20), and the file stays.
Actual:
ResolveAliaskeeps the trailing slash only off Windows, and the four calls do not check for a non-directory named with a slash.Test:
core/libs/tests/GuestFilesystem.cpp(the trailing-slash block, built only off Windows so far; it fails at its first line on Windows before the fix).Fix branch: https://github.com/xXPBSXx/AnyPS5/tree/fix/trailing-slash-enotdir
Earlier attempts: #5165 and #5266 (closed).
AI-assisted (Claude Code).