Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit1ab0719

Browse files
committed
Deal with paths containing \ and spaces in basebackup_to_shell tests
As $gzip is embedded in postgresql.conf \ needs to be escaped, otherwise guc.cwill take it as a string escape. Similarly, if "$gzip" contains spaces, theprior incantation will fail. Both of these are common on windows.Reviewed-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com>Discussion:https://postgr.es/m/ce1b6eb3-5736-6f38-9775-b7020128b8d8@enterprisedb.comBackpatch: 15-, where the test was added in027fa0f
1 parent9a01ea7 commit1ab0719

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

‎contrib/basebackup_to_shell/t/001_basic.pl

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
planskip_all=>'gzip not available';
1717
}
1818

19+
# to ensure path can be embedded in postgresql.conf
20+
$gzip =~s{\\}{/}gif ($PostgreSQL::Test::Utils::windows_os);
21+
1922
my$node = PostgreSQL::Test::Cluster->new('primary');
2023

2124
# Make sure pg_hba.conf is set up to allow connections from backupuser.
@@ -53,8 +56,8 @@
5356
if ($PostgreSQL::Test::Utils::windows_os);
5457
my$shell_command =
5558
$PostgreSQL::Test::Utils::windows_os
56-
?qq{$gzip --fast > "$escaped_backup_path\\\\%f.gz"}
57-
:qq{$gzip --fast > "$escaped_backup_path/%f.gz"};
59+
?qq{"$gzip" --fast > "$escaped_backup_path\\\\%f.gz"}
60+
:qq{"$gzip" --fast > "$escaped_backup_path/%f.gz"};
5861
$node->append_conf('postgresql.conf',
5962
"basebackup_to_shell.command='$shell_command'");
6063
$node->reload();
@@ -74,8 +77,8 @@
7477
# Reconfigure to restrict access and require a detail.
7578
$shell_command =
7679
$PostgreSQL::Test::Utils::windows_os
77-
?qq{$gzip --fast > "$escaped_backup_path\\\\%d.%f.gz"}
78-
:qq{$gzip --fast > "$escaped_backup_path/%d.%f.gz"};
80+
?qq{"$gzip" --fast > "$escaped_backup_path\\\\%d.%f.gz"}
81+
:qq{"$gzip" --fast > "$escaped_backup_path/%d.%f.gz"};
7982
$node->append_conf('postgresql.conf',
8083
"basebackup_to_shell.command='$shell_command'");
8184
$node->append_conf('postgresql.conf',

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp