Skip to content

feat(libc): implement wcsftime - #4226

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
MarcZX10:codex/carry-wcsftime-3625
Oct 13, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
MarcZX10:codex/carry-wcsftime-3625

Conversation

@MarcZX10

@MarcZX10 MarcZX10 commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

What

Adds the missing wcsftime export for PS5MC (NID XbVXpf5WF28) using the guest's 16-bit wide strings and the existing C-locale conversion routines. The implementation follows FreeBSD 11.4 behavior for conversion errors, empty/truncated output, overflow, and null arguments, including restoring errno around Windows CRT strftime behavior. Adds regression coverage to guest_wide_formatting and records the source behavior in docs/dev/debt/libc.md. The original implementation commit author is preserved.

Tested

  • A prior Linux rebase handoff reported a full suite pass; that result was not run on this current-main head.
  • The current-main rebase has not been built or tested locally. CI should rerun against this head.

Checklist

  • Rebased onto current main; no matching open PR
  • One topic: the wcsftime export and its tests/documentation
  • Kept the existing strftime technical-debt entry
  • Removed the duplicate kern.arandom line while preserving the existing entry
  • Depends on: none
  • AI-assisted: yes

@MarcZX10

Copy link
Copy Markdown
Contributor Author

Carried #3625’s ready commit onto current main; the author is preserved. Local conventions and diff checks pass, but Linux CMake configure is blocked here by the missing SDL2 submodule contents and audio development headers, so the PR body records the original Windows test results and local limitation.

@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Progress report (9ba9ac1 → 78ffdf0)

➖ System libraries: 87.85% (+0.0%, +1 implemented functions)

✅ 1 implemented
Library Name
libc wcsftime_nid_postfix

@github-actions github-actions Bot added libc docs needs rebase Conflicts with main, rebase needed labels Oct 12, 2026
@blawesom

Copy link
Copy Markdown
Contributor

Rebase handoff — rebased onto current main, authorship unchanged (only a TechnicalDebt.md union conflict; both entries kept).

Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, BUILD_TESTING=ON, AMD RX 9070 XT / RADV):

  • builds; tools/check_conventions.py --base origin/main passes
  • full suite: 100% passed

To pick it up:

git fetch https://github.com/blawesom/AnyPS5 rebase/4226
git checkout <your branch>
git merge --ff-only FETCH_HEAD

@oneandonlydean

Copy link
Copy Markdown
Collaborator

Needs a rebase (docs/dev/debt/libc.md, docs/dev/debt/libkernel.md). While there: keep the strftime entry in docs/dev/debt/libc.md, and drop the second kern.arandom line the branch adds to docs/dev/debt/libkernel.md.

@MarcZX10

Copy link
Copy Markdown
Contributor Author

Thanks. The current PR head still conflicts with main. I will rebase it, keep the existing strftime debt entry, and remove the duplicate kern.arandom line before asking for review again.

PS5MC (PPSA99420) imports wcsftime (XbVXpf5WF28, aerolib) as the last
absent libSceLibcInternal import in its registry order (index 481), so
its predicted stop is:

    FAIL: unresolved ELF import XbVXpf5WF28 from libSceLibcInternal.prx

The stop is predicted from the import order, not observed in a run.

wcsftime follows FreeBSD 11.4 lib/libc/locale/wcsftime.c (8c639945):
the wide format is converted with wcsrtombs, strftime fills a buffer of
maxsize * MB_CUR_MAX bytes limited to maxsize, and mbsrtowcs converts
the result back. A format unit that the single-byte C locale of
lib/libc/locale/none.c cannot encode returns 0 with EILSEQ, a maxsize
whose product with MB_CUR_MAX overflows returns 0 with EINVAL, and an
empty or overflowing result or a null buffer returns 0 with errno
unchanged; the ERANGE or EINVAL set by the Windows CRT's strftime is
discarded. A null format or tm throws, as FreeBSD dereferences it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@MarcZX10
MarcZX10 force-pushed the codex/carry-wcsftime-3625 branch from 21a48a8 to 78ffdf0 Compare October 13, 2026 07:34
@MarcZX10

Copy link
Copy Markdown
Contributor Author

Rebased the PR onto current main. I kept the existing strftime debt entry, added the wcsftime entry beside it, and removed the duplicate kern.arandom line by preserving the current-main entry. I updated the description so the earlier full-suite report is not presented as a test of this rebased head; CI should rerun.

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 13, 2026
@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#4543 docs/dev/debt/libc.md L57
#4833 core/libs/tests/GuestWideFormatting.cpp L2

@oneandonlydean
oneandonlydean merged commit 2a2a3dc into boykopovar:main Oct 13, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants