Re: Why the asprintf patch is still breaking the buildfarm

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Why the asprintf patch is still breaking the buildfarm
Дата
Msg-id 19697.1382454042@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Why the asprintf patch is still breaking the buildfarm  (Manlio Perillo <manlio.perillo@gmail.com>)
Ответы 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>)
Список 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 по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: logical changeset generation v6.4
Следующее
От: Andres Freund
Дата:
Сообщение: Re: logical changeset generation v6.2