Index: flexbackup =================================================================== --- flexbackup (.../tags/flexbackup-1.2.1-r5) (revision 777) +++ flexbackup (.../trunk) (revision 777) @@ -1301,8 +1301,8 @@ $cmd .= "$::unz"; } $cmd .= "("; - $cmd .= "mkdir -p $::device ; "; - $cmd .= "cd $::device ; "; + $cmd .= "mkdir -p \"$::device\" ; "; + $cmd .= "cd \"$::device\" ; "; $cmd .= "$::path{cpio} -i "; $cmd .= "-m "; $cmd .= "-d "; @@ -1351,9 +1351,8 @@ # Have to take leading './' off to make rsync's include/exclude work right $cmd .= " | $::path{sed} -e \"s/\\.\\///g\" | "; - $cmd .= "$::path{rsync} "; - $cmd .= "--include-from=- --exclude=* "; + $cmd .= "--files-from=- "; $cmd .= "--archive "; $cmd .= "$::rsync_verb_flag "; $cmd .= "--delete --delete-excluded "; @@ -1368,7 +1367,7 @@ $cmd .= "$remote:"; } } - $cmd .= "$dir/ $::device"; + $cmd .= "\"$dir/\" \"$::device\""; push(@cmds, $cmd); @@ -1658,7 +1657,9 @@ my $tmpfile = "$cfg::tmpdir/ar.$PROCESS_ID"; my $remove = ''; - &log("| NOTE: ar archives will not descend directories"); + &log("| NOTE: ar archives will not recurse into subdirectories,"); + &log("| which makes them inappropriate for most backups."); + &log("| Be sure this is what you want."); if (defined($remote) and ($level != 0)) { my $time = &get_last_date($label, $level, 'numeric'); @@ -1682,11 +1683,13 @@ $cmd = "cd \"$dir\" && "; $cmd .= &file_list_cmd( $dir, $stamp, 'newline', $level, $remote, '-maxdepth 1 ! -type d'); $cmd .= "> $filelist; "; + # Escape any spaces in filenames. + $cmd .= "$::path{sed} -i -e 's/ /\\\\ /g' $filelist; "; $cmd .= "$::path{ar} rc"; $cmd .= "$::ar_verb_flag "; $cmd .= "$tmpfile "; - $cmd .= "`$::path{cat} $filelist`"; + $cmd .= "\@$filelist "; $cmd .= "; $::path{cat} $tmpfile $::z"; # Buffer both sides if remote @@ -1800,12 +1803,9 @@ $cmd = "cd \"$dir\" && "; $cmd .= &file_list_cmd( $dir, $stamp, 'newline', $level, $remote); - $cmd .= "> $filelist; "; - - $cmd .= "$::path{lha} a"; + $cmd .= " | $::path{lha} a"; $cmd .= "$::lha_verb_flag "; $cmd .= "$tmpfile "; - $cmd .= "`$::path{cat} $filelist`"; $cmd .= "; $::path{cat} $tmpfile $::z"; # Buffer both sides if remote @@ -2766,6 +2766,7 @@ $::path{'dd'} = &checkinpath('dd'); $::path{'printf'} = &checkinpath('printf'); $::path{'mkdir'} = &checkinpath('mkdir'); + $::path{'sed'} = &checkinpath('sed'); push(@::remoteprogs,($::path{'touch'},$::path{'rm'},$::path{'find'},$::path{'printf'},$::path{'mkdir'})); @@ -4894,9 +4895,10 @@ $rex .= '\)"'; } # Show what the darn thing is constructing for prune expressions. - &log("| \"find\" regex for pruning is:"); - &log("| $rex"); - &line(); + my $temp = $rex; + $temp =~ s/\\([()|])/$1/g; + &log("| \"find\" regex for pruning (shell escaping omitted for clarity) is:"); + &log("| $temp"); $cmd .= '-regex ' . $rex . ' -prune -o '; } else { # Show what the darn thing is constructing for prune expressions. @@ -4906,6 +4908,7 @@ # don't have permissions on and are running as non-root) $cmd .= "-depth "; } + &line(); $cmd .= "$::mountpoint_flag "; $cmd .= "! -type s "; @@ -5301,12 +5304,14 @@ print $::msg "| Checking '$cfg::buffer' on this machine... "; $pipecmd = "sh $tmp_script "; } else { + $pipecmd = + "$::remoteshell $host '$::path{mkdir} -p $cfg::tmpdir'; " . + "cat $tmp_script | ($::remoteshell $host 'cat > $tmp_script; " . + "sh $tmp_script; rm -rf $cfg::tmpdir')"; print $::msg "| Checking '$cfg::buffer' on host $host... "; - $pipecmd = "$::remoteshell $host '$::path{mkdir} -p $cfg::tmpdir'; cat $tmp_script | ($::remoteshell $host 'cat > $tmp_script; sh $tmp_script; rm -rf $cfg::tmpdir')"; } if (!defined($::debug)) { - open(PIPE,"$pipecmd |") || die; $explicit_success = 0;