Skip to content

Commit e46f6a0

Browse files
committed
Further refinement of stuck_on_old_timeline recovery test
TestLib::perl2host can take a file argument as well as a directory argument, so that code becomes substantially simpler. Also add comments on why we're using forward slashes, and why we're setting PERL_BADLANG=0. Discussion: https://postgr.es/m/e9947bcd-20ee-027c-f0fe-01f736b7e345@dunslane.net
1 parent 43acadf commit e46f6a0

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/test/recovery/t/025_stuck_on_old_timeline.pl

+7-5
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,20 @@
2424
# the timeline history file reaches the archive but before any of the WAL files
2525
# get there.
2626
$node_primary->init(allows_streaming => 1, has_archiving => 1);
27-
my $perlbin = $^X;
28-
if ($^O eq 'msys')
29-
{
30-
$perlbin = TestLib::perl2host(dirname($^X)) . '\\' . basename($^X);
31-
}
27+
28+
# Note: consistent use of forward slashes here avoids any escaping problems
29+
# that arise from use of backslashes. That means we need to double-quote all
30+
# the paths in the archive_command
31+
my $perlbin = TestLib::perl2host($^X);
3232
$perlbin =~ s!\\!/!g if $TestLib::windows_os;
3333
my $archivedir_primary = $node_primary->archive_dir;
3434
$archivedir_primary =~ s!\\!/!g if $TestLib::windows_os;
3535
$node_primary->append_conf('postgresql.conf', qq(
3636
archive_command = '"$perlbin" "$FindBin::RealBin/cp_history_files" "%p" "$archivedir_primary/%f"'
3737
wal_keep_segments=8
3838
));
39+
# Make sure that Msys perl doesn't complain about difficulty in setting locale
40+
# when called from the archive_command.
3941
local $ENV{PERL_BADLANG}=0;
4042
$node_primary->start;
4143

0 commit comments

Comments
 (0)