| From: | Robert Haas <rhaas(at)postgresql(dot)org> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Undo inadvertent loosening of archive filename checking. |
| Date: | 2026-08-03 16:38:16 |
| Message-ID: | E1wqvg8-0000000021x-2fPD@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
Undo inadvertent loosening of archive filename checking.
Commit c8a350a439826267186c187dbfbf1f839f7521aa attempted to consolidate
code for identify possibly-compressed tar archives by suffix into a new
function parse_tar_compress_algorithm(). Unfortunately, the refactoring
wasn't perfect, and slightly changed the behavior at both existing call
sites.
In CreateBackupStreamer(), the previous code required the filename to
consist of more than just a suffix, so the aforementioned commit had the
effect of allowing pg_basebackup to accept a file from the server whose
entire name was something like .tar.gz -- which should never happen, but
let's reject it as previous releases did.
In precheck_tar_backup_file(), the previous code required the suffix to
be immediately adjacent to the prefix already checked, so the commit
in question allowed pg_verifybackup to accept not only filenames like
base.tar.gz but also filenames like baseFOOBARBAZ.tar.gz. While such
filenames are perhaps unlikely, rejecting them is correct, so let's go
back to that behavior.
Discussion: http://postgr.es/m/CA+TgmoYJY8FkoeYKGF_YF1S6uOK7fd0Bd3zrw0XY_oZXbmVFpQ@mail.gmail.com
Reported-by: Sarath Kumar <Sarath(at)iitmpravartak(dot)net>
Reviewed-by: Andrew Dunstan <andrew(at)dunslane(dot)net>
Backpatch-through: 19
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/dd62a71013c8c4d988624d0424503ec40520760e
Modified Files
--------------
src/bin/pg_basebackup/pg_basebackup.c | 4 ++--
src/bin/pg_verifybackup/pg_verifybackup.c | 8 ++++++--
src/bin/pg_waldump/pg_waldump.c | 5 +++--
src/common/compression.c | 28 +++++++++++++++++++++-------
src/include/common/compression.h | 2 +-
5 files changed, 33 insertions(+), 14 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Jeff Davis | 2026-08-03 18:38:54 | pgsql: Do not log subscription conninfo. |
| Previous Message | Álvaro Herrera | 2026-08-03 11:53:47 | pgsql: Remove unused arg and dead code in set_attnotnull() |