Bogus warning message in Net::Ping in Bionic

Bug #1831423 reported by Frank Burkhardt on 2019-06-03
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
perl (Ubuntu)
Undecided
Unassigned

Bug Description

In Ubuntu Bionic's Ping.pm a test of the used socket's version is done numerically although the Socket.pm's version contains a special character ("_") which causes this warning message:

Argument "2.020_03" isn't numeric in numeric ge (>=) at /usr/share/perl/5.26/Net/Ping.pm line 1801, <DATA> line 755.

Since Socket.pm is part of the same package, the test is not really useful anymore. I suggest removing it quick'n dirty via the attached patch to get rid of the warning while conserving the "old way".

The attachment "Fix to remove bogus socket version warning in Ping.pm" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Martin Deppe (martin-deppe) wrote :

Thanks for the patch, I tried it and suggest the following instead (removing the "_" and everything beyond in the Version string) so that it actually keeps its behaviour for versions prior to 1.94 and in addition to that I encountered a third location where $Socket::VERSION is being used inside that file:

--- Ping.pm.orig 2016-10-27 14:12:58.000000000 +0200
+++ Ping.pm 2019-11-14 13:45:56.886072962 +0100
@@ -1798,7 +1798,9 @@

   # address check
   # new way
- if ($Socket::VERSION >= 1.94) {
+ my $socketVersion = $Socket::VERSION;
+ $socketVersion = $1 if $socketVersion =~ /(\d\.\d+)_\d+/;
+ if ($socketVersion >= 1.94) {
     my %hints = (
       family => $AF_UNSPEC,
       protocol => IPPROTO_TCP,
@@ -1831,7 +1833,7 @@

   # resolve
   # new way
- if ($Socket::VERSION >= 1.94) {
+ if ($socketVersion >= 1.94) {
     my %hints = (
       family => $family,
       protocol => IPPROTO_TCP
@@ -1908,7 +1910,9 @@
       ) = @_;

   my $ret;
- if ($Socket::VERSION >= 1.94) {
+ my $socketVersion = $Socket::VERSION;
+ $socketVersion = $1 if $socketVersion =~ /(\d\.\d+)_\d+/;
+ if ($socketVersion >= 1.94) {
     my ($err, $address) = Socket::getnameinfo($addr, $NI_NUMERICHOST);
     if (defined($address)) {
       $ret = $address;

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers