Skip to content

feat(libcurl): implement curl_m[v]fprintf and curl_m[v]printf - #18468

Open
alvaroelpob wants to merge 11 commits into
boykopovar:mainfrom
alvaroelpob:feat/curl-mprintf-streams
Open

alvaroelpob wants to merge 11 commits into
boykopovar:mainfrom
alvaroelpob:feat/curl-mprintf-streams

Conversation

@alvaroelpob

@alvaroelpob alvaroelpob commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

What

Implements curl_mfprintf, curl_mvfprintf, curl_mprintf and curl_mvprintf, which threw through NotImplemented_nid_no_patch.

Stacked on #17390, whose CurlFormat formatter already follows both passes of curl 7.81.0 lib/mprintf.c. This adds a stream output to it: in 7.81.0 the four functions call dprintf_formatf with fputc and the caller's FILE* or stdout (mprintf.c), and OUTCHAR returns the count so far on the first fputc that returns -1. Here each character goes through the guest fputc on the guest stream, _Stdout for curl_mprintf and curl_mvprintf, and the formatter stops the same way. A format the formatter rejects returns -1 without output, as in #17390.

The Formatting debt entry of #17390 now names these functions too, and their stub entries are removed. Only the last six commits belong to this pull request; the first two are #17390's.

Tested

Linux (WSL2, Ubuntu): full build and suite on e956846, 4583/4583 tests pass; check_conventions passes. The new guest_curl_formatstreams writes through curl_mfprintf and curl_mvfprintf to a guest file (positional and sequential arguments, %#x, a NULL %p, the 129-conversion -1 and a stream opened for reading, where the first failed fputc stops the output at 0), and through curl_mprintf and curl_mvprintf to the guest stdout reopened on a file.

Checklist

Luis Meireles and others added 8 commits November 8, 2026 19:42
Port the two passes of curl 7.81.0 lib/mprintf.c with LP64 argument
sizes and without the Windows I32/I64 qualifiers, reading arguments
from the guest SysV va_list. Floating-point conversions go through
the guest snprintf.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Progress report (422923d → b10b6a8)

📈 System libraries: 41.75% (+0.02%, +10 implemented functions)

✅ 10 implemented
Library Name
libcurl curl_maprintf_nid_postfix
libcurl curl_mfprintf_nid_postfix
libcurl curl_mprintf_nid_postfix
libcurl curl_msnprintf_nid_postfix
libcurl curl_msprintf_nid_postfix
libcurl curl_mvaprintf_nid_postfix
libcurl curl_mvfprintf_nid_postfix
libcurl curl_mvprintf_nid_postfix
libcurl curl_mvsnprintf_nid_postfix
libcurl curl_mvsprintf_nid_postfix

Changed libraries (implemented exports)

Library Before After Change
libcurl 64/85 (75.29%) 74/85 (87.06%) +11.76%

@alvaroelpob
alvaroelpob marked this pull request as ready for review November 11, 2026 17:33
@JJenkx

JJenkx commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

Windows check of head e9568468a5, merged onto main f57c971559 (72ed23baff, clean merge).

Setup: Windows 11 Enterprise 22621, WinLibs GCC 15.2 UCRT, Release. The hosted Windows check does not run these tests on pull requests.

  • guest_curl, guest_curl_strings pass in 3 of 3 runs, none skipped.

AI-assisted: yes.

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 17, 2026
@oneandonlydean

Copy link
Copy Markdown
Collaborator

@alvaroelpob the formatting code is unchanged and still looks right to me. The merge of main brought back all 10 curl_m*printf exports under "Unimplemented exports" in docs/dev/debt/libcurl.md (lines 31 to 40), next to the new Formatting entry. Export.cpp has no NotImplemented stubs for them, so the doc now contradicts the code. Please remove those lines again, and add the FILE* non-guard clause to the Formatting entry that was requested earlier.

This branch also carries #17390's commits, so it will need a rebase once #17390 lands. It would be best to do the doc fix in the same round to avoid a second push.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Nov 17, 2026

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — no blocking findings

The change appears consistent with its stated goal at head b10b6a8d711f1e23d198a1444d67eea127736aee; I did not run checks, so a formal approval is not justified.

What I ran

No commands or tests were run. I read the prepared diff and all changed files through the pinned reader.

Results

Check Result Note
Diff and changed files passed All reviewed files were included
Build and tests not run The description reports author-run results

Findings

Blocking

None.

Non-blocking

None.

Not verified

Build, test suite, and convention checks were not run in this review. The author reports a full build and suite with 4583/4583 tests passing and check_conventions passing on e9568468a5, rather than the reviewed head. No files were excluded from review.

To get this to a good state

Nothing is required.

@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown

This pull request has conflicted with main and had no activity for 7 days. Rebase it on current main so it can be reviewed and merged. It will not be closed automatically.

@github-actions github-actions Bot added the stale Conflicting with main and no activity for 7 days label Dec 3, 2026

@ligmaSec ligmaSec left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please reconcile the debt changes before merging. The merged debt document still lists all four stream formatting exports as unimplemented and restores unrelated pending entries, including curl_mime_data_cb beside its implemented MIME entry. A debt fragment scoped to the four stream exports would keep those other entries out of this PR.

I ran guest_curl_format and guest_curl_formatstreams with this stack applied on Linux. Both passed.

AI-assisted: yes.

@github-actions

github-actions Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 24542 core/libs/prx/libcurl/Export.cpp

@THEMANnt THEMANnt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The formatter changes don’t guarantee that floating-point normalization terminates for every supported value. Please limit the normalization to finite values and handle special values through the normal formatting path. The current fixtures exercise ordinary values; a regression test should confirm that special values return promptly with the expected formatting.

This branch has not been deployed

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

Labels

build docs needs rebase Conflicts with main, rebase needed prx stale Conflicting with main and no activity for 7 days

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants