libkernel_sys: link, symlink, pathconf and fchmodat fail with ENOENT instead of ENOTDIR when a path component is a regular file (Windows) #8521
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-20T14:51:19Z.
Repro
Windows host,
filea regular file:link("file/child", "new"),link("other", "file/child"),symlink("t", "file/child"),pathconf("file/child", _PC_NAME_MAX)andfchmodat(AT_FDCWD, "file/child", 0600, 0)return -1 with errno 2.Expected (FreeBSD 11.4
vfs_cache_lookup, sys/kern/vfs_cache.c:2104-2105; the same lookup as for open, stat, unlink, chmod, rename, chdir, opendir): ENOTDIR (20).Actual:
link_nid_postfix,symlink_nid_postfix,pathconf_nid_postfixandfchmodat_nid_postfix(libkernel_sysExport.cpp) map the host's not-found error to ENOENT without checking for a non-directory prefix.Test:
core/libs/tests/GuestKernelSys.cpp(new cases;guest_kernel_sysfails at them before the fix).Fix branch: https://github.com/xXPBSXx/AnyPS5/tree/fix/enotdir-through-file-4
AI-assisted (Claude Code).