feat(libSceLibcInternal): implement numpunct, facet construction and stream runtime #25573

Open
MertSoylu wants to merge 1 commit from upstream-pr/25573 into main
MertSoylu commented 2026-11-22 09:32:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MertSoylu on 2026-11-22T09:32:05Z.


What

Implements 89 libSceLibcInternal exports from the libc.prx bundled with PPSA21564, inspected statically:

  • numpunct<wchar_t> construction, _Init and destructors (Punctuation.cpp). Separators are those of the C locale, the only locale _Locinfo holds, not the global localeconv.
  • Construction, _Init and _Getcat for collate, num_get, num_put<char>, money_get, money_put, time_get, time_put and messages. Also locale::_Locimp destruction and C1, locale::empty, locale::~locale, the _Locinfo name constructors and _Addcats, the ctype<wchar_t> destructors, the num_put<char>/money_put _Put/_Rep helpers and Dinkum::codecvt::_Cvt_check (FacetConstruction.cpp). ~_Locimp releases the system lock on every path, including when a facet destructor throws.
  • num_get do_get(bool), num_get<wchar_t>::do_get(void*) and _Getifld (NumGet.cpp).
  • Stream runtime (StreamRuntime.cpp): the _System_error_category/_Iostream_error_category members, _Debug_message, and basic_filebuf sync, pbackfail and _Endwrite.
  • std::_sceLibcLocinfo, the remaining inet helpers and basic_string<char>::_Copy.

libSceLibcInternal coverage goes from 60.14% to 68.06% (676 to 765 of 1124) per tools/progress.py against current main.

