From 8c121fab163e75825e82f24b6802ada9356021b0 Mon Sep 17 00:00:00 2001 From: Edwin Eefting Date: Thu, 27 Jul 2017 20:23:36 +0200 Subject: [PATCH] forgot space escaping in zfs_transfer() --- zfs_autobackup | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/zfs_autobackup b/zfs_autobackup index 6b9ba0b..58593d4 100755 --- a/zfs_autobackup +++ b/zfs_autobackup @@ -1,6 +1,9 @@ #!/usr/bin/env python # -*- coding: utf8 -*- + + + from __future__ import print_function import os import sys @@ -45,11 +48,9 @@ def run(cmd, input=None, ssh_to="local", tab_split=False, valid_exitcodes=[ 0 ], #make sure the command gets all the data in utf8 format: #(this is neccesary if LC_ALL=en_US.utf8 is not set in the environment) - encoded_cmd.append('"') for arg in cmd: #add single quotes for remote commands to support spaces and other wierd stuff (remote commands are executed in a shell) encoded_cmd.append( ("'"+arg+"'").encode('utf-8')) - encoded_cmd.append('"') else: for arg in cmd: @@ -279,7 +280,10 @@ def zfs_transfer(ssh_source, source_filesystem, first_snapshot, second_snapshot, if first_snapshot: source_cmd.extend([ "-i", first_snapshot ]) - source_cmd.append(source_filesystem + "@" + second_snapshot) + if ssh_source != "local": + source_cmd.append("'" + source_filesystem + "@" + second_snapshot + "'") + else: + source_cmd.append(source_filesystem + "@" + second_snapshot) verbose(txt) @@ -303,7 +307,10 @@ def zfs_transfer(ssh_source, source_filesystem, first_snapshot, second_snapshot, target_cmd.append("-s") - target_cmd.append(target_filesystem) + if ssh_target!="local": + target_cmd.append("'" + target_filesystem + "'") + else: + target_cmd.append(target_filesystem)