aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Dunstan <andrew@dunslane.net>2021-07-29 12:15:03 -0400
committerAndrew Dunstan <andrew@dunslane.net>2021-07-29 12:15:03 -0400
commitb35a67bc04243da609843949c53e6841e748243a (patch)
treeea9d0765202ad440fec362ef4b8e09f06cc6dced /src
parentbad106752272c05de5a56036b8a84ae6ff3249a0 (diff)
downloadpostgresql-b35a67bc04243da609843949c53e6841e748243a.tar.gz
postgresql-b35a67bc04243da609843949c53e6841e748243a.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/bin/pg_basebackup/t/010_pg_basebackup.pl12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/bin/pg_basebackup/t/010_pg_basebackup.pl b/src/bin/pg_basebackup/t/010_pg_basebackup.pl
index ecd6a5d3742..a2cb2a7679d 100644
--- a/src/bin/pg_basebackup/t/010_pg_basebackup.pl
+++ b/src/bin/pg_basebackup/t/010_pg_basebackup.pl
@@ -238,11 +238,13 @@ $node->start;
# to our physical temp location. That way we can use shorter names
# for the tablespace directories, which hopefully won't run afoul of
# the 99 character length limit.
-my $shorter_tempdir = TestLib::tempdir_short . "/tempdir";
+my $sys_tempdir = TestLib::tempdir_short;
+my $real_sys_tempdir = TestLib::perl2host($sys_tempdir) . "/tempdir";
+my $shorter_tempdir = $sys_tempdir . "/tempdir";
dir_symlink "$tempdir", $shorter_tempdir;
mkdir "$tempdir/tblspc1";
-my $realTsDir = TestLib::perl2host("$shorter_tempdir/tblspc1");
+my $realTsDir = "$real_sys_tempdir/tblspc1";
my $real_tempdir = TestLib::perl2host($tempdir);
$node->safe_psql('postgres',
"CREATE TABLESPACE tblspc1 LOCATION '$realTsDir';");
@@ -275,7 +277,7 @@ SKIP:
# Recover tablespace into a new directory (not where it was!)
my $repTsDir = "$tempdir/tblspc1replica";
- my $realRepTsDir = TestLib::perl2host("$shorter_tempdir/tblspc1replica");
+ my $realRepTsDir = "$real_sys_tempdir/tblspc1replica";
mkdir $repTsDir;
TestLib::system_or_bail($tar, 'xf', $tblspc_tars[0], '-C', $repTsDir);
@@ -390,7 +392,7 @@ ok( -d "$tempdir/backup1/pg_replslot",
rmtree("$tempdir/backup1");
mkdir "$tempdir/tbl=spc2";
-$realTsDir = TestLib::perl2host("$shorter_tempdir/tbl=spc2");
+$realTsDir = "$real_sys_tempdir/tbl=spc2";
$node->safe_psql('postgres', "DROP TABLE test1;");
$node->safe_psql('postgres', "DROP TABLE tblspc1_unlogged;");
$node->safe_psql('postgres', "DROP TABLESPACE tblspc1;");
@@ -409,7 +411,7 @@ $node->safe_psql('postgres', "DROP TABLESPACE tblspc2;");
rmtree("$tempdir/backup3");
mkdir "$tempdir/$superlongname";
-$realTsDir = TestLib::perl2host("$shorter_tempdir/$superlongname");
+$realTsDir = "$real_sys_tempdir/$superlongname";
$node->safe_psql('postgres',
"CREATE TABLESPACE tblspc3 LOCATION '$realTsDir';");
$node->command_ok([ 'pg_basebackup', '-D', "$tempdir/tarbackup_l3", '-Ft' ],