pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Add a build-time check that libpq doesn't call exit() or abort()
Date: Tue, 29 Jun 2021 15:46:30 +0000
Message-ID: <E1lyFwU-00007U-Bd@gemulon.postgresql.org> (raw)

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

Directly exiting or aborting seems like poor form for a general-purpose
library.  Now that libpq liberally uses bits out of src/common/,
it's very easy to accidentally include code that would do something
unwanted like calling exit(1) after OOM --- see for example 8ec00dc5c.
Hence, add a simple cross-check that no such calls have made it into
libpq.so.

The cross-check depends on nm(1) being available and being able to
work on a shared library, which probably isn't true everywhere.
But we can just make the test silently do nothing if nm fails.
As long as the check is effective on common platforms, that should
be good enough.  (By the same logic, I've not worried about providing
an equivalent test in MSVC builds.)

Discussion: https://postgr.es/m/3128896.1624742969@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/dc227eb82ea8bf6919cd81a182a084589ddce7f3

Modified Files
--------------
src/interfaces/libpq/Makefile | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)



Message-ID: <E1lyFwU-00007U-Bd@gemulon.postgresql.org>
Permalink:  ../E1lyFwU-00007U-Bd@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1lyFwU-00007U-Bd@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Add a build-time check that libpq doesn't call exit() or abort()
  In-Reply-To: <E1lyFwU-00007U-Bd@gemulon.postgresql.org>
  References: <E1lyFwU-00007U-Bd@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox