Re: [PATCH] Make jsonapi usable from libpq

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: [PATCH] Make jsonapi usable from libpq
Дата
Msg-id bf828721-ef3e-2a8a-feeb-ade81a4b8f91@enterprisedb.com
обсуждение исходный текст
Ответ на Re: [PATCH] Make jsonapi usable from libpq  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: [PATCH] Make jsonapi usable from libpq  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On 26.06.21 19:43, Tom Lane wrote:
> I spent some time looking for other undesirable symbol dependencies
> in libpq, and soon found a couple.  PGTHREAD_ERROR potentially calls
> abort(), which seems even worse than exit-on-OOM, although I don't
> think we've ever heard a report of that being hit.  Also,
> fe-print.c's handling of OOM isn't nice at all:
> 
>                  fprintf(stderr, libpq_gettext("out of memory\n"));
>                  abort();
> 
> Although fe-print.c is semi-deprecated, it still seems like it'd
> be a good idea to clean that up.

These abort() calls were put there on purpose by:

commit c6ea8ccea6bf23501962ddc7ac9ffdb99c8643e1
Author: Peter Eisentraut <peter_e@gmx.net>
Date:   Mon Jan 30 20:34:00 2012

     Use abort() instead of exit() to abort library functions

     In some hopeless situations, certain library functions in libpq and
     libpgport quit the program.  Use abort() for that instead of exit(),
     so we don't interfere with the normal exit codes the program might
     use, we clearly signal the abnormal termination, and the caller has a
     chance of catching the termination.

     This was originally pointed out by Debian's Lintian program.


I don't object to refining this, but I think it is a mischaracterization 
to calls this kind of code wrong.  And I'm dubious about the backpatching.



В списке pgsql-hackers по дате отправления:

Предыдущее
От: John Naylor
Дата:
Сообщение: Re: speed up verifying UTF-8
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: Preventing abort() and exit() calls in libpq