feat(libSceIcu): give eight usearch exports their ICU 68.2 signatures and early returns #23819
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/23819"
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 ToRaNek on 2026-11-19T17:54:33Z.
What
Eight
usearchexports of libSceIcu were parameterlessintplaceholders inRecoveredInventory.cppthat threw on every call:usearch_getCollator,usearch_getMatchedLength,usearch_next,usearch_reset,usearch_setAttribute,usearch_setOffset,usearch_setPatternandusearch_setText. They now have their ICU 68.2 prototypes and the early returns of usearch.cpp, next tousearch_openinStringSearch.cpp, the way #17265 did it for 70 other recovered exports. NoUStringSearchobject can exist yet (usearch_openthrows on a valid call), so every path that reads or writes one still throwsNotImplemented_nid_no_patch.What each one does before it needs the object, with the lines of usearch.cpp at that commit:
usearch_getCollatorNULLusearch_getMatchedLengthUSEARCH_DONE(-1)usearch_resetusearch_nextUSEARCH_DONE, status untouchedusearch_setOffsetusearch_setAttributeU_ILLEGAL_ARGUMENT_ERRORwithout reading the object; then valueUSEARCH_ATTRIBUTE_VALUE_COUNT(5) setsU_ILLEGAL_ARGUMENT_ERRORwhatever the status and the search wereusearch_setPatternU_ILLEGAL_ARGUMENT_ERRORusearch_setTextU_ILLEGAL_ARGUMENT_ERRORTwo details follow the source rather than the usual pattern:
usearch_setAttributetestsvalue == USEARCH_ATTRIBUTE_VALUE_COUNTafter itsif (U_SUCCESS(*status) && strsrch)block, so that value overwrites an already failing status and is reported for a null search too.usearch_setPatternwith length -1 callsu_strlenand rejects a length of 0. Only the first code unit is read here: an empty pattern is rejected, any other one goes on to the object and throws.usearch_setTexthas no such check: length -1 with an empty text reaches the object, so it throws.The guest
UErrorCodeand the first pattern unit are read and written through the file's existingGuestCopyIn_nid_no_patch/GuestCopyOut_nid_no_patchhelpers, which keeperrno. A nullUErrorCodethrows, as forusearch_open: the console dereferences it.Debt: the
ICU string search exportsentry now names the nine exports. Therecovered inventory exportsentry goes from 47 to 39 placeholders left;tools/debt_fold.py --checkrefuses two fragments that change the same entry and asks to merge them, so that count is edited in the pendingfeat-libsceicu-field-position-iterator.mdfragment.Tested
Windows 11 IoT Enterprise LTSC 2024 (10.0.26100), WinLibs GCC 15.2.0 r7, Release,
BUILD_TESTING=ON, basemain9d5f50bdf0. Not run on a console; the console behaviour of these exports is unverified, as the debt entry says.guest_icu_recovered_signaturespasses.tests/StringSearch.cppgains aUsearchObjectgroup:static_asserts on the eight prototypes; the null-search results; seven failing and four non-failing status values against a null and a non-null search (status unchanged where ICU leaves it,U_ILLEGAL_ARGUMENT_ERRORwhere ICU sets it, a throw where the object is needed, the fake object's bytes unchanged); a null status; and guest pointers (an unreadable status, a read-only status that must not be written on the early returns and throws when a write is due, an unreadable pattern with length -1), witherrnokept.mainthe placeholders areint(), so the new checks cannot compile against them (by construction, not built). Five one-line mutations of the new code each fail the test, then it passes again with the code restored: a null search returning 0 fromusearch_getMatchedLength; theUSEARCH_ATTRIBUTE_VALUE_COUNTcheck removed; the empty pattern at length -1 not rejected;usearch_setTextaccepting a length below -1;usearch_setAttributethrowing on an attribute outside 0..2.ctest -R icu: 76 of 76 pass.python tools/check_conventions.py --base origin/mainandpython tools/debt_fold.py --checkpass.python tools/pr_overlap.py --namesover the eight names: each is a stub onmainand no open PR adds or edits it.--branchcould not compare six open PRs that conflict withmainon the recovered inventory files (#18210, #19635, #19645, #19670, #19720, #23196); compared by hand, none of them touches ausearchexport or the string search debt entry.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-19T18:17:56Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
72d2b41c59:tools/check_conventions.pypassed.guest_icu_recovered_signatures_testsbuilt cleanly.guest_icu_recovered_signatures):core/libs/prx/libSceIcu/RecoveredInventory.cpp,core/libs/prx/libSceIcu/RecoveredInventory.hpp,core/libs/prx/libSceIcu/RecoveredSignatures.hpp,core/libs/prx/libSceIcu/StringSearch.cppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Looks Good To Me