diff --git a/src/bin/pg_waldump/t/001_basic.pl b/src/bin/pg_waldump/t/001_basic.pl index 8bb8fa225f6..ce1f6aa30c0 100644 --- a/src/bin/pg_waldump/t/001_basic.pl +++ b/src/bin/pg_waldump/t/001_basic.pl @@ -11,6 +11,15 @@ use Test::More; use List::Util qw(shuffle); my $tar = $ENV{TAR}; +my @tar_c_flags; + +# By default, bsdtar archives sparse files in GNU tar's --format=posix --sparse +# format, so pg_waldump can't find files that ZFS has decided to store with +# holes. Turn that off. +if (system("$tar --no-read-sparse -c - /dev/null > /dev/null") == 0) +{ + push(@tar_c_flags, "--no-read-sparse"); +} program_help_ok('pg_waldump'); program_version_ok('pg_waldump'); @@ -346,7 +355,7 @@ sub generate_archive # move into the WAL directory before archiving files my $cwd = getcwd; chdir($directory) || die "chdir: $!"; - command_ok([$tar, $compression_flags, $archive, @files]); + command_ok([$tar, @tar_c_flags, $compression_flags, $archive, @files]); chdir($cwd) || die "chdir: $!"; }