diff --git a/src/bin/pg_validatebackup/t/003_corruption.pl b/src/bin/pg_validatebackup/t/003_corruption.pl index 7a09d02e6c7..09f8b982504 100644 --- a/src/bin/pg_validatebackup/t/003_corruption.pl +++ b/src/bin/pg_validatebackup/t/003_corruption.pl @@ -16,6 +16,9 @@ $master->start; # Include a user-defined tablespace in the hopes of detecting problems in that # area. my $source_ts_path = TestLib::perl2host(TestLib::tempdir_short()); +my $source_ts_prefix = $source_ts_path; +$source_ts_prefix =~ s!(^[A-Z]:/[^/]*)/.*!$1!; + $master->safe_psql('postgres', <<EOM); CREATE TABLE x1 (a int); INSERT INTO x1 VALUES (111); @@ -105,6 +108,10 @@ for my $scenario (@scenario) # Take a backup and check that it validates OK. my $backup_path = $master->backup_dir . '/' . $name; my $backup_ts_path = TestLib::perl2host(TestLib::tempdir_short()); + # The tablespace map parameter confuses Msys2, which tries to mangle + # it. Tell it not to. + # See https://www.msys2.org/wiki/Porting/#filesystem-namespaces + local $ENV{MSYS2_ARG_CONV_EXCL} = $source_ts_prefix; $master->command_ok(['pg_basebackup', '-D', $backup_path, '--no-sync', '-T', "${source_ts_path}=${backup_ts_path}"], "base backup ok"); @@ -179,7 +186,14 @@ sub mutilate_missing_tablespace my $pathname = "$backup_path/pg_tblspc/$tsoid"; if ($windows_os) { - rmdir($pathname) || die "$pathname: $!"; + # rmdir works on some windows setups, unlink on others. + # Instead of trying to implement precise rules, just try one and then + # the other. + unless (rmdir($pathname)) + { + my $err = $!; + unlink($pathname) || die "$pathname: rmdir: $err, unlink: $!"; + } } else {