pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Robert Haas <rhaas@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Repair various defects in dc212340058b4e7ecfc5a7a81ec50e7a207bf2
Date: Thu, 11 Jan 2024 18:11:36 +0000
Message-ID: <E1rNzWi-000wnM-Va@gemulon.postgresql.org> (raw)

Repair various defects in dc212340058b4e7ecfc5a7a81ec50e7a207bf288.

pg_combinebackup had various problems:

* strncpy was used in various places where strlcpy should be used
  instead, to avoid any possibility of the result not being
  \0-terminated.
* scan_for_existing_tablespaces() failed to close the directory,
  and an error when opening the directory was reported with the
  wrong pathname.
* write_reconstructed_file() contained some redundant and therefore
  dead code.
* flush_manifest() didn't check the result of pg_checksum_update()
  as we do in other places, and misused a local pathname variable
  that shouldn't exist at all.

In pg_basebackup, the wrong variable name was used in one place,
due to a copy and paste that was not properly adjusted.

In blkreftable.c, the loop incorrectly doubled chunkno instead of
max_chunks. Fix that. Also remove a nearby assertion per repeated
off-list complaints from Tom Lane.

Per Coverity and subsequent code inspection by me and by Tom Lane.

Discussion: http://postgr.es/m/CA+Tgmobvqqj-DW9F7uUzT-cQqs6wcVb-Xhs=w=hzJnXSE-kRGw@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/3d5c332a3d6002c5c95cb238e2164ae054c8e805

Modified Files
--------------
src/bin/pg_basebackup/pg_basebackup.c       |  2 +-
src/bin/pg_combinebackup/pg_combinebackup.c | 15 +++++++++------
src/bin/pg_combinebackup/reconstruct.c      |  5 ++---
src/bin/pg_combinebackup/write_manifest.c   | 10 +++++-----
src/common/blkreftable.c                    |  3 +--
5 files changed, 18 insertions(+), 17 deletions(-)



Message-ID: <E1rNzWi-000wnM-Va@gemulon.postgresql.org>
Permalink:  ../E1rNzWi-000wnM-Va@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1rNzWi-000wnM-Va@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 using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: rhaas@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Repair various defects in dc212340058b4e7ecfc5a7a81ec50e7a207bf2
  In-Reply-To: <E1rNzWi-000wnM-Va@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