[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#799097: mrtg-rrd: Regression after the fix for bug #787608.



-=| Adrian Bunk, 13.01.2017 17:01:15 +0200 |=-
> Damyan, can you take care of this?

Probably, but I can't do it promptly. I don't agree with the statement 
that

   defined %{$hash{key}}

is better to be replaced with

   exists $hash{key}

than with

   %{$hash{key}}

(same for defined @{$hash{key}})

I'd need to investigate what breaks, which would need time.

Perhaps somebody from the perl group (CC-ed) can take a look?

-- dam

> On Tue, Sep 15, 2015 at 11:08:53PM +0300, Vladimir Panov wrote:
> > Package: mrtg-rrd
> > Version: 0.7-5.1
> > Severity: grave
> > Tags: patch
> > Justification: renders package unusable
> > 
> > Dear Maintainer,
> > 
> > The fix for bug #787608 has left the package in an unusable state (the result of the execution of mrtg-rrd.cgi is a blank page).
> > The cause is the blind removal of the defined function. At least in 3 of the 4 instances it should be replaced with exists. I don't know about the fourth instance since I am not a Perl expert.
> > 
> > Please, see the proposed patch below. It should be applied instead of no-defined-hash-array.patch, i.e. against the original source.
> > 
> > 
> > --- a/mrtg-rrd.cgi
> > +++ b/mrtg-rrd.cgi
> > @@ -496,7 +496,7 @@ sub common_args($$$)
> >  {
> >         my ($name, $target, $q) = @_;
> > 
> > -       return @{$target->{args}} if defined @{$target->{args}};
> > +       return @{$target->{args}} if exists $target->{args};
> > 
> >         my $noi = 1 if $target->{options}{noi};
> >         my $noo = 1 if $target->{options}{noo};
> > @@ -521,7 +521,7 @@ sub common_args($$$)
> >         $target->{rrd} = $dir . '/' . $tdir . $name . '.rrd';
> > 
> >         %{$target->{options}} = ()
> > -               unless defined %{$target->{options}};
> > +               unless %{$target->{options}};
> > 
> >         $dir = $cfg->{workdir};
> >         $dir = $cfg->{imagedir}
> > @@ -908,7 +908,7 @@ EOF
> >         print $directories{$dir}{bodytag};
> > 
> >         my $subdirs_printed;
> > -       if (defined @{$directories{$dir}{subdir}}) {
> > +       if (exists $directories{$dir}{subdir}) {
> >                 $subdirs_printed = 1;
> >                 print <<EOF;
> >  <H1>MRTG subdirectories in the directory $dir1</H1>
> > @@ -921,7 +921,7 @@ EOF
> > 
> >                 print "</UL>\n";
> >         }
> > -       if (defined @{$directories{$dir}{target}}) {
> > +       if (exists $directories{$dir}{target}) {
> >                 print "<HR>\n" if defined $subdirs_printed;
> >                 print <<EOF;
> >  <H1>MRTG graphs in the directory $dir1</H1>
> 
> 

Attachment: signature.asc
Description: Digital signature


Reply to: