Re: Why the asprintf patch is still breaking the buildfarm - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Why the asprintf patch is still breaking the buildfarm
Date
Msg-id 19697.1382454042@sss.pgh.pa.us
Whole thread Raw
In response to Re: Why the asprintf patch is still breaking the buildfarm  (Manlio Perillo <manlio.perillo@gmail.com>)
Responses Re: Why the asprintf patch is still breaking the buildfarm  (Noah Misch <noah@leadboat.com>)
Re: Why the asprintf patch is still breaking the buildfarm  (David Rowley <dgrowleyml@gmail.com>)
List pgsql-hackers
Manlio Perillo <manlio.perillo@gmail.com> writes:
> On 22/10/2013 09:58, Tom Lane wrote:
>> 1. src/port/asprintf.c exhibits a truly touching faith that vsnprintf will
>> report exactly the number of bytes that would have been required, even if
>> the buffer is not that large.  While this is what is specified in recent
>> versions of the POSIX standard, older platforms have much sketchier
>> behavior.

> Just to be pedantic, this is required by C99.

Yeah.  As a separate matter, it might be useful to revise stringinfo.c
and the asprintf code so that *if* the returned value is larger than the
given buffer size, we use it as a guide to resizing, avoiding the possible
need to loop multiple times to make the buffer large enough.  And we could
also improve our own implementation of snprintf to follow the C99 spec.

The point here is that we still need to cope with pre-C99 implementations
that might return -1 or the given buffer size on overflow.  The NetBSD
implementation doesn't do that, which is reasonable in their context, but
not workable for us.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: logical changeset generation v6.4
Next
From: Andres Freund
Date:
Subject: Re: logical changeset generation v6.2