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 a6fabdb

Browse filesBrowse files
committed
[Issue #366] escape paths in restore_command with double quotes when running restore
1 parent 2a3c90a commit a6fabdb
Copy full SHA for a6fabdb

File tree

Expand file treeCollapse file tree

2 files changed

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

2 files changed

+4
-4
lines changed

‎src/restore.c

Copy file name to clipboardExpand all lines: src/restore.c
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1375,7 +1375,7 @@ print_recovery_settings(FILE *fp, pgBackup *backup,
13751375
else
13761376
{
13771377
/* default cmdline, ok for local restore */
1378-
sprintf(restore_command_guc, "%s archive-get -B %s --instance %s "
1378+
sprintf(restore_command_guc, "\"%s\" archive-get -B \"%s\" --instance \"%s\" "
13791379
"--wal-file-path=%%p --wal-file-name=%%f",
13801380
PROGRAM_FULL_PATH ? PROGRAM_FULL_PATH : PROGRAM_NAME,
13811381
backup_path, instance_name);

‎tests/archive.py

Copy file name to clipboardExpand all lines: tests/archive.py
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1715,7 +1715,7 @@ def test_archive_options(self):
17151715
recovery_content = f.read()
17161716

17171717
self.assertIn(
1718-
"restore_command = '{0} archive-get -B {1} --instance {2} "
1718+
"restore_command = '\"{0}\" archive-get -B \"{1}\" --instance \"{2}\" "
17191719
"--wal-file-path=%p --wal-file-name=%f --remote-host=localhost "
17201720
"--remote-port=22 --remote-user={3}'".format(
17211721
self.probackup_path, backup_dir, 'node', self.user),
@@ -1782,7 +1782,7 @@ def test_archive_options_1(self):
17821782
self.restore_node(
17831783
backup_dir, 'node', node,
17841784
options=[
1785-
'--restore-command=none'.format(wal_dir),
1785+
'--restore-command=none',
17861786
'--archive-host=localhost1',
17871787
'--archive-port=23',
17881788
'--archive-user={0}'.format(self.user)
@@ -1792,7 +1792,7 @@ def test_archive_options_1(self):
17921792
recovery_content = f.read()
17931793

17941794
self.assertIn(
1795-
"restore_command = '{0} archive-get -B {1} --instance {2} "
1795+
"restore_command = '\"{0}\" archive-get -B \"{1}\" --instance \"{2}\" "
17961796
"--wal-file-path=%p --wal-file-name=%f --remote-host=localhost1 "
17971797
"--remote-port=23 --remote-user={3}'".format(
17981798
self.probackup_path, backup_dir, 'node', self.user),

0 commit comments

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