feat(libSceNKWebKit): implement WTF FileSystemImpl existence, delete and volume helpers over the guest filesystem #19822
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/19822"
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 B-Howell on 2026-11-14T00:33:14Z.
What
Implements six existing
WTF::FileSystemImplstubs in libSceNKWebKit over the guest filesystem, following the pinned PS5-WebKit-11.x PlayStation build (playstation/FileSystemPlayStation.cpp,posix/FileSystemPOSIX.cppand thestd::filesystembranch ofFileSystem.cpp, sinceFILESYSTEM_POSIX_FAST_PATHis Cocoa-only):fileExists: gueststatsucceeds (std::filesystem::exists).deleteFile:lstat, false for a directory, thenunlink.deleteEmptyDirectory:lstat, false unless a directory (a symlink is not), thenrmdir.moveFile:renameof the two UTF-8 paths,!= -1.realPath: guestrealpathinto a 1024-byte buffer; on failure returns the inputStringunchanged.filesHaveSameVolume: false for a nullString, otherwise bothstatcalls must succeed andst_devmust match.Paths use the existing
String::utf8export asopenFilealready does; results useString::fromUTF8. Routing goes through the existing libkernelstat/lstat/unlink/rmdirand libcrename/realpathexports, and the directory test reusesGuestFilesystem::TypeOfMode. The six inventory rows are removed and a debt entry records that console ABI is not measured.Tested
WSL Ubuntu, GCC,
nkwebkit_wtf_tests(newTestFileSystemHelpersintests/Wtf.cpp, through a guest path alias): existence for a file, a directory, missing, empty and null paths; same volume for two files and a file and directory, false for null, missing and empty; move and move of a missing or null source;realPathof/alias/sub/../moved.txtgives/alias/moved.txt, a missing path and a null String come back unchanged; delete twice, delete of a directory and of null;deleteEmptyDirectoryfalse on a non-empty directory, a file, missing and null, true on an empty directory.main6fd2999417): the test does not build,Wtf.cpp:602: error: too many arguments to functionfor each stub.1b5206fed7):ctest -R '^nkwebkit_wtf$'passed 3/3 (1/1 Test #3930: nkwebkit_wtf ... Passed 0.02 sec).ctest -R '^public_headers': 65/65 passed.tools/progress.py: libraries 15784 to 15790 of 39340 (40.12% to 40.14%, +6 implemented).7b18132687merged onto main04631f5042(report):nkwebkit_wtfpassed 3/3, none skipped.e41774e46ef, with fix76e9ef8a1e6: the Windows CI failure was this PR.patched_librariesreportedlibSceNKWebKit.prx: LoadLibraryEx failed with error 127becausemoveFileimportedrename_nid_postfixfrom libkernel.prx (libkernel also builds libc'sRename.cpp), and libkernel's patched exports keep that name un-NIDed while the import was patched to the NID. The fix callsRenameGuestPath_nid_no_patch, the same body, whose name is kept on both sides. Windows 11, WinLibs GCC 15.2, Release: before the fix412 patched libraries loaded, 1 failed; after itpatched_librariesandnkwebkit_wtfpassed, and every libkernel import of the module resolves. Windows 11, WinLibs GCC 15.2, Release, all 18 of our main merges from this round built together on main790e9a371cc:ctest -R nkwebkit116/116 passed,patched_librariespassed once the #19822 fix was in. Re-merged ontob9fb5ab5a32(no NKWebKit changes in between);check_conventionspassed.6166cb158b: merged main3ae84d01bd3(thetests/Wtf.cppconflict with #19103 kept both test groups) and moved this PR's debt edits intodocs/dev/debt/changes/claude-wtf-fs-existence-delete.md; the debt files match main. WSL2 Ubuntu:nkwebkit_wtf_testsbuilt andctest -R ^nkwebkit_wtf$passed 1/1.debt_fold.py --checkandcheck_conventions.py --base origin/mainpass.ea3626604eaonto main80dffd266c0: conflict only inExport.cppandinclude/InventoryExports.hpp, where #21270 removed the adjacentmakeAllDirectoriesstub and this PR removes thefilesHaveSameVolumeanddeleteEmptyDirectorystubs; all three stubs are dropped. WSL2 Ubuntu, GCC, Release:nkwebkit_wtf_testsbuilt andctest -R ^nkwebkit_wtf$ --repeat until-fail:3passed.debt_fold.py --checkandcheck_conventions.py --base origin/mainpass; the debt files match main.0acf163a3fconto main1d3c669c843: conflict only intests/Wtf.cpp, where #19380 added its StackBounds and TimingScope tests next to this PR'sTestFileSystemHelpers; both test groups are kept. WSL2 Ubuntu, GCC, Release:nkwebkit_wtf_testsbuilt andctest -R ^nkwebkit_wtf$ --repeat until-fail:3passed.debt_fold.py --checkandcheck_conventions.py --base origin/mainpass; the debt files match main.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-14T01:01:37Z.
Review: CHANGES_REQUESTED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
7b18132687:tools/check_conventions.pypassed;git diff --checkclean.nkwebkit_wtf_testsbuilt cleanly.nkwebkit_wtf):core/libs/prx/libSceNKWebKit/Export.cpp,core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp,core/libs/prx/libSceNKWebKit/include/WtfExports.hppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Requesting changes for the points above.
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-15T19:17:12Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
7b18132687:tools/check_conventions.pypassed;git diff --checkclean.nkwebkit_wtf_testsbuilt cleanly.nkwebkit_wtf):core/libs/prx/libSceNKWebKit/Export.cpp,core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp,core/libs/prx/libSceNKWebKit/include/WtfExports.hppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-15T21:19:20Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
76e9ef8a1e:tools/check_conventions.pypassed;git diff --checkclean.nkwebkit_wtf_testsbuilt cleanly.nkwebkit_wtf):core/libs/prx/libSceNKWebKit/Export.cpp,core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp,core/libs/prx/libSceNKWebKit/include/WtfExports.hppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.FileSystemRepresentationandDatasafely extract the UTF-8 buffer fromWTF::Stringvia_ZNK3WTF6String4utf8ENS_14ConversionModeEand returnnullptrwhenrepresentation.bufferis null.Statuschecksif (!data) return false;before callingstat_nid_postfix(whenfollowLinksis true, used byfileExistsandfilesHaveSameVolume) orlstat_nid_postfix(whenfollowLinksis false, used bydeleteFileanddeleteEmptyDirectory)._ZN3WTF14FileSystemImpl10deleteFileERKNS_6StringErejects directories (IsDirectory(status)) before callingunlink_nid_postfix, and_ZN3WTF14FileSystemImpl20deleteEmptyDirectoryERKNS_6StringErequiresIsDirectory(status)(excluding symlinks vialstat_nid_postfix) before callingrmdir_nid_postfix._ZN3WTF14FileSystemImpl8moveFileERKNS_6StringES3_validates non-null UTF-8 representations for botholdPathandnewPathbefore callingRenameGuestPath_nid_no_patch, and_ZN3WTF14FileSystemImpl8realPathERKNS_6StringEpasses a 1024-byte stack buffer torealpath_nid_postfixand falls back to returningfilePathunchanged on failure._ZN3WTF14FileSystemImpl19filesHaveSameVolumeERKNS_6StringES3_checks!fileA.impl || !fileB.implfirst and requiresStatus(..., true)to succeed on both paths before comparingstatusA.st_dev == statusB.st_dev.APS5_VABIsignatures, and documented in technical debt.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-15T23:58:44Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
6166cb158b:tools/check_conventions.pypassed;git diff --checkclean.nkwebkit_wtf_testsbuilt cleanly.nkwebkit_wtf):core/libs/prx/libSceNKWebKit/Export.cpp,core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp,core/libs/prx/libSceNKWebKit/include/WtfExports.hppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-16T20:09:37Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
ea3626604e:tools/check_conventions.pypassed.nkwebkit_wtf_testsbuilt cleanly.nkwebkit_wtf):core/libs/prx/libSceNKWebKit/Export.cpp,core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp,core/libs/prx/libSceNKWebKit/include/WtfExports.hpp,core/libs/prx/libSceNKWebKit/src/WtfFileSystem.cppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-16T22:19:25Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
0acf163a3f:tools/check_conventions.pypassed.nkwebkit_wtf_testsbuilt cleanly.nkwebkit_wtf):core/libs/prx/libSceNKWebKit/Export.cpp,core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp,core/libs/prx/libSceNKWebKit/include/WtfExports.hpp,core/libs/prx/libSceNKWebKit/src/WtfFileSystem.cppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-17T01:42:57Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
ee5a6f504b:tools/check_conventions.pypassed.nkwebkit_wtf_testsbuilt cleanly.nkwebkit_wtf):core/libs/prx/libSceNKWebKit/Export.cpp,core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp,core/libs/prx/libSceNKWebKit/include/WtfExports.hpp,core/libs/prx/libSceNKWebKit/src/WtfFileSystem.cppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Looks Good To Me