Re: Preventing abort() and exit() calls in libpq

Jacob Champion <pchampion@vmware.com>

From: Jacob Champion <pchampion@vmware.com>
To: "tgl@sss.pgh.pa.us" <tgl@sss.pgh.pa.us>
Cc: "daniel@yesql.se" <daniel@yesql.se>, "info@cspug.cz" <info@cspug.cz>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>, "alvherre@alvh.no-ip.org" <alvherre@alvh.no-ip.org>, "michael@paquier.xyz" <michael@paquier.xyz>
Date: 2021-07-02T22:38:10Z
Lists: pgsql-hackers
On Fri, 2021-07-02 at 18:20 -0400, Tom Lane wrote:
> What configure options are you using?

Just `./configure --enable-coverage`, nothing else. I distclean'd right
before for good measure.

> Does "nm -u" report "exit" being referenced from any *.o in libpq,
> or from any *_shlib.o in src/port/ or src/common/ ?

Only src/common:

    controldata_utils_shlib.o:
                 U close
                 U __errno_location
                 U exit
    ...
    fe_memutils_shlib.o:
                 U exit
    ...
    file_utils_shlib.o:
                 U close
                 U closedir
                 U __errno_location
                 U exit
    ...
    hex_shlib.o:
                 U exit
    ...
    psprintf_shlib.o:
                 U __errno_location
                 U exit
    ...
    stringinfo_shlib.o:
                 U __errno_location
                 U exit
    ...
    username_shlib.o:
                 U __errno_location
                 U exit
    ...

--Jacob

Commits

  1. Further restrict the scope of no-exit()-in-libpq test.

  2. Improve build-time check that libpq doesn't call exit().

  3. Fix portability fallout from commit dc227eb82.

  4. Add a build-time check that libpq doesn't call exit() or abort().