jkister / Sys-HostAddr

Provides perl methods to reteive IP address and interface information about a local host.
Artistic License 2.0
0 stars 1 forks source link

Use of uninitialized value in unpack #1

Open sparvu opened 8 years ago

sparvu commented 8 years ago

I am trying to use the module but get warnings. take a look:

Configuring J/JK/JKISTER/Sys-HostAddr-0.993.tgz with Makefile.PL
Checking if your kit is complete...
Looks good
Generating a Unix-style Makefile
Writing Makefile for Sys::HostAddr
Writing MYMETA.yml and MYMETA.json
  JKISTER/Sys-HostAddr-0.993.tgz
  /opt/kronometrix/perl/bin/perl Makefile.PL -- OK
Running make for J/JK/JKISTER/Sys-HostAddr-0.993.tgz
cp HostAddr.pm blib/lib/Sys/HostAddr.pm
  JKISTER/Sys-HostAddr-0.993.tgz
  make -- OK
Running make test
PERL_DL_NONLAZY=1 "/opt/kronometrix/perl/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/main.t .. 1/6 Use of uninitialized value in unpack at /var/tmp/.cpan/build/Sys-HostAddr-0.993-WE7pGg/blib/lib/Sys/HostAddr.pm line 233.
t/main.t .. ok   
All tests successful.
Files=1, Tests=6,  0 wallclock secs ( 0.02 usr  0.00 sys +  0.05 cusr  0.02 csys =  0.09 CPU)
Result: PASS
  JKISTER/Sys-HostAddr-0.993.tgz
  make test -- OK
Running make install
Installing /opt/kronometrix/perl/lib/site_perl/5.20.3/Sys/HostAddr.pm
Appending installation info to /opt/kronometrix/perl/lib/5.20.3/x86_64-linux/perllocal.pod
  JKISTER/Sys-HostAddr-0.993.tgz
  make install  -- OK

as well if I run the example it does report same error:

[krmx@c564 ~]$ ./getips 
found eth0
found eth1
found lo
found 10.0.0.35
found 127.0.0.1
lo has:   255.0.0.0
eth0 has:   255.255.255.0
10.0.0.35 found as the first ip address
Use of uninitialized value in unpack at /opt/kronometrix/perl/lib/site_perl/5.20.3/Sys/HostAddr.pm line 233.
10.0.0.35 appears to be the main ip address of this machine

This is CentOS 5.11 64bit.

jkister commented 8 years ago

Hmm, I dont have any Centos5.11 at the moment, i suppose I can install one in a VM -- can you send me an 'ifconfig -a' ?

sparvu commented 8 years ago

Here my ifconfig output:

[krmx@c564 ~]$ /sbin/ifconfig -a
eth0      Link encap:Ethernet  HWaddr 00:16:3E:3B:CC:35  
          inet addr:10.0.0.35  Bcast:10.0.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:9861567 errors:0 dropped:204581 overruns:0 frame:0
          TX packets:11474662 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:9914052333 (9.2 GiB)  TX bytes:10464044268 (9.7 GiB)
          Interrupt:169 Base address:0xe000 

eth1      Link encap:Ethernet  HWaddr 00:16:3E:3B:CC:35  
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:83200 errors:0 dropped:0 overruns:0 frame:0
          TX packets:83200 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:60560163 (57.7 MiB)  TX bytes:60560163 (57.7 MiB)
sparvu commented 8 years ago

Under another system, debian 7 64bit which have the following IP settings, the module works fine:

krmx@d764:~$ /sbin/ifconfig -a
eth0      Link encap:Ethernet  HWaddr 00:16:3e:42:d0:2c  
          inet addr:10.0.0.30  Bcast:10.0.0.255  Mask:255.255.255.0
          inet6 addr: fe80::216:3eff:fe42:d02c/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3750722 errors:0 dropped:34 overruns:0 frame:0
          TX packets:382677 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:578075795 (551.2 MiB)  TX bytes:207720947 (198.0 MiB)
          Interrupt:71 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:42344 errors:0 dropped:0 overruns:0 frame:0
          TX packets:42344 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:30247395 (28.8 MiB)  TX bytes:30247395 (28.8 MiB)
sparvu commented 8 years ago

So it could be a bug if we have interfaces with no IP associated, right ?

jkister commented 6 years ago

i must have forgotten about this, are you still interested in looking at this issue? if so, does Sys::Hostname's hostname() return a valid hostname on the box giving you the undef error?