]> gitweb.fluxo.info Git - backupninja.git/commitdiff
Solve quoting issue with "su" (debian #683731) (upstream #4019) bug/4019
authorSilvio Rhatto <rhatto@riseup.net>
Sat, 20 Apr 2013 15:07:27 +0000 (12:07 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Sat, 26 Oct 2013 15:18:19 +0000 (13:18 -0200)
A fix for debian #677410 on commit 29dcdbae introduces a new issue on wheezy
machines where some rsync_options gets out of the rsync command quotes when
invoked by su.

As reported, running backupninja through `bash -x` shows that the `--delete`
option from the rsync command is not included in the single quote for the `su
-c` command:

    nice -n 0 su -c '/usr/bin/rsync -av' --delete '--recursive
    --delete-excluded    //home/ /tmp/test//home//'

This patch attempt to solve that issue by using the intermediary variable
$command.

handlers/rsync.in

index 1954fc11a1e13af459219c8eb26b9724670b5a5c..b2c4b593f7e3326c484f7f842b9ae3602fc553de 100644 (file)
@@ -1136,9 +1136,10 @@ for SECTION in $include; do
   set_dest
 
   info "Syncing $SECTION on $dest_path..."
-  debug $nice $rsync ${rsync_options[@]} $filelist_flag $excludes $batch_option $orig $dest_path
+  command="$rsync ${rsync_options[@]} --delete-excluded $filelist_flag $excludes $batch_option $orig $dest_path"
+  debug $nice su -c "$command"
   set_pipefail
-  $nice su -c "$rsync ${rsync_options[@]} --delete-excluded $filelist_flag $excludes $batch_option $orig $dest_path" | tee -a $log
+  $nice su -c "$command" | tee -a $log
 
   check_rsync_exit_status $?
   restore_pipefail