|
16 | 16 | # Include a user-defined tablespace in the hopes of detecting problems in that |
17 | 17 | # area. |
18 | 18 | my $source_ts_path = TestLib::perl2host(TestLib::tempdir_short()); |
| 19 | +my $source_ts_prefix = $source_ts_path; |
| 20 | +$source_ts_prefix =~ s!(^[A-Z]:/[^/]*)/.*!$1!; |
| 21 | + |
19 | 22 | $master->safe_psql('postgres', <<EOM); |
20 | 23 | CREATE TABLE x1 (a int); |
21 | 24 | INSERT INTO x1 VALUES (111); |
|
105 | 108 | # Take a backup and check that it validates OK. |
106 | 109 | my $backup_path = $master->backup_dir . '/' . $name; |
107 | 110 | my $backup_ts_path = TestLib::perl2host(TestLib::tempdir_short()); |
| 111 | + # The tablespace map parameter confuses Msys2, which tries to mangle |
| 112 | + # it. Tell it not to. |
| 113 | + # See https://www.msys2.org/wiki/Porting/#filesystem-namespaces |
| 114 | + local $ENV{MSYS2_ARG_CONV_EXCL} = $source_ts_prefix; |
108 | 115 | $master->command_ok(['pg_basebackup', '-D', $backup_path, '--no-sync', |
109 | 116 | '-T', "${source_ts_path}=${backup_ts_path}"], |
110 | 117 | "base backup ok"); |
@@ -179,7 +186,14 @@ sub mutilate_missing_tablespace |
179 | 186 | my $pathname = "$backup_path/pg_tblspc/$tsoid"; |
180 | 187 | if ($windows_os) |
181 | 188 | { |
182 | | - rmdir($pathname) || die "$pathname: $!"; |
| 189 | + # rmdir works on some windows setups, unlink on others. |
| 190 | + # Instead of trying to implement precise rules, just try one and then |
| 191 | + # the other. |
| 192 | + unless (rmdir($pathname)) |
| 193 | + { |
| 194 | + my $err = $!; |
| 195 | + unlink($pathname) || die "$pathname: rmdir: $err, unlink: $!"; |
| 196 | + } |
183 | 197 | } |
184 | 198 | else |
185 | 199 | { |
|
0 commit comments