PacketFence - BTS - PacketFence
View Issue Details
0000792PacketFencepublic2009-09-01 15:192011-01-26 15:43
obilodeau 
obilodeau 
highmajorrandom
closedfixed 
 
 
0000792: pfsetvlan warning at line 999
The error:

Use of uninitialized value in string ne at /usr/local/pf/sbin/pfsetvlan line
        999 (0000001)
    (W uninitialized) An undefined value was used as if it were already
    defined.  It was interpreted as a "" or a 0, but maybe it was a mistake.
    To suppress this warning assign a defined value to your variables.
    
    To help you figure out what was undefined, perl tells you what operation
    you used the undefined value in.  Note, however, that perl optimizes your
    program and the operation displayed in the warning may not necessarily
    appear literally in your program.  For example, "that $foo" is
    usually optimized into "that " . $foo, and the warning will refer to
    the concatenation (.) operator, even though there is no . in your
    program.


the code:
                if (   (@locationlog)
                    && ( scalar(@locationlog) > 0 )
                    && ( $locationlog[0]->{'mac'} ne '' ) )
                {   
                    if ($switch->isMacInAddressTableAtIfIndex(
                            $mac, $switch_port
                        )
                        )
                    {   

When locationlog has a NULL mac, the two first conditions are true but the mac field of $locationlog[0] is undef. The warning is about comparing undef with other stuff.

Why does locationlog contains a NULL mac? Is it useful? I noticed that if $mac is undef in locationlog_insert_start then it will insert a NULL value for the mac. So its kind of supported..

I need to talk with Regis about that bug. Could this be the crasher we are looking for in some of our clients?
No tags attached.
Issue History
2009-09-01 15:19obilodeauNew Issue
2009-09-01 15:19obilodeauStatusnew => assigned
2009-09-01 15:19obilodeauAssigned To => obilodeau
2009-09-03 14:07obilodeauNote Added: 0001306
2009-10-13 11:03rbalzardNote Added: 0001326
2009-10-13 11:03rbalzardStatusassigned => resolved
2009-10-13 11:03rbalzardResolutionopen => fixed
2011-01-26 15:43obilodeauStatusresolved => closed

Notes
(0001306)
obilodeau   
2009-09-03 14:07   
I confirmed that it is not a crasher but it scares the users so I'll try to fix it.

We need another condition in there that says defined($locationlog[0]->{'mac'})
(0001326)
rbalzard   
2009-10-13 11:03   
fixed in revision 35674c88802b4a70f0ae90780633866a1b08dc04