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: Require a C99-compliant snprintf(), and remove related workaroun
Date: Thu, 16 Aug 2018 17:01:16 +0000
Message-ID: <E1fqLe8-0002Zs-Kd@gemulon.postgresql.org> (raw)

Require a C99-compliant snprintf(), and remove related workarounds.

Since our substitute snprintf now returns a C99-compliant result,
there's no need anymore to have complicated code to cope with pre-C99
behavior.  We can just make configure substitute snprintf.c if it finds
that the system snprintf() is pre-C99.  (Note: I do not believe that
there are any platforms where this test will trigger that weren't
already being rejected due to our other C99-ish feature requirements for
snprintf.  But let's add the check for paranoia's sake.)  Then, simplify
the call sites that had logic to cope with the pre-C99 definition.

I also dropped some stuff that was being paranoid about the possibility
of snprintf overrunning the given buffer.  The only reports we've ever
heard of that being a problem were for Solaris 7, which is long dead,
and we've sure not heard any reports of these assertions triggering in
a long time.  So let's drop that complexity too.

Likewise, drop some code that wasn't trusting snprintf to set errno
when it returns -1.  That would be not-per-spec, and again there's
no real reason to believe it is a live issue, especially not for
snprintfs that pass all of configure's feature checks.

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

Branch
------
master

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

Modified Files
--------------
config/c-library.m4                | 27 ++++++++++++++
configure                          | 46 +++++++++++++++++++++++-
configure.in                       | 11 +++++-
src/backend/utils/misc/guc.c       | 23 +++++-------
src/common/psprintf.c              | 73 ++++++++------------------------------
src/interfaces/libpq/pqexpbuffer.c | 68 +++++++++++------------------------
6 files changed, 125 insertions(+), 123 deletions(-)



Message-ID: <E1fqLe8-0002Zs-Kd@gemulon.postgresql.org>
Permalink:  ../E1fqLe8-0002Zs-Kd@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1fqLe8-0002Zs-Kd@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: Require a C99-compliant snprintf(), and remove related workaroun
  In-Reply-To: <E1fqLe8-0002Zs-Kd@gemulon.postgresql.org>
  References: <E1fqLe8-0002Zs-Kd@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