fix(libkernel): accept flock on a directory descriptor on Windows #9101
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9101"
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-21T12:17:36Z.
What
On Windows,
flockon a directory descriptor aborted the process: the call reachedLockFileEx, which rejects a directory handle, andflock_nid_postfixturned that into aruntime_error. FreeBSD 11.4'ssys_flockaccepts any vnode descriptor, so a directory succeeds. A directory descriptor now returns 0 without taking a lock. The debt entry says that no lock is held, so two descriptors of one directory never conflict. A badhowstill fails withEBADF, a socket or pipe still withEOPNOTSUPP. Linux and macOS are unchanged (they use the hostflock).Tested
Windows 10 (19045), WinLibs GCC 15.2.0 r7, Release,
BUILD_TESTING=ON, onmain3e91c8edf5plus this commit:ctest -R '^guest_file_lock_directory$'passes 3 of 3; withStdio.cpprestored tomain(the new case kept) it fails 3 of 3 (exit code0xc0000409).ctest -R 'guest_file_lock|guest_filesystem$|guest_posix_filesystem|guest_kernel_fcntl|guest_dup|guest_append': 13 of 13 pass.python tools/check_conventions.py --base upstream/mainpasses;git merge-treeagainstmainis clean.Checklist
main; no other open PR implements the same functionsflockno-op is a debt entry in libkernel.md).mdfiles or images added to the repositoryAI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by cadenasynyster on 2026-10-21T21:43:37Z.
Independent Windows run of this PR (head
0e2252f63), on Windows 11; the description's run is Windows 10.Environment: Windows 11 10.0.26300, Ryzen 7 9800X3D, WinLibs GCC 15.2.0 r7 (MinGW), Release, BUILD_TESTING=ON.
Results:
guest_file_lock*tests pass, 3/3 runs (--repeat until-fail:3), includingguest_file_lock_directory.core/libs/prx/libkernel/File/src/Stdio.cppwith the merge-base version (3e91c8edf).guest_file_lock_directoryfails withflock_nid_postfix: flock failed, fd=3, error=87(ERROR_INVALID_PARAMETERfromLockFileExon the directory handle); the other 6 still pass. I restored the PR's file afterwards.Not run: Linux/macOS, the wider selection in the description, the full repository CTest, and any title.
AI-assisted: yes