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

Dietmar Maurer dietmar at proxmox.com
Tue Nov 3 11:29:47 CET 2015


> 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\-_]+)(/.+[^/])?)$!;

I would allow all path, and replace double / when needed with s!/+!/!g

>  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)$/) {

I guess it would be easier to read if you use ! as delimiter?

+	if ($path =~ m!^/dev/zvol/(\w+.*)/($disk)$!) {

>  
>  	    my @array = split('/', $1);
>  	    $disks->{$num}->{pool} = shift(@array);
> -- 
> 2.1.4
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 



More information about the pve-devel mailing list