← Back to team overview

pkg-perl-maintainers team mailing list archive

[Bug 2083236] Re: [SRU] Net::IP->intip return undef for IP 0.0.0.0 instead of 0

 

** Description changed:

  [ Impact ]
  
   * This perl module doesn't calculate correctly the equivalent integer value for
     an IP of only zeros (0.0.0.0).
  
   * This leads to unpredictable error-prone behavior in the pieces of code that
     use it because an uninitialised value is not expected as a result of the
     intip conversion.
  
  [ Test Plan ]
  
  Using the script attached in comment #4 we could see the bad case and
  validate the good one.
  
  #0 Preparation in a container (e.g., Focal)
  #0.0 Enabling container
    lxc launch ubuntu-daily:focal Flibnet-ip-perl
-   lxc shell Jpostfix
+   lxc shell Flibnet-ip-perl
    apt update && apt Flibnet-ip-perl
  #0.1 Getting test script and install requirements packages to be executed:
    apt install libnet-ip-perl libdata-dumper-concise-perl
    wget https://bugs.launchpad.net/ubuntu/+source/libnet-ip-perl/+bug/2083236/+attachment/5827083/+files/ip_intip_method.pl
  
  #1 Execution
    perl ip_intip_method.pl 0.0.0.0
  
  ### Bad case
  # Note the error message and the errno and error
  
  root@Flibnet-ip-perl:~# perl ip_intip_method.pl 0.0.0.0
  Use of uninitialized value in concatenation (.) or string at ip_intip_method.pl line 15.
  "IP   : 0.0.0.0"
  "Int  : "
  
  bless( {
    binip => "00000000000000000000000000000000",
    binmask => "11111111111111111111111111111111",
    errno => undef,
    error => undef,
    ip => "0.0.0.0",
    ipversion => 4,
    is_prefix => 1,
    last_bin => "00000000000000000000000000000000",
    last_ip => "0.0.0.0",
    prefixlen => 32,
  }, 'Net::IP' )
  
  ### Good case (after upgrading package from proposed following [1])
  # Note that error message disappears and it return an Math::BigInt object (intformat with value of 0)
  
  root@Flibnet-ip-perl:~# perl ip_intip_method.pl 0.0.0.0
  "IP   : 0.0.0.0"
  "Int  : 0"
  
  bless( {
    binip => "00000000000000000000000000000000",
    binmask => "11111111111111111111111111111111",
    intformat => bless( {
      sign => "+",
      value => bless( [
        0,
      ], 'Math::BigInt::Calc' ),
    }, 'Math::BigInt' ),
    ip => "0.0.0.0",
    ipversion => 4,
    is_prefix => 1,
    last_bin => "00000000000000000000000000000000",
    last_ip => "0.0.0.0",
    prefixlen => 32,
  }, 'Net::IP' )
  
  [1] https://wiki.ubuntu.com/Testing/EnableProposed
  
  [ Where problems could occur ]
  
   The change affects only operations that involve the necessity of having the
   IP as an integer, so there shouldn't be regressions for other computations.
  
   Nevertheless, programmers who didn't notice this undefined value could see
   differences when executing ad-hoc code that uses this perl module. If they were
   conscious of it but put remedies in place (with exceptions u other
   mechanisms), they wouldn't notice the change, but that code will no longer
   needed.
  
  [ Other Info ]
  
  The fix has been incorporated in Debian as per comment #5 (thanks
  Gregor!)
  
  The package has a test suite that runs at build time that passes ok.
  
  [Original Report]
  --------------------------------------------------------------------------------
  
  This issue is related to CPAN RT#60439
  (https://rt.cpan.org/Public/Bug/Display.html?id=60439) which was closed
  but never integrated to the lib code.

** Description changed:

  [ Impact ]
  
   * This perl module doesn't calculate correctly the equivalent integer value for
     an IP of only zeros (0.0.0.0).
  
   * This leads to unpredictable error-prone behavior in the pieces of code that
     use it because an uninitialised value is not expected as a result of the
     intip conversion.
  
  [ Test Plan ]
  
  Using the script attached in comment #4 we could see the bad case and
  validate the good one.
  
  #0 Preparation in a container (e.g., Focal)
  #0.0 Enabling container
    lxc launch ubuntu-daily:focal Flibnet-ip-perl
    lxc shell Flibnet-ip-perl
-   apt update && apt Flibnet-ip-perl
  #0.1 Getting test script and install requirements packages to be executed:
-   apt install libnet-ip-perl libdata-dumper-concise-perl
+   apt update
+   apt install libnet-ip-perl libdata-dumper-concise-perl
    wget https://bugs.launchpad.net/ubuntu/+source/libnet-ip-perl/+bug/2083236/+attachment/5827083/+files/ip_intip_method.pl
  
  #1 Execution
    perl ip_intip_method.pl 0.0.0.0
  
  ### Bad case
- # Note the error message and the errno and error
+ # Note the error message and the errno and error "... uninitialized value ..."
  
  root@Flibnet-ip-perl:~# perl ip_intip_method.pl 0.0.0.0
  Use of uninitialized value in concatenation (.) or string at ip_intip_method.pl line 15.
  "IP   : 0.0.0.0"
  "Int  : "
  
  bless( {
    binip => "00000000000000000000000000000000",
    binmask => "11111111111111111111111111111111",
    errno => undef,
    error => undef,
    ip => "0.0.0.0",
    ipversion => 4,
    is_prefix => 1,
    last_bin => "00000000000000000000000000000000",
    last_ip => "0.0.0.0",
    prefixlen => 32,
  }, 'Net::IP' )
  
  ### Good case (after upgrading package from proposed following [1])
  # Note that error message disappears and it return an Math::BigInt object (intformat with value of 0)
  
  root@Flibnet-ip-perl:~# perl ip_intip_method.pl 0.0.0.0
  "IP   : 0.0.0.0"
  "Int  : 0"
  
  bless( {
    binip => "00000000000000000000000000000000",
    binmask => "11111111111111111111111111111111",
    intformat => bless( {
      sign => "+",
      value => bless( [
        0,
      ], 'Math::BigInt::Calc' ),
    }, 'Math::BigInt' ),
    ip => "0.0.0.0",
    ipversion => 4,
    is_prefix => 1,
    last_bin => "00000000000000000000000000000000",
    last_ip => "0.0.0.0",
    prefixlen => 32,
  }, 'Net::IP' )
  
  [1] https://wiki.ubuntu.com/Testing/EnableProposed
  
  [ Where problems could occur ]
  
   The change affects only operations that involve the necessity of having the
   IP as an integer, so there shouldn't be regressions for other computations.
  
   Nevertheless, programmers who didn't notice this undefined value could see
   differences when executing ad-hoc code that uses this perl module. If they were
   conscious of it but put remedies in place (with exceptions u other
   mechanisms), they wouldn't notice the change, but that code will no longer
   needed.
  
  [ Other Info ]
  
  The fix has been incorporated in Debian as per comment #5 (thanks
  Gregor!)
  
  The package has a test suite that runs at build time that passes ok.
  
  [Original Report]
  --------------------------------------------------------------------------------
  
  This issue is related to CPAN RT#60439
  (https://rt.cpan.org/Public/Bug/Display.html?id=60439) which was closed
  but never integrated to the lib code.

-- 
You received this bug notification because you are a member of Debian
Perl Group, which is subscribed to libnet-ip-perl in Ubuntu.
https://bugs.launchpad.net/bugs/2083236

Title:
  [SRU] Net::IP->intip return undef for IP 0.0.0.0 instead of 0

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/libnet-ip-perl/+bug/2083236/+subscriptions



References