Fix portability issue with gzip in TAP test of pg_receivewal
authorMichael Paquier
Thu, 15 Jul 2021 12:25:03 +0000 (21:25 +0900)
committerMichael Paquier
Thu, 15 Jul 2021 12:25:03 +0000 (21:25 +0900)
The OpenBSD implementation of gzip considers only files suffixed by "Z",
"gz", "z", "tgz" or "taz" as valid targets, discarding anything else and
making a command using --test exit with an error code of 512 if anything
invalid is found.  The test introduced in ffc9dda tested a WAL segment
suffixed as .gz.partial, enough to make the test fail.

Testing only a full segment is fine enough in terms of coverage, so
simplify the code by discarding the .gz.partial segment in this check.
This should be enough to make the test pass with OpenBSD environments.

Per report from curculio.

Discussion: https://postgr.es/m/[email protected]

src/bin/pg_basebackup/t/020_pg_receivewal.pl

index 305c501e2f22546c6094bc904900f8b2b8fc9e6a..17fd71a450037823fa0444df21aad855344c5bf0 100644 (file)
@@ -112,15 +112,14 @@ SKIP:
    # Update the list of partial wals with the current one.
    @partial_wals = @zlib_partial_wals;
 
-   # There is one complete and one partial file compressed with ZLIB.
-   # Check the integrity of both, if gzip is a command available.
+   # Check the integrity of the completed segment, if gzip is a command
+   # available.
    my $gzip = $ENV{GZIP_PROGRAM};
    skip "program gzip is not found in your system", 1
      if ( !defined $gzip
        || $gzip eq ''
        || system_log($gzip, '--version') != 0);
 
-   push(@zlib_wals, @zlib_partial_wals);
    my $gzip_is_valid = system_log($gzip, '--test', @zlib_wals);
    is($gzip_is_valid, 0,
        "gzip verified the integrity of compressed WAL segments");