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: Remove trailing newlines in pg_upgrade's message strings.
Date: Tue, 12 Jul 2022 19:17:54 +0000
Message-ID: <E1oBLOL-002Tej-9f@gemulon.postgresql.org> (raw)

Remove trailing newlines in pg_upgrade's message strings.

pg_upgrade does not use common/logging.c, which is unfortunate
but changing it to do so seems like more work than is justified.
However, we really need to make it work more like common/logging.c
in one respect: the latter expects supplied message strings to not
end with a newline, instead adding one internally.  As it stands,
pg_upgrade's logging facilities expect a caller-supplied newline
in some cases and not others, which is already an invitation to bugs,
but the inconsistency with our other frontend code makes it worse.
There are already several places with missing or extra newlines,
and it's inevitable that there won't be more if we let this stand.

Hence, run around and get rid of all trailing newlines in message
strings, and add an Assert that there's not one, similar to the
existing Assert in common/logging.c.  Adjust the logging functions
to supply a newline at the right places.

(Some of these strings also have a *leading* newline, which would
be a good thing to get rid of too; but this patch doesn't attempt
that.)

There are some consequent minor changes in output.  The ones that
aren't outright bug fixes are generally removal of extra blank
lines that the original coding intentionally inserted.  It didn't
seem worth being bug-compatible with that.

Patch by me, reviewed by Kyotaro Horiguchi and Peter Eisentraut

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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/7652353d87a6753627a6b6b36d7acd68475ea7c7

Modified Files
--------------
src/bin/pg_upgrade/check.c         | 118 ++++++++++++++--------------
src/bin/pg_upgrade/controldata.c   | 154 +++++++++++++++++++------------------
src/bin/pg_upgrade/exec.c          |  40 +++++-----
src/bin/pg_upgrade/file.c          |  44 +++++------
src/bin/pg_upgrade/function.c      |   6 +-
src/bin/pg_upgrade/info.c          |  17 ++--
src/bin/pg_upgrade/option.c        |  26 +++----
src/bin/pg_upgrade/parallel.c      |  14 ++--
src/bin/pg_upgrade/pg_upgrade.c    |  42 +++++-----
src/bin/pg_upgrade/pg_upgrade.h    |   3 +-
src/bin/pg_upgrade/relfilenumber.c |  12 +--
src/bin/pg_upgrade/server.c        |  18 ++---
src/bin/pg_upgrade/tablespace.c    |   8 +-
src/bin/pg_upgrade/util.c          |  82 ++++++++++++--------
src/bin/pg_upgrade/version.c       |  24 +++---
15 files changed, 317 insertions(+), 291 deletions(-)



Message-ID: <E1oBLOL-002Tej-9f@gemulon.postgresql.org>
Permalink:  ../E1oBLOL-002Tej-9f@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1oBLOL-002Tej-9f@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: Remove trailing newlines in pg_upgrade's message strings.
  In-Reply-To: <E1oBLOL-002Tej-9f@gemulon.postgresql.org>
  References: <E1oBLOL-002Tej-9f@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