aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dunstan <andrew@dunslane.net>2023-07-08 12:34:25 -0400
committerAndrew Dunstan <andrew@dunslane.net>2023-07-08 12:37:46 -0400
commit432fbeaa522ebad417ec0104aee9bd9bd3bfc3ff (patch)
treeff929e5db4b250f84e97af622dca19e336fb33d1
parent3e859b3d7af1b249e89d5e8e25a6f4b678624238 (diff)
downloadpostgresql-432fbeaa522ebad417ec0104aee9bd9bd3bfc3ff.tar.gz
postgresql-432fbeaa522ebad417ec0104aee9bd9bd3bfc3ff.zip
Fix tmpdir issues with commit e213de8e78
Commit e213de8e78 fixed a problem with path lengths to a tempdir on Windows, but caused problems on at least some Unix systems where the system tempdir is on a different file system. To work around this, only used the system temdir for the destination of pg_replslot on Windows, and otherwise restore the old behaviour. Backpatch to relase 14 like the previous patch. Problem exposed by a myriad of buildfarm animals.
-rw-r--r--src/bin/pg_basebackup/t/010_pg_basebackup.pl8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/bin/pg_basebackup/t/010_pg_basebackup.pl b/src/bin/pg_basebackup/t/010_pg_basebackup.pl
index da0fb9f3bd8..ec72282aae5 100644
--- a/src/bin/pg_basebackup/t/010_pg_basebackup.pl
+++ b/src/bin/pg_basebackup/t/010_pg_basebackup.pl
@@ -336,9 +336,13 @@ chmod_recursive("$pgdata", 0750, 0640);
# Create a temporary directory in the system location.
my $sys_tempdir = PostgreSQL::Test::Utils::tempdir_short;
-rename("$pgdata/pg_replslot", "$sys_tempdir/pg_replslot")
+# 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("$sys_tempdir/pg_replslot", "$pgdata/pg_replslot")
+dir_symlink("$tmploc/pg_replslot", "$pgdata/pg_replslot")
or BAIL_OUT "could not symlink to $pgdata/pg_replslot";
$node->start;