aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Dunstan <andrew@dunslane.net>2024-07-08 13:46:21 -0400
committerAndrew Dunstan <andrew@dunslane.net>2024-07-08 13:52:27 -0400
commitd3e213ae1359f0bcfa9c446166d187811a7db8bc (patch)
treed4f62e6315189486f66f371a7e4c95195aa0ca92 /src
parente68cf81bfea4561518d6b890f75e7aad70b6fbb1 (diff)
downloadpostgresql-d3e213ae1359f0bcfa9c446166d187811a7db8bc.tar.gz
postgresql-d3e213ae1359f0bcfa9c446166d187811a7db8bc.zip
Symlink pg_replslot robustly on Windows in pg_basebackup test
This reverts commit e9f15bc9. Instead of a hacky solution that didn't work on Windows, we avoid trying to move the directory possibly across drives, and instead remove it and recreate it in the new location. Discussion: https://postgr.es/m/20240707070243.sb77kp4ubowauctz@awork3.anarazel.de Backpatch to release 14 like the previous patch.
Diffstat (limited to 'src')
-rw-r--r--src/bin/pg_basebackup/t/010_pg_basebackup.pl14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/bin/pg_basebackup/t/010_pg_basebackup.pl b/src/bin/pg_basebackup/t/010_pg_basebackup.pl
index 489dde4adf1..eebe3307d2c 100644
--- a/src/bin/pg_basebackup/t/010_pg_basebackup.pl
+++ b/src/bin/pg_basebackup/t/010_pg_basebackup.pl
@@ -359,13 +359,13 @@ chmod_recursive("$pgdata", 0750, 0640);
# Create a temporary directory in the system location.
my $sys_tempdir = PostgreSQL::Test::Utils::tempdir_short;
-# On Windows use the short location to avoid path length issues.
-# Elsewhere use $tempdir to avoid file system boundary issues with moving.
-my $tmploc = $windows_os ? $sys_tempdir : $tempdir;
-
-rename("$pgdata/pg_replslot", "$tmploc/pg_replslot")
- or BAIL_OUT "could not move $pgdata/pg_replslot";
-dir_symlink("$tmploc/pg_replslot", "$pgdata/pg_replslot")
+# pg_replslot should be empty. We remove it and recreate it in $sys_tempdir
+# before symlinking, in order to avoid possibly trying to move things across
+# drives.
+rmdir("$pgdata/pg_replslot")
+ or BAIL_OUT "could not remove $pgdata/pg_replslot";
+mkdir("$sys_tempdir/pg_replslot"); # if this fails the symlink will fail
+dir_symlink("$sys_tempdir/pg_replslot", "$pgdata/pg_replslot")
or BAIL_OUT "could not symlink to $pgdata/pg_replslot";
$node->start;