[pve-devel] [PATCH pve-zsync] fix to many slashes in recv path

Wolfgang Link w.link at proxmox.com
Tue Nov 3 10:57:05 CET 2015


this corrupt zfs recv
---
 pve-zsync | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pve-zsync b/pve-zsync
index 4941456..005795f 100644
--- a/pve-zsync
+++ b/pve-zsync
@@ -43,7 +43,7 @@ my $HOSTv4RE0 = "(?:[\\w\\.\\-_]+|$IPV4RE)";       # hostname or ipv4 address
 my $HOSTv4RE1 = "(?:$HOSTv4RE0|\\[$HOSTv4RE0\\])"; # these may be in brackets, too
 my $HOSTRE = "(?:$HOSTv4RE1|\\[$IPV6RE\\])";       # ipv6 must always be in brackets
 # targets are either a VMID, or a 'host:zpool/path' with 'host:' being optional
-my $TARGETRE = qr!^(?:($HOSTRE):)?(\d+|(?:[\w\-_]+)(/.+)?)$!;
+my $TARGETRE = qr!^(?:($HOSTRE):)?(\d+|(?:[\w\-_]+)(/.+[^/])?)$!;
 
 check_bin ('cstream');
 check_bin ('zfs');
@@ -734,7 +734,7 @@ sub parse_disks {
 	push @$cmd, 'pvesm', 'path', "$stor$disk";
 	my $path = run_cmd($cmd);
 
-	if ($path =~ m/^\/dev\/zvol\/(\w+.*)(\/$disk)$/) {
+	if ($path =~ m/^\/dev\/zvol\/(\w+.*)\/($disk)$/) {
 
 	    my @array = split('/', $1);
 	    $disks->{$num}->{pool} = shift(@array);
-- 
2.1.4





More information about the pve-devel mailing list