Skip to content

fix(libc): translate asprintf encoding errors to guest errno - #2094

Closed
STUPIDCONTEM wants to merge 1 commit into
boykopovar:mainfrom
STUPIDCONTEM:fix/asprintf-error-number
Closed

STUPIDCONTEM wants to merge 1 commit into
boykopovar:mainfrom
STUPIDCONTEM:fix/asprintf-error-number

Conversation

@STUPIDCONTEM

@STUPIDCONTEM STUPIDCONTEM commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Evidence review (2026-10-09)

Closed by maintainer; not ready to reopen. Required evidence: Title ID and a log showing a title reaches the Linux asprintf encoding-error path and needs guest EILSEQ.

Game/title ID: none verified. No PS5 title execution is claimed.

What

Translate host EILSEQ to guest FreeBSD EILSEQ when asprintf_nid_postfix fails to format an invalid wide character. On Linux, host vasprintf returns errno 84, but the guest ABI uses 86. The change handles only this failed conversion; successful formatting and other errors retain their existing behavior.

The error is specified for the printf family by FreeBSD vfprintf(3), and stable/11 errno.h defines EILSEQ as 86. Open #1804 changes the separate vasprintf wrapper's wide-format routing in Formatting.cpp; it does not change asprintf_nid_postfix in AllocatingStrings.cpp.

Tested

  • Direct Linux baseline-versus-fixed verification passed in run 37902555693, head 0a51258. With the unchanged upstream implementation, the regression reports expected guest errno 86 but got 84. Restoring the candidate makes all three focused runs pass.
  • The regression uses an invalid surrogate in the C locale, checks negative return/null output/guest errno, then verifies successful formatted allocation, content, matching release and null-destination EINVAL. It explicitly registers the standalone test's default allocator.
  • Rebased onto main 6cc0503; the production file and test are identical to the Linux-verified version. Windows 10 Pro 19045 / WinLibs GCC 15.2 UCRT, Release: with the separate current-main build repair fix(build): declare SPIRV headers for Vulkan helper tests #2093, default/libs builds and full CTest passed 494/494 in 26.67 seconds (combined head 9bfd3067).

The changed host-formatting path and new regression are excluded on Windows. Windows runs validate existing behavior and build compatibility; they do not establish this Linux error correction. No title run was performed.

Checklist

@oneandonlydean

Copy link
Copy Markdown
Collaborator

Closing: this fixes one errno value on one Linux-only path, and no title is shown reaching it. If a title checks for EILSEQ from asprintf, please reopen with its ID and the log line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants