1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-09 06:21:09 +03:00

Minimal fix for unterminated tar archive problem.

Commit 23a1c6578c improved
pg_basebackup's ability to parse tar archives, but also arranged
to parse them only when we need to make some modification to the
contents of the archive. That's a problem, because the server
doesn't actually terminate tar archives. When the new parsing
logic was engaged, pg_basebackup would properly terminate the
tar file, but when it was skipped, pg_basebackup would just write
whatever it got from the server, meaning that the terminator
was missing.

Most versions of tar are willing to overlook the missing terminator, but
the AIX buildfarm animals were not. Fix by inventing a new kind of
bbstreamer that just blindly adds a terminator, and using it whenever we
don't parse the tar archive.

Discussion: http://postgr.es/m/CA+TgmoZbNzsWwM4BE5Jb_qHncY817DYZwGf+2-7hkMQ27ZwsMQ@mail.gmail.com
This commit is contained in:
Robert Haas
2021-11-08 16:36:06 -05:00
parent b0cf5444f9
commit 57b5a9646d
3 changed files with 78 additions and 1 deletions

View File

@@ -1073,10 +1073,14 @@ CreateBackupStreamer(char *archive_name, char *spclocation,
/*
* If we're doing anything that involves understanding the contents of
* the archive, we'll need to parse it.
* the archive, we'll need to parse it. If not, we can skip parsing it,
* but the tar files the server sends are not properly terminated, so
* we'll need to add the terminator here.
*/
if (must_parse_archive)
streamer = bbstreamer_tar_parser_new(streamer);
else
streamer = bbstreamer_tar_terminator_new(streamer);
/* Return the results. */
*manifest_inject_streamer_p = manifest_inject_streamer;