rdiff,dup: fix include/exclude paths with spaces (Closes: #398435)
[matthijs/upstream/backupninja.git] / handlers / rdiff.in
index f59d56a515ae16f5b1268a949dfd71cc7c821e80..98a53a3235c489ee392076429191e06a6c8353fc 100644 (file)
@@ -59,7 +59,7 @@ function check_consistency() {
       if [ "$user" == "" ]; then
          fatal "User must be specified for remote $section."
       fi
-      if [ "host" == "" ]; then
+      if [ "$host" == "" ]; then
          fatal "Host must be specifed for remote $section."
       fi
    fi
@@ -209,20 +209,28 @@ symlinks_warning="Maybe you have mixed symlinks and '*' in this statement, which
 
 # TODO: order the includes and excludes
 # excludes
+SAVEIFS=$IFS
+IFS=$(echo -en "\n\b")
 for i in $exclude; do
    str="${i//__star__/*}"
    execstr="${execstr}--exclude '$str' "
 done
+IFS=$SAVEIFS
 # includes
+SAVEIFS=$IFS
+IFS=$(echo -en "\n\b")
 for i in $include; do
    [ "$i" != "/" ] || fatal "Sorry, you cannot use 'include = /'"
    str="${i//__star__/*}"
    execstr="${execstr}--include '$str' "
 done
+IFS=$SAVEIFS
 
 # vsinclude
 if [ $usevserver = yes ]; then
    for vserver in $vsnames; do
+      SAVEIFS=$IFS
+      IFS=$(echo -en "\n\b")
       for vi in $vsinclude; do
          str="${vi//__star__/*}"
          str="$VROOTDIR/$vserver$str"
@@ -232,6 +240,7 @@ if [ $usevserver = yes ]; then
             warning "vsinclude statement '${vi//__star__/*}' will be ignored for VServer $vserver. $symlinks_warning"
          fi
       done
+      IFS=$SAVEIFS
    done
 fi