Skip to content

Commit b35a67b

Browse files
committed
Avoid calling TestLib::perl2host on a symlinked directory
Certain versions of msys2/Windows have been observed to resolve symlinks in perl2host rather than just follow them. This defeats using a symlinked shorter path to a longer path, and makes certain tests fail. We therefore call perl2host on the parent directory of the symlink and thereafter just use that result. Apply to release 14 where the problem has been observed.
1 parent bad1067 commit b35a67b

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/bin/pg_basebackup/t/010_pg_basebackup.pl

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -238,11 +238,13 @@
238238
# to our physical temp location. That way we can use shorter names
239239
# for the tablespace directories, which hopefully won't run afoul of
240240
# the 99 character length limit.
241-
my $shorter_tempdir = TestLib::tempdir_short . "/tempdir";
241+
my $sys_tempdir = TestLib::tempdir_short;
242+
my $real_sys_tempdir = TestLib::perl2host($sys_tempdir) . "/tempdir";
243+
my $shorter_tempdir = $sys_tempdir . "/tempdir";
242244
dir_symlink "$tempdir", $shorter_tempdir;
243245

244246
mkdir "$tempdir/tblspc1";
245-
my $realTsDir = TestLib::perl2host("$shorter_tempdir/tblspc1");
247+
my $realTsDir = "$real_sys_tempdir/tblspc1";
246248
my $real_tempdir = TestLib::perl2host($tempdir);
247249
$node->safe_psql('postgres',
248250
"CREATE TABLESPACE tblspc1 LOCATION '$realTsDir';");
@@ -275,7 +277,7 @@
275277

276278
# Recover tablespace into a new directory (not where it was!)
277279
my $repTsDir = "$tempdir/tblspc1replica";
278-
my $realRepTsDir = TestLib::perl2host("$shorter_tempdir/tblspc1replica");
280+
my $realRepTsDir = "$real_sys_tempdir/tblspc1replica";
279281
mkdir $repTsDir;
280282
TestLib::system_or_bail($tar, 'xf', $tblspc_tars[0], '-C', $repTsDir);
281283

@@ -390,7 +392,7 @@
390392
rmtree("$tempdir/backup1");
391393

392394
mkdir "$tempdir/tbl=spc2";
393-
$realTsDir = TestLib::perl2host("$shorter_tempdir/tbl=spc2");
395+
$realTsDir = "$real_sys_tempdir/tbl=spc2";
394396
$node->safe_psql('postgres', "DROP TABLE test1;");
395397
$node->safe_psql('postgres', "DROP TABLE tblspc1_unlogged;");
396398
$node->safe_psql('postgres', "DROP TABLESPACE tblspc1;");
@@ -409,7 +411,7 @@
409411
rmtree("$tempdir/backup3");
410412

411413
mkdir "$tempdir/$superlongname";
412-
$realTsDir = TestLib::perl2host("$shorter_tempdir/$superlongname");
414+
$realTsDir = "$real_sys_tempdir/$superlongname";
413415
$node->safe_psql('postgres',
414416
"CREATE TABLESPACE tblspc3 LOCATION '$realTsDir';");
415417
$node->command_ok([ 'pg_basebackup', '-D', "$tempdir/tarbackup_l3", '-Ft' ],

0 commit comments

Comments
 (0)