src/parallel: transfer of relative files on systems without /./ capable rsync.

This commit is contained in:
Ole Tange 2013-03-23 11:46:47 +01:00
parent 3615f0b473
commit e14d8f9586

View file

@ -3778,14 +3778,19 @@ sub sshreturn {
my @cmd = (); my @cmd = ();
my $rsync_destdir = ($relpath ? "./" : "/"); my $rsync_destdir = ($relpath ? "./" : "/");
my $ret_file = $file; my $ret_file = $file;
# If relative path: prepend workdir/./ to avoid problems my $cd;
# if the dir contains ':' and to get the right relative return path if($relpath) {
my $replaced = ($relpath ? $self->workdir()."/./" : "") . $file; # rsync -avR /foo/./bar/baz.c remote:/tmp/
# == (on old systems)
# rsync -avR --rsync-path="cd /foo; rsync" remote:bar/baz.c /tmp/
my $wd = $self->workdir();
$cd = '--rsync-path='.::shell_quote_scalar("cd $wd; rsync");
}
# --return # --return
# Abs path: rsync -rlDzR server:/home/tange/dir/subdir/file.gz / # Abs path: rsync -rlDzR server:/home/tange/dir/subdir/file.gz /
# Rel path: rsync -rlDzR server:./subsir/file.gz ./ # Rel path: rsync -rlDzR server:./subdir/file.gz ./
$pre .= "rsync $rsync_opt $serverlogin:". $pre .= "rsync $cd $rsync_opt $serverlogin:".
::shell_quote_scalar($replaced) . " ".$rsync_destdir.";"; ::shell_quote_scalar($file) . " ".$rsync_destdir.";";
} }
return $pre; return $pre;
} }
@ -3883,7 +3888,7 @@ sub workdir {
} else { } else {
$workdir = "."; $workdir = ".";
} }
$self->{'workdir'} = $workdir; $self->{'workdir'} = ::shell_quote_scalar($workdir);
} }
return $self->{'workdir'}; return $self->{'workdir'};
} }