fix(libkernel): reject ftruncate on non-file Windows handles #4923
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4923"
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 MarcZX10 on 2026-10-13T04:22:48Z.
What
Fixes #4921. Carries David's
971fb51efcommit, preserving his original commit authorship. On Windows,ftruncateandsceKernelFtruncatenow returnEINVALfor pipes, directory descriptors and/dev/urandom, matching Linux and FreeBSD behavior. Disk-file truncation, closed descriptors and shared-memory handling keep their existing paths.The change checks the Windows handle type before
_chsize_s; the regression checks ensure pipe contents remain intact and the non-file descriptors returnEINVAL.Tested
Local Linux, GCC 12.2, Release,
BUILD_TESTING=ON:guest_filesystem_tests; CTestguest_filesystempassed (1/1).tools/check_conventions.py --base upstream/main: passed.tools/check_test_registration.py: passed (757 test executables registered; no new target).git diff --check upstream/main...HEAD: passed.EINVAL; this run confirms the added cross-platform assertions pass on Linux. I did not run Windows locally or relink a title.David reports Windows red/green results and a full CTest run in issue #4921, including the regression failing with
main'sStdio.cppand passing with his fix.Checklist
main; no open PR implements the same function behaviorImported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-13T06:15:32Z.
Windows test: head
097bc538emerged onto currentmainfe8d3eba0(clean merge, no conflicts). Windows 10, MinGW GCC (WinLibs), Ninja Release,-j2: full build 0 errors; ctest with the filterguest_filesystem: guest_filesystem passed (1 test(s), 0 failed);python tools/check_conventions.py --base upstream/mainpassed. I did not run the new tests againstmainwithout the change.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-13T12:00:19Z.
Windows counter-test (follow-up to the earlier Windows run): Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release, this PR merged onto
main2a2a3dc65.guest_filesystempasses with the PR; with the PR's source files replaced bymain's, same test, it aborts at line 261 (guest errno 22, Win32 error 5).Not tested: Linux, a console, a title run.
AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-13T14:41:56Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)core/libs/prx/libkernel/File/src/Stdio.cppL112Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-14T00:55:26Z.
Windows 10 (19045), MinGW-w64 GCC 15.2.0, Release,
-j4: head097bc538eof this PR merged ontomaince5c83953(clean merge, 2 files; the description reports Linux only).guest_filesystempasses (0.30 s, ctest).core/libs/prx/libkernel/File/src/Stdio.cpptaken back tomainand the PR's new test lines kept,guest_filesystemfails (Filesystem check failed at line 286 (guest errno 22, Win32 error 5), exit code0xc0000409).AI-assisted (Claude Code).