Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5193ca8

Browse filesBrowse files
committed
Symlink pg_replslot robustly on Windows in pg_basebackup test
This reverts commit e9f15bc. 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.
1 parent 64f34eb commit 5193ca8
Copy full SHA for 5193ca8

File tree

Expand file treeCollapse file tree

1 file changed

+7
-7
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-7
lines changed

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

Copy file name to clipboardExpand all lines: src/bin/pg_basebackup/t/010_pg_basebackup.pl
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -359,13 +359,13 @@
359359
# Create a temporary directory in the system location.
360360
my $sys_tempdir = PostgreSQL::Test::Utils::tempdir_short;
361361

362-
# On Windows use the short location to avoid path length issues.
363-
# Elsewhere use $tempdir to avoid file system boundary issues with moving.
364-
my $tmploc = $windows_os ? $sys_tempdir : $tempdir;
365-
366-
rename("$pgdata/pg_replslot", "$tmploc/pg_replslot")
367-
or BAIL_OUT "could not move $pgdata/pg_replslot";
368-
dir_symlink("$tmploc/pg_replslot", "$pgdata/pg_replslot")
362+
# pg_replslot should be empty. We remove it and recreate it in $sys_tempdir
363+
# before symlinking, in order to avoid possibly trying to move things across
364+
# drives.
365+
rmdir("$pgdata/pg_replslot")
366+
or BAIL_OUT "could not remove $pgdata/pg_replslot";
367+
mkdir("$sys_tempdir/pg_replslot"); # if this fails the symlink will fail
368+
dir_symlink("$sys_tempdir/pg_replslot", "$pgdata/pg_replslot")
369369
or BAIL_OUT "could not symlink to $pgdata/pg_replslot";
370370

371371
$node->start;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.