Functions also implemented by other open PRs are left out of this one: moneypunct/_Mpunct (#18135), the wide num_put constructors and _Getcat (#24884), __kernel_* (#13778), istreambuf_iterator::equal (#23809), wide time_put::_Init (#24899) and num_get<char>::do_get(void*) (#24748). After the review, the exports of #14834 (error-class deleting destructors), #19602 (std::_Mutex), #19767 (_Set_raise_handler), #21930 (numpunct<char> _Init, C1, C2, D0, D1, D2), #24526 (facet D0 destructors of collate<wchar_t>, num_get, num_put<char>, money_get, money_put<char>), #22370 (_Locimp C2 and _Locinfo C1), #24880 (wide money_get/money_put), #24942 (messages _Getcat) and #25111 (do_scan_is) are left out too. Known gaps are recorded in the debt fragment.

Tested

Windows 11, MinGW-w64 GCC: ctest -R guest_libc_internal passes (90/90). That includes the new guest_libc_internal_punctuation, guest_libc_internal_facet_construction, guest_libc_internal_stream_runtime and guest_libc_internal_locale_name tests. tools/check_conventions.py --base upstream/main and tools/debt_fold.py --check are clean. Not run on a console or in a title.

Checklist

  • Based on current main; no other open PR implements the same functions (pr_overlap.py --branch reports no shared export; the file overlaps it lists are neighbouring stub lines)
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt and the licence notice of code adapted from upstream (see AGENTS.md)
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5437697284 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25573). Originally posted by [MertSoylu](https://github.com/MertSoylu) on 2026-11-22T09:32:05Z. --- ### What Implements 89 libSceLibcInternal exports from the `libc.prx` bundled with PPSA21564, inspected statically: - `numpunct<wchar_t>` construction, `_Init` and destructors (`Punctuation.cpp`). Separators are those of the C locale, the only locale `_Locinfo` holds, not the global `localeconv`. - Construction, `_Init` and `_Getcat` for `collate`, `num_get`, `num_put<char>`, `money_get`, `money_put`, `time_get`, `time_put` and `messages`. Also `locale::_Locimp` destruction and `C1`, `locale::empty`, `locale::~locale`, the `_Locinfo` name constructors and `_Addcats`, the `ctype<wchar_t>` destructors, the `num_put<char>`/`money_put` `_Put`/`_Rep` helpers and `Dinkum::codecvt::_Cvt_check` (`FacetConstruction.cpp`). `~_Locimp` releases the system lock on every path, including when a facet destructor throws. - `num_get` `do_get(bool)`, `num_get<wchar_t>::do_get(void*)` and `_Getifld` (`NumGet.cpp`). - Stream runtime (`StreamRuntime.cpp`): the `_System_error_category`/`_Iostream_error_category` members, `_Debug_message`, and `basic_filebuf` `sync`, `pbackfail` and `_Endwrite`. - `std::_sceLibcLocinfo`, the remaining inet helpers and `basic_string<char>::_Copy`. libSceLibcInternal coverage goes from 60.14% to 68.06% (676 to 765 of 1124) per `tools/progress.py` against current `main`. Functions also implemented by other open PRs are left out of this one: moneypunct/_Mpunct (#18135), the wide num_put constructors and `_Getcat` (#24884), `__kernel_*` (#13778), `istreambuf_iterator::equal` (#23809), wide `time_put::_Init` (#24899) and `num_get<char>::do_get(void*)` (#24748). After the review, the exports of #14834 (error-class deleting destructors), #19602 (`std::_Mutex`), #19767 (`_Set_raise_handler`), #21930 (`numpunct<char>` `_Init`, `C1`, `C2`, `D0`, `D1`, `D2`), #24526 (facet D0 destructors of `collate<wchar_t>`, `num_get`, `num_put<char>`, `money_get`, `money_put<char>`), #22370 (`_Locimp` `C2` and `_Locinfo` `C1`), #24880 (wide `money_get`/`money_put`), #24942 (`messages` `_Getcat`) and #25111 (`do_scan_is`) are left out too. Known gaps are recorded in the debt fragment. ### Tested Windows 11, MinGW-w64 GCC: `ctest -R guest_libc_internal` passes (90/90). That includes the new `guest_libc_internal_punctuation`, `guest_libc_internal_facet_construction`, `guest_libc_internal_stream_runtime` and `guest_libc_internal_locale_name` tests. `tools/check_conventions.py --base upstream/main` and `tools/debt_fold.py --check` are clean. Not run on a console or in a title. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions (`pr_overlap.py --branch` reports no shared export; the file overlaps it lists are neighbouring stub lines) - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) and the licence notice of code adapted from upstream (see AGENTS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
PrivacyOnion commented 2026-11-22 09:48:37 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-22T09:48:37Z.

Review: APPROVED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 99aa237f5a:

  • Conventions: tools/check_conventions.py passed.
  • Build: guest_libc_internal_basic_string_tests, guest_libc_internal_facet_construction_tests, guest_libc_internal_locale_name_tests, guest_libc_internal_punctuation_tests, guest_libc_internal_stream_runtime_tests, guest_libc_internal_time_get_fields_tests built cleanly.
  • CTest (guest_libc_internal_locale_name, guest_libc_internal_punctuation, guest_libc_internal_stream_runtime, guest_libc_internal_basic_string, guest_libc_internal_time_get_fields, guest_libc_internal_facet_construction):
    1/6 Test #4602: guest_libc_internal_time_get_fields ......   Passed    0.03 sec
    2/6 Test #4503: guest_libc_internal_locale_name ..........   Passed    0.02 sec
    3/6 Test #4553: guest_libc_internal_basic_string .........   Passed    0.05 sec
    4/6 Test #4504: guest_libc_internal_punctuation ..........   Passed    0.02 sec
    5/6 Test #4612: guest_libc_internal_facet_construction ...   Passed    0.02 sec
    6/6 Test #4505: guest_libc_internal_stream_runtime .......   Passed    0.17 sec
    100% tests passed, 0 tests failed out of 6
    
  • Negative control: with core/libs/prx/libSceLibcInternal/BasicString.cpp, core/libs/prx/libSceLibcInternal/Err.cpp, core/libs/prx/libSceLibcInternal/Export.cpp, core/libs/prx/libSceLibcInternal/InventoryExports.cpp, core/libs/prx/libSceLibcInternal/InventoryExports2.cpp, core/libs/prx/libSceLibcInternal/InventoryExports6.cpp, core/libs/prx/libSceLibcInternal/NumGet.cpp, core/libs/prx/libSceLibcInternal/include/Api.hpp, core/libs/prx/libSceLibcInternal/include/InventoryExports.hpp, core/libs/prx/libSceLibcInternal/include/InventoryExports6.hpp, core/libs/prx/libc/include/Api.hpp, core/libs/prx/libc/include/GuestLocale.hpp, core/libs/prx/libc/src/LocaleSupport.cpp, core/libs/prx/libc/src/exception/StandardExceptions.cpp, core/libs/prx/libSceLibcInternal/FacetConstruction.cpp, core/libs/prx/libSceLibcInternal/LocaleName.cpp, core/libs/prx/libSceLibcInternal/Punctuation.cpp, core/libs/prx/libSceLibcInternal/StreamRuntime.cpp reverted to main, the new tests do not build/link without the change; restoring it makes them build and pass.
  • Code reading:
    • Checked BasicString.cpp: _ZNSs5_CopyEmm_nid_postfix for bounds, allocation exceptions, inline buffer handling, and deallocation logic.
    • Checked FacetConstruction.cpp: verified _ZSt8_LocinfoC1ERKSs_nid_postfix handles short string inline buffer (<= 15 bytes) and pointer buffer correctly.
    • Checked FacetConstruction.cpp: verified _ZNKSt5ctypeIwE10do_scan_isEsPKwS2__nid_postfix range validation, chunking, and GuestCopyIn error handling.
    • Checked FacetConstruction.cpp: verified _ZNSt6locale7_LocimpD1Ev_nid_postfix syslock locking, facet release, and classic facet preservation.
    • Checked FacetConstruction.cpp: verified PutElement / PutElements / RepeatElement streambuf buffer boundaries and overflow fallback.
    • Checked CMakeLists.txt and debt fragments for AGENTS.md compliance, convention checks, and unhandled stubs.

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6011564979 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25573#pullrequestreview-6011564979). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-22T09:48:37Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `99aa237f5a`: - **Conventions**: `tools/check_conventions.py` passed. - **Build**: `guest_libc_internal_basic_string_tests`, `guest_libc_internal_facet_construction_tests`, `guest_libc_internal_locale_name_tests`, `guest_libc_internal_punctuation_tests`, `guest_libc_internal_stream_runtime_tests`, `guest_libc_internal_time_get_fields_tests` built cleanly. - **CTest** (`guest_libc_internal_locale_name`, `guest_libc_internal_punctuation`, `guest_libc_internal_stream_runtime`, `guest_libc_internal_basic_string`, `guest_libc_internal_time_get_fields`, `guest_libc_internal_facet_construction`): ``` 1/6 Test #4602: guest_libc_internal_time_get_fields ...... Passed 0.03 sec 2/6 Test #4503: guest_libc_internal_locale_name .......... Passed 0.02 sec 3/6 Test #4553: guest_libc_internal_basic_string ......... Passed 0.05 sec 4/6 Test #4504: guest_libc_internal_punctuation .......... Passed 0.02 sec 5/6 Test #4612: guest_libc_internal_facet_construction ... Passed 0.02 sec 6/6 Test #4505: guest_libc_internal_stream_runtime ....... Passed 0.17 sec 100% tests passed, 0 tests failed out of 6 ``` - **Negative control**: with `core/libs/prx/libSceLibcInternal/BasicString.cpp`, `core/libs/prx/libSceLibcInternal/Err.cpp`, `core/libs/prx/libSceLibcInternal/Export.cpp`, `core/libs/prx/libSceLibcInternal/InventoryExports.cpp`, `core/libs/prx/libSceLibcInternal/InventoryExports2.cpp`, `core/libs/prx/libSceLibcInternal/InventoryExports6.cpp`, `core/libs/prx/libSceLibcInternal/NumGet.cpp`, `core/libs/prx/libSceLibcInternal/include/Api.hpp`, `core/libs/prx/libSceLibcInternal/include/InventoryExports.hpp`, `core/libs/prx/libSceLibcInternal/include/InventoryExports6.hpp`, `core/libs/prx/libc/include/Api.hpp`, `core/libs/prx/libc/include/GuestLocale.hpp`, `core/libs/prx/libc/src/LocaleSupport.cpp`, `core/libs/prx/libc/src/exception/StandardExceptions.cpp`, `core/libs/prx/libSceLibcInternal/FacetConstruction.cpp`, `core/libs/prx/libSceLibcInternal/LocaleName.cpp`, `core/libs/prx/libSceLibcInternal/Punctuation.cpp`, `core/libs/prx/libSceLibcInternal/StreamRuntime.cpp` reverted to `main`, the new tests do not build/link without the change; restoring it makes them build and pass. - **Code reading**: - Checked BasicString.cpp: _ZNSs5_CopyEmm_nid_postfix for bounds, allocation exceptions, inline buffer handling, and deallocation logic. - Checked FacetConstruction.cpp: verified _ZSt8_LocinfoC1ERKSs_nid_postfix handles short string inline buffer (<= 15 bytes) and pointer buffer correctly. - Checked FacetConstruction.cpp: verified _ZNKSt5ctypeIwE10do_scan_isEsPKwS2__nid_postfix range validation, chunking, and GuestCopyIn error handling. - Checked FacetConstruction.cpp: verified _ZNSt6locale7_LocimpD1Ev_nid_postfix syslock locking, facet release, and classic facet preservation. - Checked FacetConstruction.cpp: verified PutElement / PutElements / RepeatElement streambuf buffer boundaries and overflow fallback. - Checked CMakeLists.txt and debt fragments for AGENTS.md compliance, convention checks, and unhandled stubs. Looks Good To Me
MarcZX10 commented 2026-11-22 10:05:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T10:05:51Z.

Review: COMMENTED


Reviewed — comments

This review covers the prepared diff at head 99aa237f5aad41a3a396dd00085198dea5210b8e; the changed lines and targeted behavior reviewed do not establish a blocking defect, but the full change was not read.

What I ran

No build or tests were run. The author reports Windows 11 MinGW-w64 results, which were not independently verified.

Results

Check Result Note
Prepared diff inspection passed Targeted code reviewed
Build and tests not run Author reports 98 tests passed

Findings

Blocking

None verified in the inspected excerpts.

Non-blocking

  • The description reports broad implementation and test coverage; this review inspected only selected hunks, so those claims remain unconfirmed.

Not verified

The complete changed-line set was not read. In particular, the implementation and tests in FacetConstruction.cpp, NumGet.cpp, Punctuation.cpp, StreamRuntime.cpp, and the other changed files were not fully reviewed. files.json was not available as a review-folder document; the changed-file inventory was obtained from the review folder listing. No tests or builds were run, and console/title behavior was not verified.

To get this to a good state

Nothing is required. Optional: complete a full review of all changed lines and independently run the reported checks.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6011620754 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25573#pullrequestreview-6011620754). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-22T10:05:51Z. **Review:** COMMENTED --- # Reviewed — comments This review covers the prepared diff at head `99aa237f5aad41a3a396dd00085198dea5210b8e`; the changed lines and targeted behavior reviewed do not establish a blocking defect, but the full change was not read. ## What I ran No build or tests were run. The author reports Windows 11 MinGW-w64 results, which were not independently verified. ## Results | Check | Result | Note | |---|---|---| | Prepared diff inspection | passed | Targeted code reviewed | | Build and tests | not run | Author reports 98 tests passed | ## Findings ### Blocking None verified in the inspected excerpts. ### Non-blocking - The description reports broad implementation and test coverage; this review inspected only selected hunks, so those claims remain unconfirmed. ## Not verified The complete changed-line set was not read. In particular, the implementation and tests in `FacetConstruction.cpp`, `NumGet.cpp`, `Punctuation.cpp`, `StreamRuntime.cpp`, and the other changed files were not fully reviewed. `files.json` was not available as a review-folder document; the changed-file inventory was obtained from the review folder listing. No tests or builds were run, and console/title behavior was not verified. ## To get this to a good state Nothing is required. Optional: complete a full review of all changed lines and independently run the reported checks.
PrivacyOnion commented 2026-11-22 12:21:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-22T12:21:18Z.

Review: APPROVED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 21a25f8972:

  • Conventions: tools/check_conventions.py passed.
  • Build: guest_libc_internal_basic_string_tests, guest_libc_internal_facet_construction_tests, guest_libc_internal_locale_name_tests, guest_libc_internal_punctuation_tests, guest_libc_internal_stream_runtime_tests, guest_libc_internal_time_get_fields_tests built cleanly.
  • CTest (guest_libc_internal_locale_name, guest_libc_internal_punctuation, guest_libc_internal_stream_runtime, guest_libc_internal_basic_string, guest_libc_internal_time_get_fields, guest_libc_internal_facet_construction):
    1/6 Test #4506: guest_libc_internal_stream_runtime .......   Passed    0.01 sec
    2/6 Test #4504: guest_libc_internal_locale_name ..........   Passed    0.01 sec
    3/6 Test #4603: guest_libc_internal_time_get_fields ......   Passed    0.01 sec
    4/6 Test #4554: guest_libc_internal_basic_string .........   Passed    0.01 sec
    5/6 Test #4613: guest_libc_internal_facet_construction ...   Passed    0.01 sec
    6/6 Test #4505: guest_libc_internal_punctuation ..........   Passed    0.01 sec
    100% tests passed, 0 tests failed out of 6
    
  • Negative control: with core/libs/prx/libSceLibcInternal/BasicString.cpp, core/libs/prx/libSceLibcInternal/Err.cpp, core/libs/prx/libSceLibcInternal/Export.cpp, core/libs/prx/libSceLibcInternal/InventoryExports.cpp, core/libs/prx/libSceLibcInternal/InventoryExports2.cpp, core/libs/prx/libSceLibcInternal/InventoryExports6.cpp, core/libs/prx/libSceLibcInternal/NumGet.cpp, core/libs/prx/libSceLibcInternal/include/Api.hpp, core/libs/prx/libSceLibcInternal/include/InventoryExports.hpp, core/libs/prx/libSceLibcInternal/include/InventoryExports6.hpp, core/libs/prx/libc/include/GuestLocale.hpp, core/libs/prx/libc/src/LocaleSupport.cpp, core/libs/prx/libSceLibcInternal/FacetConstruction.cpp, core/libs/prx/libSceLibcInternal/LocaleName.cpp, core/libs/prx/libSceLibcInternal/Punctuation.cpp, core/libs/prx/libSceLibcInternal/StreamRuntime.cpp reverted to main, the new tests do not build/link without the change; restoring it makes them build and pass.
  • Code reading:
    • Verified BasicString.cpp: CapacityFor and _ZNSs5_CopyEmm_nid_postfix for correct bounds checking, allocation exception safety, inline buffer handling, and tidy logic
    • Verified FacetConstruction.cpp: checked SyslockGuard in _ZNSt6locale7_LocimpD1Ev_nid_postfix to confirm exception safety when facet destructors throw and release facets
    • Verified FacetConstruction.cpp: PutElement, PutElements, and RepeatElement stream output bounds checking and underflow/overflow handling
    • Verified FacetConstruction.cpp: checked _ZNSt8_LocinfoC1ERKSs_nid_postfix, _ZSt15_sceLibcLocinfoPKc_nid_postfix, and _ZNSt8_Locinfo8_AddcatsEiPKc_nid_postfix for buffer handling and state setup
    • Verified NumGet.cpp, Punctuation.cpp, and StreamRuntime.cpp implementations against AGENTS.md conventions, error codes, and stub standards

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6012175362 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25573#pullrequestreview-6012175362). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-22T12:21:18Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `21a25f8972`: - **Conventions**: `tools/check_conventions.py` passed. - **Build**: `guest_libc_internal_basic_string_tests`, `guest_libc_internal_facet_construction_tests`, `guest_libc_internal_locale_name_tests`, `guest_libc_internal_punctuation_tests`, `guest_libc_internal_stream_runtime_tests`, `guest_libc_internal_time_get_fields_tests` built cleanly. - **CTest** (`guest_libc_internal_locale_name`, `guest_libc_internal_punctuation`, `guest_libc_internal_stream_runtime`, `guest_libc_internal_basic_string`, `guest_libc_internal_time_get_fields`, `guest_libc_internal_facet_construction`): ``` 1/6 Test #4506: guest_libc_internal_stream_runtime ....... Passed 0.01 sec 2/6 Test #4504: guest_libc_internal_locale_name .......... Passed 0.01 sec 3/6 Test #4603: guest_libc_internal_time_get_fields ...... Passed 0.01 sec 4/6 Test #4554: guest_libc_internal_basic_string ......... Passed 0.01 sec 5/6 Test #4613: guest_libc_internal_facet_construction ... Passed 0.01 sec 6/6 Test #4505: guest_libc_internal_punctuation .......... Passed 0.01 sec 100% tests passed, 0 tests failed out of 6 ``` - **Negative control**: with `core/libs/prx/libSceLibcInternal/BasicString.cpp`, `core/libs/prx/libSceLibcInternal/Err.cpp`, `core/libs/prx/libSceLibcInternal/Export.cpp`, `core/libs/prx/libSceLibcInternal/InventoryExports.cpp`, `core/libs/prx/libSceLibcInternal/InventoryExports2.cpp`, `core/libs/prx/libSceLibcInternal/InventoryExports6.cpp`, `core/libs/prx/libSceLibcInternal/NumGet.cpp`, `core/libs/prx/libSceLibcInternal/include/Api.hpp`, `core/libs/prx/libSceLibcInternal/include/InventoryExports.hpp`, `core/libs/prx/libSceLibcInternal/include/InventoryExports6.hpp`, `core/libs/prx/libc/include/GuestLocale.hpp`, `core/libs/prx/libc/src/LocaleSupport.cpp`, `core/libs/prx/libSceLibcInternal/FacetConstruction.cpp`, `core/libs/prx/libSceLibcInternal/LocaleName.cpp`, `core/libs/prx/libSceLibcInternal/Punctuation.cpp`, `core/libs/prx/libSceLibcInternal/StreamRuntime.cpp` reverted to `main`, the new tests do not build/link without the change; restoring it makes them build and pass. - **Code reading**: - Verified BasicString.cpp: CapacityFor and _ZNSs5_CopyEmm_nid_postfix for correct bounds checking, allocation exception safety, inline buffer handling, and tidy logic - Verified FacetConstruction.cpp: checked SyslockGuard in _ZNSt6locale7_LocimpD1Ev_nid_postfix to confirm exception safety when facet destructors throw and release facets - Verified FacetConstruction.cpp: PutElement, PutElements, and RepeatElement stream output bounds checking and underflow/overflow handling - Verified FacetConstruction.cpp: checked _ZNSt8_LocinfoC1ERKSs_nid_postfix, _ZSt15_sceLibcLocinfoPKc_nid_postfix, and _ZNSt8_Locinfo8_AddcatsEiPKc_nid_postfix for buffer handling and state setup - Verified NumGet.cpp, Punctuation.cpp, and StreamRuntime.cpp implementations against AGENTS.md conventions, error codes, and stub standards Looks Good To Me
MarcZX10 commented 2026-11-22 12:30:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T12:30:18Z.

Review: DISMISSED


Reviewed — changes requested

Changes are required before merge: repair the category 6 messages facet construction so its allocated object has the correct size and initialized vtable.

What I ran

  • Reviewed head 21a25f8972e43aeaa62e9860a100a5c464220637; no build or test commands were run.
  • The description reports Windows 11 MinGW-w64 ctest -R guest_libc_internal passing 90/90; this was not independently run.
  • Read the prepared description, commits, manifest, and diff; inspected changed implementation and test code through repo_read.py.

Results

Check Result Note
Source review failed Messages facet allocation is undersized
Tests not run Author-reported results only
Console behavior not run No physical-console check

Findings

Blocking

  • core/libs/prx/libSceLibcInternal/FacetConstruction.cpp:521: MessagesGetcat allocates only FacetObjectSize (0x10) bytes, then the messages constructors initialize a larger facet and *facet exposes that allocation as a messages facet. The facet’s derived storage is consequently out of bounds; for the wide messages facet, the constructor initializes a TimeInfo payload far larger than 0x10 bytes. Allocate the appropriate concrete facet size for each instantiation before constructing it.

Non-blocking

None.

Not verified

  • Did not run tests, build, convention/debt checks, or console behavior. Windows test claims come from the PR description.
  • The diff excludes lockfiles, minified files, dist/, build/, and SVG files; files.json was not available through the review reader. No claim is made about excluded content.

To get this to a good state

  • Allocate correctly sized storage for each messages facet before constructing it, then rerun the reported guest libc internal tests.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:6012233694 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25573#pullrequestreview-6012233694). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-22T12:30:18Z. **Review:** DISMISSED --- # Reviewed — changes requested Changes are required before merge: repair the category 6 messages facet construction so its allocated object has the correct size and initialized vtable. ## What I ran - Reviewed head `21a25f8972e43aeaa62e9860a100a5c464220637`; no build or test commands were run. - The description reports Windows 11 MinGW-w64 `ctest -R guest_libc_internal` passing 90/90; this was not independently run. - Read the prepared description, commits, manifest, and diff; inspected changed implementation and test code through `repo_read.py`. ## Results | Check | Result | Note | |---|---|---| | Source review | failed | Messages facet allocation is undersized | | Tests | not run | Author-reported results only | | Console behavior | not run | No physical-console check | ## Findings ### Blocking - `core/libs/prx/libSceLibcInternal/FacetConstruction.cpp:521`: `MessagesGetcat` allocates only `FacetObjectSize` (0x10) bytes, then the messages constructors initialize a larger facet and `*facet` exposes that allocation as a messages facet. The facet’s derived storage is consequently out of bounds; for the wide messages facet, the constructor initializes a `TimeInfo` payload far larger than 0x10 bytes. Allocate the appropriate concrete facet size for each instantiation before constructing it. ### Non-blocking None. ## Not verified - Did not run tests, build, convention/debt checks, or console behavior. Windows test claims come from the PR description. - The diff excludes lockfiles, minified files, `dist/`, `build/`, and SVG files; `files.json` was not available through the review reader. No claim is made about excluded content. ## To get this to a good state - Allocate correctly sized storage for each messages facet before constructing it, then rerun the reported guest libc internal tests.
MarcZX10 commented 2026-11-22 15:27:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T15:27:15Z.

Review: COMMENTED


Reviewed — no blocking findings

The inspected source does not show a verified blocking defect, but this review is incomplete and does not justify approval.

What I ran

Inspected the prepared PR bundle and selected source and test files at head 3760fdbd0ef91427644e97a2a8113d25e62bcfb7 using the pinned repo_read.py reader. No tests or builds were run.

Results

Check Result Note
Bundle and selected source review passed No verified blocking defect in inspected portions
Tests and build not run Author reports Windows 11 MinGW-w64 GCC tests passed
Full changed-file review not run Several changed files and source ranges were not read

Findings

Blocking

None verified in the inspected portions.

Non-blocking

None.

Not verified

Read: description.md, commits.md, manifest.json, diff.patch; source portions of BasicString.cpp, FacetConstruction.cpp, LocaleName.cpp, NumGet.cpp, Punctuation.cpp, and StreamRuntime.cpp; portions of GuestLibcInternalFacetConstruction.cpp and GuestLibcInternalStreamRuntime.cpp; and the changed-file listing.

Not read in full: the changed files above, the remaining changed source and test files, and files.json. The manifest lists 28 changed repository files, and the listing marks all 28 as included. Consequently, this review does not verify every changed file or every changed hunk. Tests reported in the PR description were not run by this review.

To get this to a good state

Nothing is required. Optional: complete review of the unread changed files and run the documented tests before relying on this review for a merge decision.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6013014705 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25573#pullrequestreview-6013014705). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-22T15:27:15Z. **Review:** COMMENTED --- # Reviewed — no blocking findings The inspected source does not show a verified blocking defect, but this review is incomplete and does not justify approval. ## What I ran Inspected the prepared PR bundle and selected source and test files at head `3760fdbd0ef91427644e97a2a8113d25e62bcfb7` using the pinned `repo_read.py` reader. No tests or builds were run. ## Results | Check | Result | Note | |---|---|---| | Bundle and selected source review | passed | No verified blocking defect in inspected portions | | Tests and build | not run | Author reports Windows 11 MinGW-w64 GCC tests passed | | Full changed-file review | not run | Several changed files and source ranges were not read | ## Findings ### Blocking None verified in the inspected portions. ### Non-blocking None. ## Not verified Read: `description.md`, `commits.md`, `manifest.json`, `diff.patch`; source portions of `BasicString.cpp`, `FacetConstruction.cpp`, `LocaleName.cpp`, `NumGet.cpp`, `Punctuation.cpp`, and `StreamRuntime.cpp`; portions of `GuestLibcInternalFacetConstruction.cpp` and `GuestLibcInternalStreamRuntime.cpp`; and the changed-file listing. Not read in full: the changed files above, the remaining changed source and test files, and `files.json`. The manifest lists 28 changed repository files, and the listing marks all 28 as included. Consequently, this review does not verify every changed file or every changed hunk. Tests reported in the PR description were not run by this review. ## To get this to a good state Nothing is required. Optional: complete review of the unread changed files and run the documented tests before relying on this review for a merge decision.
throny commented 2026-11-22 16:24:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by throny on 2026-11-22T16:24:36Z.

Review: COMMENTED


Review: ✅ matches the firmware where checked; the new ~_Locimp releases facets that main's _Addfac never retained

Basis: code read, and the exports compared with the disassembly of a retail libc.prx built from the same Dinkumware source (found by NID)

Checked

  • Matching the firmware at the offsets given:
    • _Locinfo C2/C1/_Addcats (0x87db0, 0x8a2e0, 0x87ed0): 0xb8-byte object, name at 0xa8, classic name at 0xb0.
    • _sceLibcLocinfo (0x87f20): accepts only "" and "C".
    • _Locimp C1Eb, locale::empty, ~locale and ~_Locimp (0x8a160, 0x88200, 0x84790, 0x8a1a0).
    • money_get<char>::_Getcat (0x8d200).
    • time_get<char>(size_t) (0x99600).
    • collate<wchar_t> _Init and C2 (0x9cce0, 0x9cc20).
    • numpunct<wchar_t> _Init and D2 (0xa2880, 0xa2ba0).
    • ctype<wchar_t> D1 (0x8a990).
    • _Cvt_check (0xc8120): really an empty ret, so not a made-up success.
    • Wide num_get::do_get(void*) (0xa6b20).
    • money_put<char>::_Put (0x91100).
    • Wide basic_filebuf::pbackfail (0xb5f10).
    • _System_error_category::default_error_condition (0x163d0).
    • _Debug_message (0x81f30).
  • Unknown cases throw, and the fragment records the divergences.

Findings

  1. FacetConstruction.cpp:583-586: ~_Locimp releases every facet and deletes the ones whose count reaches zero. That matches the firmware, but only because the firmware's _Locimp::_Addfac (0x877a0) retains the new facet and releases the one it replaces. Main's _Addfac (libc/src/LocaleSupport.cpp:2457) just stores the pointer. Now that locale::empty() builds a real _Locimp with the PR's vtable, the sequence empty() → _Addfac → destroy either wraps the count of a facet created with refs 0 (a leak) or deletes a caller-owned facet created with refs 1 (a double free later). Make _Addfac retain and release as the firmware does, or record the gap.
  2. Dead code left over from functions that moved to #25111 and #23809: ScanChunk (:29), DeleteObject (:265, an unused function in an anonymous namespace), IteratorHasInput/IteratorsEqual (:286-307).
  3. GuestLibcInternalTimeGetFields.cpp drops the checks that wide time_put::_Init (ZolDcuDSD0Q) still throws. That export is unchanged and still NotImplemented, so keep those checks; only the Inventory_197/198 removals are needed.
  4. time_put<wchar_t>(const _Locinfo&) (:524-529) copies *_Getptimes() instead of the times in info, which is what 0xae970 copies. The result is the same while only "C" is accepted; add it to the fragment.

Suggested action: fix 1 (or record it), then merge

AI-assisted review (Claude Code) · head 3760fdbd0e · base main 23b8772462

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6013252316 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25573#pullrequestreview-6013252316). Originally posted by [throny](https://github.com/throny) on 2026-11-22T16:24:36Z. **Review:** COMMENTED --- ### Review: ✅ matches the firmware where checked; the new `~_Locimp` releases facets that main's `_Addfac` never retained **Basis:** code read, and the exports compared with the disassembly of a retail `libc.prx` built from the same Dinkumware source (found by NID) **Checked** - Matching the firmware at the offsets given: - `_Locinfo` C2/C1/`_Addcats` (0x87db0, 0x8a2e0, 0x87ed0): 0xb8-byte object, name at 0xa8, classic name at 0xb0. - `_sceLibcLocinfo` (0x87f20): accepts only "" and "C". - `_Locimp` C1Eb, `locale::empty`, `~locale` and `~_Locimp` (0x8a160, 0x88200, 0x84790, 0x8a1a0). - `money_get<char>::_Getcat` (0x8d200). - `time_get<char>(size_t)` (0x99600). - `collate<wchar_t>` `_Init` and C2 (0x9cce0, 0x9cc20). - `numpunct<wchar_t>` `_Init` and D2 (0xa2880, 0xa2ba0). - `ctype<wchar_t>` D1 (0x8a990). - `_Cvt_check` (0xc8120): really an empty `ret`, so not a made-up success. - Wide `num_get::do_get(void*)` (0xa6b20). - `money_put<char>::_Put` (0x91100). - Wide `basic_filebuf::pbackfail` (0xb5f10). - `_System_error_category::default_error_condition` (0x163d0). - `_Debug_message` (0x81f30). - Unknown cases throw, and the fragment records the divergences. **Findings** 1. `FacetConstruction.cpp:583-586`: `~_Locimp` releases every facet and deletes the ones whose count reaches zero. That matches the firmware, but only because the firmware's `_Locimp::_Addfac` (0x877a0) retains the new facet and releases the one it replaces. Main's `_Addfac` (`libc/src/LocaleSupport.cpp:2457`) just stores the pointer. Now that `locale::empty()` builds a real `_Locimp` with the PR's vtable, the sequence `empty()` → `_Addfac` → destroy either wraps the count of a facet created with refs 0 (a leak) or deletes a caller-owned facet created with refs 1 (a double free later). Make `_Addfac` retain and release as the firmware does, or record the gap. 2. Dead code left over from functions that moved to #25111 and #23809: `ScanChunk` (`:29`), `DeleteObject` (`:265`, an unused function in an anonymous namespace), `IteratorHasInput`/`IteratorsEqual` (`:286-307`). 3. `GuestLibcInternalTimeGetFields.cpp` drops the checks that wide `time_put::_Init` (`ZolDcuDSD0Q`) still throws. That export is unchanged and still `NotImplemented`, so keep those checks; only the `Inventory_197/198` removals are needed. 4. `time_put<wchar_t>(const _Locinfo&)` (`:524-529`) copies `*_Getptimes()` instead of the times in `info`, which is what 0xae970 copies. The result is the same while only "C" is accepted; add it to the fragment. **Suggested action:** fix 1 (or record it), then merge <sub>AI-assisted review (Claude Code) · head `3760fdbd0e` · base `main` `23b8772462`</sub>
MarcZX10 commented 2026-11-22 18:15:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T18:15:54Z.

Review: COMMENTED


Reviewed — comments

The prepared change describes a broad libc runtime addition; this review covered selected implementation paths but did not verify the full change or run its checks.

What I ran

No commands were run. I read the prepared description, commit summary, manifest, and selected ranges of the diff and pinned source.

Results

Check Result Note
Source review not run Partial review only
Tests not run Author reports 90/90 passing
Build and conventions not run Not independently confirmed

Findings

Blocking

None verified in the portions inspected.

Non-blocking

  • This is a broad change spanning locale facets, numeric parsing, string storage, and stream runtime. The inspected portions did not establish correctness across all changed implementations and tests, so the review is incomplete.

Not verified

Read: review/description.md, review/commits.md, review/manifest.json, selected portions of review/diff.patch, core/libs/prx/libSceLibcInternal/NumGet.cpp, Punctuation.cpp, StreamRuntime.cpp, FacetConstruction.cpp, BasicString.cpp, LocaleName.cpp, core/libs/prx/libc/src/LocaleSupport.cpp, and selected test code in GuestLibcInternalFacetConstruction.cpp and GuestLibcInternalStreamRuntime.cpp.

Not read in full: the remaining changed files listed in the manifest, including the complete test suite, headers, export and inventory changes, CMake changes, and debt fragment. No tests, build, or convention checks were run. The PR description's test and check results are author-reported.

To get this to a good state

Nothing is required. Optional: complete the review of the remaining changed files and run the reported checks against this head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6013698282 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25573#pullrequestreview-6013698282). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-22T18:15:54Z. **Review:** COMMENTED --- # Reviewed — comments The prepared change describes a broad libc runtime addition; this review covered selected implementation paths but did not verify the full change or run its checks. ## What I ran No commands were run. I read the prepared description, commit summary, manifest, and selected ranges of the diff and pinned source. ## Results | Check | Result | Note | |---|---|---| | Source review | not run | Partial review only | | Tests | not run | Author reports 90/90 passing | | Build and conventions | not run | Not independently confirmed | ## Findings ### Blocking None verified in the portions inspected. ### Non-blocking - This is a broad change spanning locale facets, numeric parsing, string storage, and stream runtime. The inspected portions did not establish correctness across all changed implementations and tests, so the review is incomplete. ## Not verified Read: `review/description.md`, `review/commits.md`, `review/manifest.json`, selected portions of `review/diff.patch`, `core/libs/prx/libSceLibcInternal/NumGet.cpp`, `Punctuation.cpp`, `StreamRuntime.cpp`, `FacetConstruction.cpp`, `BasicString.cpp`, `LocaleName.cpp`, `core/libs/prx/libc/src/LocaleSupport.cpp`, and selected test code in `GuestLibcInternalFacetConstruction.cpp` and `GuestLibcInternalStreamRuntime.cpp`. Not read in full: the remaining changed files listed in the manifest, including the complete test suite, headers, export and inventory changes, CMake changes, and debt fragment. No tests, build, or convention checks were run. The PR description's test and check results are author-reported. ## To get this to a good state Nothing is required. Optional: complete the review of the remaining changed files and run the reported checks against this head.
throny commented 2026-11-22 18:18:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by throny on 2026-11-22T18:18:15Z.

Review: APPROVED


Review: ✅ re-review: our four points are fixed or recorded

Basis: code read, 3760fdbd0e..3cf6c545de · head 3cf6c545de

Checked

  • The dead helpers (ScanChunk, DeleteObject, IteratorHasInput, IteratorsEqual) are removed.
  • GuestLibcInternalTimeGetFields.cpp:410 checks again that wide time_put::_Init throws. It is still NotImplemented at TimeGetFields.cpp:939-941.
  • The fragment now records that _Addfac here neither retains nor releases, so a facet added to a locale::empty implementation is released without being retained. It also records that the time_put<wchar_t>(const _Locinfo&) constructors copy the C time names, which equal the _Locinfo's while it accepts only "C".
  • numpunct<wchar_t> matches Dinkumware _Init:
    • default: ., ,, empty grouping, true/false
    • non-default: C lconv (., separator 0)
    • non-"C" names still throw
    • The fragment records that SeparatorsOf ignores the _Locinfo contents.

Findings

  1. Nit: the new check at :410 passes info after _ZNSt8_LocinfoD1Ev(&info) at :398. It is harmless because the stub ignores its arguments, but it is cleaner before the destructor.

Suggested action: merge

AI-assisted review (Claude Code) · head 3cf6c545de · base main 23b8772462

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6013707584 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25573#pullrequestreview-6013707584). Originally posted by [throny](https://github.com/throny) on 2026-11-22T18:18:15Z. **Review:** APPROVED --- ### Review: ✅ re-review: our four points are fixed or recorded **Basis:** code read, `3760fdbd0e`..`3cf6c545de` · head `3cf6c545de` **Checked** - The dead helpers (`ScanChunk`, `DeleteObject`, `IteratorHasInput`, `IteratorsEqual`) are removed. - `GuestLibcInternalTimeGetFields.cpp:410` checks again that wide `time_put::_Init` throws. It is still `NotImplemented` at `TimeGetFields.cpp:939-941`. - The fragment now records that `_Addfac` here neither retains nor releases, so a facet added to a `locale::empty` implementation is released without being retained. It also records that the `time_put<wchar_t>(const _Locinfo&)` constructors copy the C time names, which equal the `_Locinfo`'s while it accepts only "C". - `numpunct<wchar_t>` matches Dinkumware `_Init`: - default: `.`, `,`, empty grouping, `true`/`false` - non-default: C `lconv` (`.`, separator 0) - non-"C" names still throw - The fragment records that `SeparatorsOf` ignores the `_Locinfo` contents. **Findings** 1. Nit: the new check at `:410` passes `info` after `_ZNSt8_LocinfoD1Ev(&info)` at `:398`. It is harmless because the stub ignores its arguments, but it is cleaner before the destructor. **Suggested action:** merge <sub>AI-assisted review (Claude Code) · head `3cf6c545de` · base `main` `23b8772462`</sub>
ligmaSec commented 2026-12-03 14:51:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T14:51:28Z.

Review: COMMENTED


Built the exact punctuation, string, and locale units and ran GuestLibcInternalPunctuation against the existing Linux runtime. The focused fixture passed, including the wide numpunct vtable and punctuation accessors. Merging this head with current main conflicts in the export inventories, GuestLocale.hpp, and GuestLibcInternalTimeGetFields.cpp. The fixture covers the punctuation implementation before that reconciliation.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6172151257 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25573#pullrequestreview-6172151257). Originally posted by [ligmaSec](https://github.com/ligmaSec) on 2026-12-03T14:51:28Z. **Review:** COMMENTED --- Built the exact punctuation, string, and locale units and ran `GuestLibcInternalPunctuation` against the existing Linux runtime. The focused fixture passed, including the wide numpunct vtable and punctuation accessors. Merging this head with current `main` conflicts in the export inventories, `GuestLocale.hpp`, and `GuestLibcInternalTimeGetFields.cpp`. The fixture covers the punctuation implementation before that reconciliation. AI-assisted: yes.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/25573:upstream-pr/25573'
git switch 'upstream-pr/25573'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/25573'
git switch 'upstream-pr/25573'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/25573'
git switch 'upstream-pr/25573'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/25573'
git switch 'main'
git merge --squash 'upstream-pr/25573'
git switch 'main'
git merge --ff-only 'upstream-pr/25573'
git switch 'main'
git merge 'upstream-pr/25573'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!25573
No description provided.