feat(libSceLibcInternal): implement char num_put::_Fput #24907
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/24907"
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 0x70776c on 2026-11-21T10:18:08Z.
What
Implement
std::num_put<char>::_Fput(ostreambuf_iterator<char>, ios_base&, char, const char*, size_t)(_ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE5_FputES3_RSt8ios_basecPKcm, NIDll99KkqO6ig) inlibSceLibcInternal:digits, widen throughctype<char>when present, locate the decimal point in the widened text usingctype<char>::widen, applynumpunct<char>decimal point and grouping/thousands separators (skippinginf/nanand stopping at exponents), preserve sign and0x/0Xprefixes forinternalpadding, and resetstream->widthto 0.out.failedbecomes true.core/libs/prx/libSceLibcInternal/tests/CharNumPutFloatField.cpp(guest_libc_internal_char_num_put_float_field).docs/dev/debt/changes/feat-libcinternal-char-num-put-fput.md.Tested
python3 tools/check_conventions.py --base origin/maincmake --build build --target guest_libc_internal_char_num_put_float_field_tests --parallelctest --test-dir build --output-on-failure -R '^(guest_libc_internal_char_num_put_float_field|public_headers)$'(2/2 passed)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 repositorySummary by CodeRabbit
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-21T10:20:10Z.
Review: CHANGES_REQUESTED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
838c3251f9:tools/check_conventions.pyfailed.guest_libc_internal_char_num_put_float_field_testsbuilt cleanly.guest_libc_internal_char_num_put_float_field):Requesting changes for the points above.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T10:22:46Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
Changes are required before merge: compute the decimal point position from the locale-widened output so punctuation replacement and grouping use the same character representation.
What I ran
Reviewed head
838c3251f91085f16b252c6afb37873e8b829450using the prepared diff and pinned source reader. No build or tests were run during this review; the commands listed in the PR description are author-reported.Results
Findings
Blocking
CharNumPutFloatField.cpp:107:pointOffsetis searched inraw, beforectype<char>::widenRangetransforms it intotext. When a locale’sctype<char>widens the decimal point to a different character, the search can miss the point;_Fputthen leaves the widened decimal point unchanged and setsgroupEndto the exponent or end of input, allowing grouping to run across the fractional portion. Determine the decimal point offset consistently with the widened output (and apply the punctuation facet at that offset).Non-blocking
None.
Sources
core/libs/prx/libSceLibcInternal/CharNumPutFloatField.cpplines 106–120 in the reviewed diff and source.Not verified
debt_fold.py,check_conventions.py, a build, and two passing CTest cases; these results were not independently verified.files.jsonwas not available as a review document.To get this to a good state
ctype<char>widening, then rerun the build and the focused CTest cases on the updated head.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T11:07:54Z.
Review: COMMENTED
Reviewed — no blocking findings
The implementation and added tests were reviewed at head
b9fb3ec88dbedf7fe885a7014dc1b79b6061eb8a; no blocking defect was verified, but the reported build and test commands were not run in this review.What I ran
No commands were run. I read the prepared review bundle and changed code through
repo_read.py.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
The reported convention check, build, and two CTest results were not independently verified. No runtime or console behavior was tested. All six changed files listed in the manifest were read; no changed files were excluded.
To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-21T11:09:45Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
b9fb3ec88d:tools/check_conventions.pypassed.guest_libc_internal_char_num_put_float_field_testsbuilt cleanly.guest_libc_internal_char_num_put_float_field):core/libs/prx/libSceLibcInternal/Err.cpp,core/libs/prx/libSceLibcInternal/include/ErrExports.hpp,core/libs/prx/libSceLibcInternal/CharNumPutFloatField.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 MarcZX10 on 2026-11-21T12:40:28Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
Changes are required before merge: stop formatting as soon as the output iterator has failed.
What I ran
Reviewed head
7847f02b99683b912703fa9a0a75766ba025e701; no commands or tests were run. Read the prepared description, commits, manifest, and diff, plus changed source and test files at the pinned head.Results
Findings
Blocking
core/libs/prx/libc/src/LocaleSupport.cpp:503:PutFloatingpasses the iterator toPutField, whose fill and character loops continue callingPutCharacterafter a write setsout.failed. This can keep invoking a failed stream buffer for the rest of the formatted field, including width padding, and contradicts the stated short-circuit behavior. Return onceout.failedbecomes true in the output loops (including withinPutField).Non-blocking
None.
Not verified
No build or tests were run. The build and 2/2 CTest results in the description are author-reported. No files were excluded by the manifest; all 8 changed files were read.
To get this to a good state
Stop output after the first failed write, then rerun the changed test target and the stated CTest selection on the updated head.
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-21T13:16:35Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
7847f02b99:tools/check_conventions.pypassed.guest_libc_internal_char_num_put_float_field_testsbuilt cleanly.guest_libc_internal_char_num_put_float_field):core/libs/prx/libSceLibcInternal/Err.cpp,core/libs/prx/libSceLibcInternal/include/ErrExports.hpp,core/libs/prx/libc/include/GuestLocale.hpp,core/libs/prx/libc/src/LocaleSupport.cpp,core/libs/prx/libSceLibcInternal/CharNumPutFloatField.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 MarcZX10 on 2026-11-22T17:32:20Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
Changes are required before merge: bound exponent detection to the supplied digit count.
What I ran
Reviewed head
719e0524f350c45e0233107df45e0a3f0032274b. No commands or tests were run in this review; the description reports its own build and test runs.Results
Findings
Blocking
core/libs/prx/libc/src/LocaleSupport.cpp:505callsstd::strcspn(digits, ...), which scans until NUL even though the caller suppliescountand the wrapper copies exactly that many bytes. A non-NUL-terminated buffer or a buffer whose NUL lies beyondcountcan make this read outside the supplied range. Bound exponent detection tocount(and use the bounded result when grouping).Non-blocking
None.
Not verified
No build, tests, or convention checks were run. The description reports
check_conventions.py, a build, and two passing tests; those results were not independently verified. All changed files were read:core/libs/prx/libSceLibcInternal/CMakeLists.txt,core/libs/prx/libSceLibcInternal/CharNumPutFloatField.cpp,core/libs/prx/libSceLibcInternal/Err.cpp,core/libs/prx/libSceLibcInternal/include/ErrExports.hpp,core/libs/prx/libSceLibcInternal/tests/CharNumPutFloatField.cpp,core/libs/prx/libc/include/GuestLocale.hpp,core/libs/prx/libc/src/LocaleSupport.cpp, anddocs/dev/debt/changes/feat-libcinternal-char-num-put-fput.md. No changed files were excluded.To get this to a good state
Bound the exponent scan by
count, then rerun the reported convention check, build, and targetedctestchecks on the updated head.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T08:17:10Z.
Review: DISMISSED
Reviewed — changes requested
Changes are required before merge: stop
_Fputoutput loops after the iterator becomes failed.What I ran
Reviewed head
488213d9a8bfec3ad8b3d2ae989ef7e1b310abbaagainst the prepared diff. I did not run commands or tests; the checks in the PR description are author-reported.Results
Findings
Blocking
core/libs/prx/libc/src/LocaleSupport.cpp:331— The new_Fputpath callsPutField, whose output loops do not checkout.failedafterPutCharactermarks it true. When the stream buffer'soverflowfails, the function continues attempting to emit the remaining prefix, text, and padding. This violates the described short-circuit behavior and can trigger repeated overflow calls after a permanent output failure. Stop each output loop once the iterator fails, while still resettingstream->width.Non-blocking
None.
Not verified
No tests or build checks were run. The PR description reports the convention check, target build, and two CTest cases passed, but those results were not independently verified. All eight changed files listed in the manifest were read, including the changed lines;
files.jsonwas not available. No repository files were excluded in the manifest.To get this to a good state
Stop writing after iterator failure and rerun the reported build and tests on the updated head.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T15:59:49Z.
Review: COMMENTED
This head conflicts with main's locale lifetime changes. In a local merge I kept main's
GlobalLocaleHoldcalls for the ctype and punctuation facets while applying the proposed floating-field changes.guest_libc_internal_char_num_put_float_fieldthen passed on Linux. Please retain the locale holds when rebasing the branch.AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-12-04T11:59:37Z.
Review: COMMENTED
Actionable comments
2818a28e-5bfb-4568-bcc1-1fea7ed7a8f3Reviewing files that changed from the base of the PR and between
63b98e5bf8andc3fabec47a.core/libs/prx/libSceLibcInternal/CMakeLists.txtcore/libs/prx/libSceLibcInternal/CharNumPutFloatField.cppcore/libs/prx/libSceLibcInternal/Err.cppcore/libs/prx/libSceLibcInternal/include/ErrExports.hppcore/libs/prx/libSceLibcInternal/tests/CharNumPutFloatField.cppcore/libs/prx/libc/include/GuestLocale.hppcore/libs/prx/libc/src/LocaleSupport.cppdocs/dev/debt/changes/feat-libcinternal-char-num-put-fput.mdIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-04T12:27:29Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
Changes are required before merge: include the
0x/0Xprefix when computing internal padding for signed hexadecimal floats.What I ran
Reviewed head
c3fabec47aba1abc39be5479cdb76e3974a43510using the prepared diff andrepo_read.pysource context. No commands or tests were run.Results
Findings
Blocking
core/libs/prx/libc/src/LocaleSupport.cpp:522: When the digits begin with a sign,prefixis set to the sign length without checking for a following0x/0X. With internal alignment, padding is therefore inserted between the sign and hexadecimal prefix (for example,-*0x1.8p+0). Include the hexadecimal prefix after the sign when it is present, and update the signed hex-float expectation inCharNumPutFloatField.cpp.Non-blocking
None.
Not verified
No tests or builds were run. I read the prepared description, commits, manifest, diff, and
files.json, plus relevant pinned source context forLocaleSupport.cpp; I did not read every changed file in full.files.jsonlists eight reviewed files and no excluded files.To get this to a good state
Include the sign and hexadecimal prefix in the internal-padding prefix, then rerun the focused test on the updated head.
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.