Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix rsync issues with quotes in remote path #1256

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion common/snapshots.py
Original file line number Diff line number Diff line change
Expand Up @@ -1647,7 +1647,7 @@ def filter(self,
return snapshotsFiltered

#TODO: move this to config.Config
def rsyncRemotePath(self, path, use_mode = ['ssh', 'ssh_encfs'], quote = '"'):
def rsyncRemotePath(self, path, use_mode = ['ssh', 'ssh_encfs'], quote = ''):
"""
Format the destination string for rsync depending on which profile is
used.
Expand Down
12 changes: 6 additions & 6 deletions common/sshtools.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,17 +554,17 @@ def maxArg():
#check rsync
rsync1 = tools.rsyncPrefix(self.config, no_perms = False, progress = False)
rsync1.append(tmp_file)
rsync1.append('%s@%s:"%s"/' %(self.user,
tools.escapeIPv6Address(self.host),
remote_tmp_dir_1))
rsync1.append('%s@%s:%s/' %(self.user,
tools.escapeIPv6Address(self.host),
remote_tmp_dir_1))

#check remote rsync hard-link support
rsync2 = tools.rsyncPrefix(self.config, no_perms = False, progress = False)
rsync2.append('--link-dest=../%s' %os.path.basename(remote_tmp_dir_1))
rsync2.append(tmp_file)
rsync2.append('%s@%s:"%s"/' %(self.user,
tools.escapeIPv6Address(self.host),
remote_tmp_dir_2))
rsync2.append('%s@%s:%s/' %(self.user,
tools.escapeIPv6Address(self.host),
remote_tmp_dir_2))

for cmd in (rsync1, rsync2):
logger.debug('Check rsync command: %s' %cmd, self)
Expand Down
5 changes: 3 additions & 2 deletions common/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -577,12 +577,13 @@ def rsyncPrefix(config,
if config.nocacheOnLocal():
cmd.append('nocache')
cmd.append('rsync')
cmd.extend(('--recursive', # recurse into directories
cmd.extend(('--recursive', # recurse into directories
'--times', # preserve modification times
'--devices', # preserve device files (super-user only)
'--specials', # preserve special files
'--hard-links', # preserve hard links
'--human-readable'))# numbers in a human-readable format
'--human-readable', # numbers in a human-readable format
'--protect-args')) # no space splitting, wildcard chars only

if config.useChecksum() or config.forceUseChecksum:
cmd.append('--checksum')
Expand Down