fix(libSceIcu): follow u_strToUTF8 output and status in ures_getUTF8String #25502
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/25502"
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 mauroalvare on 2026-11-22T06:10:28Z.
What
ures_getUTF8String,ures_getUTF8StringByIndexandures_getUTF8StringByKey(#24357) follow ICU'sures_toUTF8String, which ends inu_terminateCharseither directly (uresbund.cpp L1332) or throughu_strToUTF8(ustrtrns.cpp L1052). When the terminating NUL fits,u_terminateCharschanges an incomingU_STRING_NOT_TERMINATED_WARNINGtoU_ZERO_ERRORand leaves every other warning as it is (ustring.cpp L1439-L1460).The port converts with a fresh host status and copied it back only when that status was not
U_ZERO_ERROR, so the caller's warning was never cleared. A caller that reuses oneUErrorCodeafter a call that filled its buffer exactly still sawU_STRING_NOT_TERMINATED_WARNINGafter a later call that wrote a terminated string.ResourceUtf8.cpp:ToUtf8receives the status the caller passed in. After it writes a NUL (a terminated conversion, or an empty string copied withforceCopy), an incomingU_STRING_NOT_TERMINATED_WARNINGbecomesU_ZERO_ERROR. Other warnings are kept, the read-only empty string returned withoutforceCopyleaves the status alone, and an exact fit still reports the warning, as in ICU.tests/ResourceUtf8.cpp: withU_STRING_NOT_TERMINATED_WARNINGpassed in, a terminated string atdest, one placed at the tail, an empty string copied withforceCopyand a by-key lookup end withU_ZERO_ERROR. The read-only empty string and an exact fit keep the warning, andU_USING_DEFAULT_WARNINGpassed in is kept.The second commit covers the other
u_strToUTF8behaviour the port missed: when the UTF-8 form does not fit, ICU writes the whole characters that fit before it reportsU_BUFFER_OVERFLOW_ERROR(ustrtrns.cpp L835-L839), and never part of one. The port leftdestuntouched.ToUtf8now copies that prefix from the host conversion; the existing check that expected an untouched buffer now expects\xc3\xbf(the firstU+00FF) in a 2-byte buffer, and a 3-byte buffer gets the same 2 bytes.Tested
Windows 11 Pro 10.0.26300, WinLibs GCC 15.2.0, Release, BUILD_TESTING=ON, head
26514a362bonmain76de27b03a:ctest -R icu: 88 of 88 passed.main'sResourceUtf8.cpp,guest_icu_resource_utf8fails at the first new check (ures_getUTF8String kept the not-terminated warning after terminating the string); with the first commit'sResourceUtf8.cppit fails atures_getUTF8String did not write the characters that fit.python tools/check_conventions.py --base origin/main: all checks passed.git diff --check origin/main...HEAD: clean.tools/pr_overlap.py --branch: no overlap with open pull requests.--nameslists #14443 and the source-splitting refactors #24322, #24910 and #24917 by export name; none of them changesResourceUtf8.cppor its test. #25371 changes the same two files for a different case (resource 0 as the empty string):git merge-treemerges the two branches without conflicts, andguest_icu_resource_utf8passes on the merged result.Not run on Linux or macOS locally.
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)Summary by CodeRabbit
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-22T06:12:03Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
5163c53dd6:tools/check_conventions.pypassed.guest_icu_resource_utf8_testsbuilt cleanly.guest_icu_resource_utf8):core/libs/prx/libSceIcu/ResourceUtf8.cppreverted tomainand the new tests kept, the suite fails: Restoring the change makes it pass again.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T06:22:20Z.
Review: APPROVED
Reviewed — looks good
The status change matches ICU’s termination behavior: it clears only an incoming not-terminated warning after writing a terminator, and the reviewed tests cover the relevant cases.
What I ran
Reviewed head
5163c53dd6bfc3d42c5bafe5d6799ce804fa02ab. I read the prepared diff, manifest, description, commits, and both changed files. I did not run commands or tests; test results in the description are author-reported.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
Linux and macOS behavior and the author-reported test runs were not independently verified. The changed-file manifest lists two files, both read:
core/libs/prx/libSceIcu/ResourceUtf8.cppandcore/libs/prx/libSceIcu/tests/ResourceUtf8.cpp. No files were excluded in the manifest.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-22T07:13:03Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
26514a362b:tools/check_conventions.pypassed.guest_icu_resource_utf8_testsbuilt cleanly.guest_icu_resource_utf8):core/libs/prx/libSceIcu/ResourceUtf8.cppreverted tomainand the new tests kept, the suite fails: Restoring the change makes it pass again.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T07:17:56Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the inspected conversion and status handling are consistent with the stated ICU behavior.
What I ran
Reviewed head
26514a362b1e1ffacd1f130b2871656d57da7491. I inspected the prepared description, commit list, manifest, diff, both changed source files, and targeted search results usingrepo_read.py. I did not run tests or other commands.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
No tests or builds were run in this review. The author reports 88 ICU tests passed on Windows; that result was not independently confirmed. Linux and macOS behavior was not verified.
To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-30T00:42:52Z.
Review: COMMENTED
Reviewed — no blocking findings
The review folder and repository reader are unavailable in this environment, so the change could not be inspected and no verdict is justified.
What I ran
Not run; no reader command or review-folder contents were available.
Results
Findings
Blocking
None verified.
Non-blocking
None.
Not verified
Could not read description.md, commits.md, diff.patch, manifest.json, or changed-file contents; therefore no files were read against files reviewed.
To get this to a good state
Provide access to the prepared review folder and repo_read.py so the pinned change can be reviewed.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T13:55:42Z.
Review: COMMENTED
Built the branch sources against the existing Linux runtime. The resource UTF-8 conversion fixture passed.
AI-assisted: yes.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.