[RFC v4 1/2] Add [v]aprintf(3)

Alejandro Colomar alx@kernel.org
Fri Mar 20 20:07:02 GMT 2026


Hi Joseph,

On 2026-03-20T16:53:20+0000, Joseph Myers wrote:
> On Wed, 18 Mar 2026, Alejandro Colomar wrote:
> 
> > diff --git a/libio/bits/stdio2.h b/libio/bits/stdio2.h
> > index 193494db..b9fed67e 100644
> > --- a/libio/bits/stdio2.h
> > +++ b/libio/bits/stdio2.h
> > @@ -200,6 +200,18 @@ vdprintf (int __fd, const char *__restrict __fmt, __gnuc_va_list __ap)
[...]
> > +__fortify_function char *
> > +__NTH (__aprintf (const char *__restrict __fmt, ...))
> > +{
> > +  return __aprintf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ());
> > +}
> 
> Why is an internal name __aprintf being defined or declared in installed 
> headers at all?

I followed what's done with asprintf(3) at the moment.
I don't know why it's done with asprintf(3), TBH.

	$ sed -n 210,216p libio/bits/stdio2.h
	__fortify_function int
	__NTH (__asprintf (char **__restrict __ptr, const char *__restrict __fmt,
			   ...))
	{
	  return __asprintf_chk (__ptr, __USE_FORTIFY_LEVEL - 1, __fmt,
				 __va_arg_pack ());
	}

> > diff --git a/stdio-common/Versions b/stdio-common/Versions
> > index 8e1cbf85..aee611b2 100644
> > --- a/stdio-common/Versions
> > +++ b/stdio-common/Versions
> > @@ -70,6 +70,8 @@ libc {
> >      __isoc23_vfscanf;
> >      __isoc23_sscanf;
> >      __isoc23_vsscanf;
> > +  GLIBC_2.44 {
> > +    aprintf;
> >    }
> 
> I don't see how this (inserting unbalanced '{' rather than a proper 
> GLIBC_2.44 section separate from other versions) could work; if it does, 
> it must be because of insufficient syntax checking somewhere in version 
> map processing.

Huh; I did test, so indeed there seems to be insufficient syntax
checking (or maybe I don't know how to run these tests, but I suppose it
runs by default).  This was a mistake; I'll fix it.


Have a lovely night!
Alex

-- 
<https://www.alejandro-colomar.es>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20260320/2a23186b/attachment.sig>


More information about the Libc-alpha mailing list