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 <pete...@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.


Reply via email to