feat(libc): implement the std::__sce_v2 time_put virtuals #17578
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/17578"
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 Danigamer05 on 2026-11-08T23:21:22Z.
What
Builds on #17568: this branch contains its commits, and through them #17539, #17331, #17296, #17277, #16975, #16949, #16944, #16924, #16919, #16560, #16516, #16214, #16178 and #15923, with current
main. It needs none of their code beyond the output helper of #16516 and their place inLocaleSupport.cpp, so it stacks to avoid conflicts. Until they merge, only the last commit is this PR's change.Implement
do_putofstd::__sce_v2::time_put<char>andtime_put<wchar_t>, which_Makelocbuilds andstd::put_timecalls. Before this PR, their two slots threwNotImplemented_nid_no_patch. These slots are not exports, so this PR adds no NID. With this PR, everycharandwchar_tfacet of_Makelochas its virtuals; theunsigned shortfacets still throw.The behavior comes from the
libc.prxbundled with PPSA03671 v01.001.005 (J03848509, SHA-256483961e086b8a1fffa8138b3c0badf798987fb5f35ec908d828946408be2d8a6), vtables0x18CCE0and0x18D310, read from the disassembly ofdo_put(0xE0F10,0xF11B0):!%followed by the modifier and the specifier, or by the specifier alone when the modifier is zero. In thewchar_tfacet each byte is sign-extended. The leading!keeps the result from being empty.strftime, orwcsftimeforwchar_t, into a buffer that grows by 16, 32, 64 and so on units until the call returns nonzero.errnois restored afterwards.wcsftimefills a buffer that is too small with what fits and returns that count, so awchar_tfield longer than 15 units,%cfor one, is written as nothing, as on the console.!go to the output iterator as they are, with nowidenand no fill. A missing or failing stream buffer fails the iterator.wcsftimereturns 0 witherrnoatEINVAL, thewchar_tfacet setsbadbiton the stream and writes nothing. If the stream's exception mask covers the new state, the module throwsios_base::failure; this library throwsNotImplementedthere, recorded in the new debt entry.The
_Makelocdebt entry no longer liststime_put.Tested
Windows 11, MinGW GCC 15.2, Release, head on top of #17568. Not run on Linux or macOS, not run in a title.
guest_sce_v2_time_put:%Y,%dwith a modifier,%%,%n,%Aand%c, which grows thecharbuffer;overflowand into a missing buffer, and the kepterrno;wchar_t%Y,%Band the empty%c._Makeloc.strftimeconversion and%%, and the modifier (none,E,Oor#). It also randomizes everytmfield in and out of range, the stream state,errno, and the output buffer: direct room,overflow, a rejectingoverflow, no buffer, and an already failed iterator.errno.strftimeandwcsftimeredirected to this library's: 900,000 calls over 3 seeds, 0 differences.%Zand%z, where this library prints the guest zone as thestrftimedebt entry describes.guest_fopen_errorsskipped.!. Neither catches the other two, and both are equivalent here. One drops theerrnorestore, which neither function changes on success. The other sizes the buffer 16 and 32 instead of 16 and 48, and no field in the C locale needs more than 31 units.check_conventions,git diff --check: clean. Merges cleanly withmain.pr_overlapreports no open PR with the same functions or conflicting code. It could not compare 48 PRs that conflict withmainon shared files. Of the 4 that touchLocaleSupport.cpp, #12518 and #12704 export the unversionedstd::time_putvtables as zeroed data, different symbols. #9526 and #11172 do not touchtime_put.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 MarcZX10 on 2026-11-16T22:47:04Z.
Review: COMMENTED
Reviewed — comments
The time_put implementation and changed-line coverage were inspected at head
c330516476; the author-reported Windows tests were not run here, so a formal decision is not justified.What I ran
Results
Findings
Blocking
None verified in the inspected time_put implementation.
Non-blocking
None.
Not verified
files.jsonis not present in the prepared review folder.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T11:47:25Z.
Review: APPROVED
Reviewed — looks good
The changed time_put implementation and its integration are consistent with the stated behavior; no blocking defect was verified.
What I ran
Reviewed head
15cecb5675d3cacd45bf9eb4e47e1c553b323d8eusing the prepared diff and pinned repository reader. No commands or tests were run in this review.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
The reported Windows build, test suite, differential harness and negative controls were not run independently. Linux, macOS and console behavior were not verified. Reviewed all changed files reported in
review/manifest.json; no files were excluded by rule.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T07:14:11Z.
Review: APPROVED
Reviewed — looks good
The change at
97e64242db2f52c6b972caa49ed23892d962f571implements thecharandwchar_ttime output facets; the inspected implementation and available evidence support merging.What I ran
No build or tests were run during this review. I read the prepared description, commits, manifest, and diff, then inspected the changed implementation and its output helper and time formatting dependencies at the pinned head. The author reports Windows 11 tests and differential harness runs; those results were not independently verified.
Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
I did not run the build, tests, harness, or negative control. The author reports those runs in the PR description, but they are not review-run evidence. I did not read every changed file in full; the remaining included files were not individually inspected. No files were excluded by
files.jsonrules (nofiles.jsonwas present in the review folder as exposed to this review).To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T13:12:26Z.
Review: COMMENTED
Built the branch’s locale implementation and matching headers against the existing Linux runtime. The focused
GuestSceV2TimePutfixture 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.