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: Mop up some no-longer-necessary hacks around printf %.*s format.
Date: Mon, 29 Jun 2020 21:12:45 +0000
Message-ID: <E1jq153-0002Yn-5f@gemulon.postgresql.org> (raw)

Mop up some no-longer-necessary hacks around printf %.*s format.

Commit 54cd4f045 added some kluges to work around an old glibc bug,
namely that %.*s could misbehave if glibc thought any characters in
the supplied string were incorrectly encoded.  Now that we use our
own snprintf.c implementation, we need not worry about that bug (even
if it still exists in the wild).  Revert a couple of particularly
ugly hacks, and remove or improve assorted comments.

Note that there can still be encoding-related hazards here: blindly
clipping at a fixed length risks producing wrongly-encoded output
if the clip splits a multibyte character.  However, code that's
doing correct multibyte-aware clipping doesn't really need a comment
about that, while code that isn't needs an explanation why not,
rather than a red-herring comment about an obsolete bug.

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

Branch
------
master

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

Modified Files
--------------
src/backend/commands/copy.c                |  6 +-----
src/backend/parser/scansup.c               | 14 ++------------
src/backend/tsearch/wparser_def.c          |  7 -------
src/backend/utils/adt/datetime.c           |  3 ++-
src/backend/utils/adt/ruleutils.c          | 10 ----------
src/fe_utils/print.c                       | 28 ++++++----------------------
src/interfaces/ecpg/ecpglib/error.c        |  1 -
src/interfaces/ecpg/pgtypeslib/dt_common.c |  3 ++-
src/interfaces/libpq/fe-misc.c             | 19 +++----------------
9 files changed, 16 insertions(+), 75 deletions(-)



Message-ID: <E1jq153-0002Yn-5f@gemulon.postgresql.org>
Permalink:  ../E1jq153-0002Yn-5f@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1jq153-0002Yn-5f@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: Mop up some no-longer-necessary hacks around printf %.*s format.
  In-Reply-To: <E1jq153-0002Yn-5f@gemulon.postgresql.org>
  References: <E1jq153-0002Yn-5f@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