#870 closed defect (fixed)

[PERL WARNING] Use of uninitialized value

Reported by: yonas Owned by: nobody
Priority: normal Milestone: Munin 2.0.0
Component: plugins Version: 1.4.3
Severity: normal Keywords:
Cc:

Description

[PERL WARNING] Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/5.8.8/Munin/Master/LimitsOld.pm line 446


Line 446 starts with "DEBUG":

 if (defined $warn and $warn =~ /^\s*([-+\d.]*):([-+\d.]*)\s*$/) {
        $warning[0] = $1 if length $1;
        $warning[1] = $2 if length $2;
        DEBUG "[DEBUG] processing warning: $name -> $warning[0] : $warning[1]";
    }

Change History (3)

comment:1 Changed at 2010-02-19T13:46:31+01:00 by yonas

Here's my fix. It could be wrong, I don't know what the input actually looks like.


    if (defined $warn and $warn =~ /^\s*([-+\d.]+):([-+\d.]+)\s*$/) {
        $warning[0] = $1 if length $1;
        $warning[1] = $2 if length $2;
        DEBUG "[DEBUG] processing warning: $name -> $warning[0] : $warning[1]";
    }

comment:2 Changed at 2010-03-30T18:02:04+02:00 by arth1

No, that does not fix the issue, it only hides it.
The problem is that two of the variables can remain undef by the time the DEBUG call happens, as they're only conditionally set, never explicitly.

Adding the following before the two assignments would work:
$warning[0] = $warning[1] = ;

comment:3 Changed at 2011-04-10T03:29:13+02:00 by bldewolf

  • Resolution set to fixed
  • Status changed from new to closed

I fixed this in r3883 but wasn't aware there was a ticket for it.

Note: See TracTickets for help on using tickets.