libkernel: truncate is an absent import of PS5MC, XPSemu and Porpoise; fix branch ready #3181
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 Mouad-Scriptz-0 on 2026-10-11T00:30:45Z.
libkernel does not export the POSIX
truncate(ayrtszI7GBg, named withtools/nid_names.pyagainst aerolib).sceKernelTruncate(WlyEA-sLDf0) is onmain, the POSIX alias is not. An import audit of the homebrew catalog onmain942a174e(Linux) lists it as an absent import of three titles, each a real GOT relocation with resolved call sites:truncatecall sitesmainPS5MC-1.2-kodi22-PPSA99420.zip0x3C972CB)PPSA97358.zip0xB6E945,0xB6E955)Porpoise-2.7.zip0x807B5,0x807C5)With the branch below, each title's absent count drops by exactly one and
truncatemoves toimplemented; nothing else changes. It is also the next stop that @Amoenus reports for PPSA99902 oncepathconfresolves. Prospero Win (PPSA99995) references the NID from its bundledntdll.prxandwineserver.prx; OliSe Player, ProsperoAI, ProsperoEden and PS5SX2 reference it too but the relinker refuses them (#2136), so they are not counted above.Fix branch ready:
Mouad-Scriptz-0:feat/libkernel-truncate(91bc3930, one commit onmain942a174e). I cannot open it as a PR because of the intake check; anyone eligible is welcome to carry it, keeping the commit as is. No open PR addstruncate(tools/pr_overlap.py --branchreports no overlap).truncate_nid_postfix(path, length)inFile/src/Stdio.cppvalidates the path like the other POSIX wrappers there (EFAULTfor null,ENOENTfor empty) and resolves throughsceKernelTruncate_nid_postfix.sceKernelTruncatenow returnsEISDIRfor a directory and the host errno for other failures, as FreeBSD 11kern_truncate(sys/kern/vfs_syscalls.c) does:EINVALfor a negative length,EISDIRforVDIR, then the vnode error (EACCESfor an unwritable file). Before, every failure after the existence check wasEIO. TheENOENTcheck for a missing path is unchanged.NativeTruncatehelpers:::truncateon POSIX;_wopen(_O_WRONLY | _O_BINARY)+_chsize_s+_closeon Windows, where_chsize_salready backsftruncate.guest_truncatetest (registered inlibkernel/CMakeLists.txt): shrink to 6 keeps012345, grow to 9 zero-fills, truncate to 0,-1→EINVALwithout touching the file, missing path →ENOENT,""→ENOENT,nullptr→EFAULT, a directory →EISDIRfor bothtruncateandsceKernelTruncate(0x80020015), a read-only file →EACCESfor both and the contents stay intact.Tested on Fedora 44 (kernel 7.2.8, GCC 16.2.1, Ninja, Release, full build with
BUILD_TESTING=ON):guest_truncateandguest_filesystempass 3/3 (--repeat until-fail:3).ctest -j6 --timeout 120: 744/752. The 8 that fail areagc_driver_*(f64_fma_subnormals,vop1_float_unary,vopc_compare,prepared_shaders,prepared_shaders_indirect,prepared_shaders_uncached,prepared_shaders_debug, andflat_aperturesby timeout under-j6): on a cleanmain942a174ebuild with the same Intel Arc (Meteor Lake) iGPU the seven fail the same way andflat_aperturespasses alone in 25 s, so they are unrelated to this branch.tools/check_conventions.py --base origin/main,tools/check_test_registration.py buildandgit diff --checkpass.eboot.binandsce_module/libc.prxunwrapped from their SELF containers,relinker --registry, thentools/import_audit.pyagainst.prxfiles built frommainand from the branch. The titles were not run. Not tested on Windows.AI-assisted: yes (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by Silverash-i8 on 2026-10-11T01:18:42Z.
Windows run, since the issue says it wasn't tested there: Windows 11, WinLibs GCC 15.2.0 r7, Release,
feat/libkernel-truncate(91bc3930) merged ontomain06da1176together with #3116, #3117 and #3169.guest_truncatepasses, including the Windows-only part: the read-only file (SetFileAttributesW(FILE_ATTRIBUTE_READONLY)) gives EACCES and the locked file keeps its contents. So the_wopen+_chsize_spath works here.ctest -E "^agc_") pass with the four branches merged.AI-assisted (Claude Code); I ran this on my machine.
Imported from boykopovar/AnyPS5. Originally posted by danzaio on 2026-10-11T01:30:05Z.
Windows validation for this branch, which was Fedora-only so far.
Windows 11, MinGW-w64 GCC 15.2.0 (WinLibs r7), Ninja, Release, BUILD_TESTING=ON, branch 91bc3930: guest_truncate passes 1/1. I did not run guest_filesystem here (this machine lacks Developer Mode, so its symlink setup aborts before any assertion).
AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-11T10:27:49Z.
Independent verification on Linux — a second distribution and GPU to complement the report's Fedora 44 / Intel Arc run: CachyOS, kernel 7.2.9, AMD RX 9070 XT (RADV), GCC 16.2.1, Ninja, Release,
BUILD_TESTING=ON.91bc3930onto currentmain(the branch sat on942a174e, several hundred commits behind): applies cleanly, no conflicts.tools/check_conventions.pyandgit diff --checkpass.guest_truncateandguest_filesystempass.ctest -j8 -E "^agc_driver_|^video_out_flip"): 521/521 passed.The rebased branch is available at
blawesom:verify/3181for anyone carrying — the commit is otherwise unchanged.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-16T04:25:02Z.
The author of the ready
truncatebranch is Mouad-Scriptz-0, and the commit preserves their authored change. Do you want me to carry the verified commit into an upstream PR, or would you rather open it yourself? I will wait for your preference.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-16T04:28:46Z.
I independently carried the published
blawesom:verify/3181commit onto current main5d9dcc42din a temporary worktree, preserving the original author (the commit already includes blawesom as committer/coauthor context). Linux GCC 12.2 Release:guest_truncate_testsbuilds;guest_truncatepasses when run as an unprivileged user from a writable temporary directory. The first root run aborted at the read-only-file assertion because root can truncate through POSIX mode bits; that is an environment limitation, not a failure under the intended permission model.check_conventions.py --base upstream/mainandgit diff --checkpass. This focused configure reports 638 registered executables, 0 built, so I did not run the full suite. I checked the original commit and current-main diff; the implementation remains confined to Stdio.cpp, its test registration, and the new guest test. Are you happy for me to open this commit as a PR now, or do you plan to do so yourself?