[pve-devel] [PATCH storage] fix #2226: ignore broken symlinks in template_list

Stefan Reiter s.reiter at proxmox.com
Thu Jun 13 15:55:52 CEST 2019


On June 13, 2019 at 3:41 PM Thomas Lamprecht wrote:
> 
> 
> On 6/13/19 2:30 PM, Stefan Reiter wrote:
> > Broken symlinks will no longer be enumerated, thus not causing a
> > format validation in content GUI due to the missing filesize.
> 
> so they just get hidden now? Not sure if this is want we want,
> one normally may want to make an admin notice a dangling symlink,
> or not?

This is currently the case for all files with unknown extensions placed in one of these directories, so I followed that example. Neither solution feels perfect to be honest, but a GUI extension (status column? error in size field?) seems overkill for something rather niche (that shouldn't happen in regular use anyway).

> 
> Maybe just do a
> 
> $info->{size} = -s $fn // 0;
> 
> instead?
> 

I'll send v2 with this logic, if you want.

I will definitely include the same fix for snippets, as Oguz mentioned in his mail.

> FYI: in perl || is a logical or and // is a definedness check,
> 
> 0 || echo "foo"; # echos foo
> 0 // echo "foo"; # does _not_ echo foo
> undef // echo "foo" # does echo foo

Thanks!

>  
> > Signed-off-by: Stefan Reiter <s.reiter at proxmox.com>
> > ---
> >  PVE/Storage.pm | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/PVE/Storage.pm b/PVE/Storage.pm
> > index 588e775..4486122 100755
> > --- a/PVE/Storage.pm
> > +++ b/PVE/Storage.pm
> > @@ -869,7 +869,7 @@ sub template_list {
> >  
> >  		$info->{size} = -s $fn;
> >  
> > -		push @{$res->{$sid}}, $info;
> > +		push @{$res->{$sid}}, $info if $info->{size};
> >  	    }
> >  
> >  	}
> > 
>




More information about the pve-devel mailing list