Skip Menu |

This queue is for tickets about the NetAddr-IP CPAN distribution.

Report information
The Basics
Id: 71843
Status: resolved
Priority: 0/
Queue: NetAddr-IP

People
Owner: Nobody in particular
Requestors: TODDR [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 4.049
Fixed in: (no value)



Subject: Incompatibility with Socket6 0.20
Hi, we've discovered an incompatibility with NetAddr::IP 4.049 and Socket6 0.20. When I have those 2 installed, I get this: $>perl -MSocket6 -e 'print "S6=$Socket6::VERSION\n"';perl -MNetAddr::IP::Lite -e 'print "NIPL=$NetAddr::IP::Lite::VERSION\n"'; S6=0.20 "AF_INET6" is not exported by the Socket6 module Can't continue after import errors at /usr/local/lib/perl5/site_lib/i386- linux/NetAddr/IP/Lite.pm line 16 Compilation failed in require at /usr/local/lib/perl5/site_lib/i386-linux/NetAddr/IP/Lite.pm line 16. BEGIN failed--compilation aborted at /usr/local/lib/perl5/site_lib/i386- linux/NetAddr/IP/Lite.pm line 16. Compilation failed in require. BEGIN failed--compilation aborted. It appears to be a result of this change in 4.049: +use NetAddr::IP::Util qw( addconst sub128 ipv6to4 notcontiguous - isIPv4 shiftleft - inet_n2dx hasbits bin2bcd bcd2bin - inet_aton - inet_any2n - ipv6_aton - ipv6_n2x mask4to6 ipv4to6 naip_gethostbyname + havegethostbyname2 ); While the fix to prevent this is straight forward, I'd like to see Makefile.PL updated and released, as it'll simplify alot of debugging when things go wrong. ATM the source pain is that it's causing SpamAssassin installs to break.
I reccommend this patch to fix things. My only hesitation is I'm unclear if cpan will pick up the dependency if it's generated from Lite/Makefile.PL maybe it should go in both just to be sure?
Subject: patch.txt
commit f6ccc9dd492b53b8a71dc6caa4d8db14bc985ac5 Author: Todd Rinaldo <toddr@cpanel.net> Date: Fri Oct 21 12:22:49 2011 -0500 Enforce Socket6 0.23 dependency through Makefile.PL if installed. Enhance eval code to fail if vesion 0.23 of Socket6 is not installed diff --git a/Lite/Makefile.PL b/Lite/Makefile.PL index 3fce927..0203930 100644 --- a/Lite/Makefile.PL +++ b/Lite/Makefile.PL @@ -39,4 +39,12 @@ README : |. $module .q| |; } +# Force an upgrade of Socket6 to 0.23 if it's installed but downlevel. Socket6 is not a hard dependency for this module. +unless(eval { require Socket6; $Socket6::VERSION > 0.22 or die; 1}) { + $makeparms{'PREREQ_PM'}->{'Socket6'} = 0.23; +} else { + # Encourage Socket6 if the user wants to install it. + $makeparms{'META_MERGE'}->{'recommends'}->{'Socket6'} = 0.23; +} + WriteMakefile(%makeparms); diff --git a/Lite/Util/Util.pm b/Lite/Util/Util.pm index 774aff8..032948e 100644 --- a/Lite/Util/Util.pm +++ b/Lite/Util/Util.pm @@ -226,7 +226,7 @@ sub _end_gethostbyname { return @rv; } -unless ( eval { require Socket6 }) { +unless ( eval { require Socket6; $Socket6::VERSION > 0.22 or die}) { $mygethostbyname = sub { my @tip = gethostbyname($_[0]); return &_end_gethostbyname(@tip); diff --git a/Lite/Util/lib/NetAddr/IP/InetBase.pm b/Lite/Util/lib/NetAddr/IP/InetBase.pm index 1d1fe1b..8e558fb 100644 --- a/Lite/Util/lib/NetAddr/IP/InetBase.pm +++ b/Lite/Util/lib/NetAddr/IP/InetBase.pm @@ -80,7 +80,7 @@ if (eval { AF_INET6() } ) { *AF_INET6 = \&Socket::AF_INET6; $emulateAF_INET6 = -1; # have it, remind below } -if (eval{ require Socket6 } ) { +if (eval{ require Socket6; $Socket6::VERSION > 0.22 or die } ) { if ($emulateAF_INET6) { import Socket6 qw( inet_pton diff --git a/Lite/Util/t/naip_gethostbyname.t b/Lite/Util/t/naip_gethostbyname.t index 147254d..dc116f2 100644 --- a/Lite/Util/t/naip_gethostbyname.t +++ b/Lite/Util/t/naip_gethostbyname.t @@ -47,7 +47,7 @@ if (havegethostbyname2()) { unless $got eq $exp; } else { print STDERR "\n\tgethostbyname2 missing from Socket6\n" - if eval{ require Socket6 }; + if eval{ require Socket6; $Socket6::VERSION > 0.22 or die }; $got = scalar naip_gethostbyname($host); if ($got) { $got = eval{ inet_ntoa($got) } ||
On Fri Oct 21 13:28:13 2011, TODDR wrote: Show quoted text
> I reccommend this patch to fix things. My only hesitation is I'm > unclear if cpan will pick up the > dependency if it's generated from Lite/Makefile.PL maybe it should go > in both just to be sure? >
Well... actually can't patch the Makefile.PL Part of NetAddr::IP's mission is to be fully PurePerl compliant so if someone does not have a C compiler they can still use it. The preclude requiring them to update to a newer version of Socket6 which requires a C compiler. Investigating further, versions Socket6 prior 0.23 did not have AF_INET6 in the EXPORT_OK array and there was a klugy test to add AF_INET6 to the EXPORT array if Socket did not have it. I have changed the method of acquiring AF_INET6 from either Socket or Socket6 that avoids the issue and it will appear in NetAddr::IP v4.050 which I am working on right now adding support for Math::BigInt numbers. I will update this ticket when I release 4.050 shortly. Best regards, Michael
I've done further testing. I think my initial patch is wrong. This should be closer to what I'd like to see: https://github.com/toddr/tmp-netaddr- ip/commit/b86390b797ae3a5bc44a327bdeddb09c86209c95
Subject: patch.txt
From b86390b797ae3a5bc44a327bdeddb09c86209c95 Mon Sep 17 00:00:00 2001 From: Todd Rinaldo <toddr@cpan.org> Date: Fri, 21 Oct 2011 13:10:10 -0500 Subject: [PATCH] Enforce Socket6 0.23 dependency through Makefile.PL if installed. Enhance eval code to fail if version 0.23 of Socket6 is not installed --- IP.pm | 2 +- Lite/Makefile.PL | 8 +++++++ Lite/Util/Util.pm | 2 +- Lite/Util/lib/NetAddr/IP/InetBase.pm | 2 +- META.yml | 36 +++++++++++++++++++++------------ Makefile.PL | 8 +++++++ 6 files changed, 42 insertions(+), 16 deletions(-) diff --git a/IP.pm b/IP.pm index 935676e..1a198b1 100644 --- a/IP.pm +++ b/IP.pm @@ -35,7 +35,7 @@ require Exporter; @ISA = qw(Exporter NetAddr::IP::Lite); -$VERSION = do { sprintf " %d.%03d", (q$Revision: 4.49 $ =~ /\d+/g) }; +$VERSION = " 4.049_01"; =pod diff --git a/Lite/Makefile.PL b/Lite/Makefile.PL index 3fce927..577f38d 100644 --- a/Lite/Makefile.PL +++ b/Lite/Makefile.PL @@ -39,4 +39,12 @@ README : |. $module .q| |; } +# Force an upgrade of Socket6 to 0.23 if it's installed but downlevel. Socket6 is not a hard dependency for this module. +if(eval { require Socket6 } && $Socket6::VERSION < 0.23 ) { + $makeparms{'PREREQ_PM'}->{'Socket6'} = 0.23; +} else { + # Encourage Socket6 if the user wants to install it. + $makeparms{'META_MERGE'}->{'recommends'}->{'Socket6'} = 0.23; +} + WriteMakefile(%makeparms); diff --git a/Lite/Util/Util.pm b/Lite/Util/Util.pm index 774aff8..97c7535 100644 --- a/Lite/Util/Util.pm +++ b/Lite/Util/Util.pm @@ -226,7 +226,7 @@ sub _end_gethostbyname { return @rv; } -unless ( eval { require Socket6 }) { +unless ( eval { require Socket6 } && $Socket6::VERSION > 0.22 ) { $mygethostbyname = sub { my @tip = gethostbyname($_[0]); return &_end_gethostbyname(@tip); diff --git a/Lite/Util/lib/NetAddr/IP/InetBase.pm b/Lite/Util/lib/NetAddr/IP/InetBase.pm index 1d1fe1b..a13bd31 100644 --- a/Lite/Util/lib/NetAddr/IP/InetBase.pm +++ b/Lite/Util/lib/NetAddr/IP/InetBase.pm @@ -80,7 +80,7 @@ if (eval { AF_INET6() } ) { *AF_INET6 = \&Socket::AF_INET6; $emulateAF_INET6 = -1; # have it, remind below } -if (eval{ require Socket6 } ) { +if (eval{ require Socket6 } && $Socket6::VERSION > 0.22 ) { if ($emulateAF_INET6) { import Socket6 qw( inet_pton diff --git a/META.yml b/META.yml index b1fd991..a6ffb02 100644 --- a/META.yml +++ b/META.yml @@ -1,14 +1,24 @@ ---- #YAML:1.0 -name: NetAddr-IP -version: 4.049 -abstract: Manages IPv4 and IPv6 addresses and subnets -license: ~ -author: - - Luis E. Muñoz <luismunoz@cpan.org>, Michael Robinton <miker@cpan.org> -generated_by: ExtUtils::MakeMaker version 6.42 -distribution_type: module -requires: - Test::More: 0 +--- +abstract: 'Manages IPv4 and IPv6 addresses and subnets' +author: + - 'Luis E. Muñoz <luismunoz@cpan.org>, Michael Robinton <miker@cpan.org>' +build_requires: + ExtUtils::MakeMaker: 0 +configure_requires: + ExtUtils::MakeMaker: 0 +dynamic_config: 1 +generated_by: 'ExtUtils::MakeMaker version 6.59, CPAN::Meta::Converter version 2.112150' +license: unknown meta-spec: - url: http://module-build.sourceforge.net/META-spec-v1.3.html - version: 1.3 + url: http://module-build.sourceforge.net/META-spec-v1.4.html + version: 1.4 +name: NetAddr-IP +no_index: + directory: + - t + - inc +recommends: + Socket6: 0.23 +requires: + Test::More: 0 +version: 4.049_01 diff --git a/Makefile.PL b/Makefile.PL index 76baad9..9db0892 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -125,4 +125,12 @@ my %makeparms = ( clean => { FILES => "*~ tmp*"}, ); +# Force an upgrade of Socket6 to 0.23 if it's installed but downlevel. Socket6 is not a hard dependency for this module. +if(eval { require Socket6 } && $Socket6::VERSION < 0.23 ) { + $makeparms{'PREREQ_PM'}->{'Socket6'} = 0.23; +} else { + # Encourage Socket6 if the user wants to install it. + $makeparms{'META_MERGE'}->{'recommends'}->{'Socket6'} = 0.23; +} + WriteMakefile(%makeparms); -- 1.7.5.4
On Fri Oct 21 14:07:09 2011, MIKER wrote: Show quoted text
> Well... actually can't patch the Makefile.PL > Part of NetAddr::IP's mission is to be fully PurePerl compliant so if > someone does not have a C compiler they can still use it. The preclude > requiring them to update to a newer version of Socket6 which requires a > C compiler.
To my mind, we're in a pickle here where the user things Socket6 is enabled, but it's not because of this problem. What I'm wondering is how to we properly communicate to the user that they need to upgrade Socket6 if possible? Also this version therefore breaks anyone previously using 4.048 with a working Socket6 0.20
On Fri Oct 21 14:18:10 2011, TODDR wrote: Show quoted text
> On Fri Oct 21 14:07:09 2011, MIKER wrote:
> > Well... actually can't patch the Makefile.PL > > Part of NetAddr::IP's mission is to be fully PurePerl compliant so
> if
> > someone does not have a C compiler they can still use it. The
> preclude
> > requiring them to update to a newer version of Socket6 which
> requires a
> > C compiler.
> > To my mind, we're in a pickle here where the user things Socket6 is > enabled, but it's not > because of this problem. What I'm wondering is how to we properly > communicate to the user > that they need to upgrade Socket6 if possible? Also this version > therefore breaks anyone > previously using 4.048 with a working Socket6 0.20
Sorry, I didn't properly read the other part of your reply. Thanks for looking into this.
Show quoted text
> Well... actually can't patch the Makefile.PL > Part of NetAddr::IP's mission is to be fully PurePerl compliant so if > someone does not have a C compiler they can still use it. The preclude > requiring them to update to a newer version of Socket6 which requires a > C compiler.
Inserting a PREREQ_PM for Socket6 appears to only generate a warning message. Makefile is still made and Makefile.PL exits 0. By adding it to PREREQ_PM, it appears we're only signaling cpan/cpanm that they need to pull in this dep, which we want if possible, right?
Fix applied to remove version dependency for Socket6 Version 4.050 released to CPAN On Fri Oct 21 14:39:01 2011, TODDR wrote: Show quoted text
> > Well... actually can't patch the Makefile.PL > > Part of NetAddr::IP's mission is to be fully PurePerl compliant so
> if
> > someone does not have a C compiler they can still use it. The
> preclude
> > requiring them to update to a newer version of Socket6 which
> requires a
> > C compiler.
> > Inserting a PREREQ_PM for Socket6 appears to only generate a warning > message. Makefile is > still made and Makefile.PL exits 0. By adding it to PREREQ_PM, it > appears we're only signaling > cpan/cpanm that they need to pull in this dep, which we want if > possible, right?