Skip Menu |

This queue is for tickets about the IO-Socket-INET6 CPAN distribution.

Report information
The Basics
Id: 55901
Status: resolved
Priority: 0/
Queue: IO-Socket-INET6

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

Bug Information
Severity: Important
Broken in: 2.59
Fixed in: (no value)



Subject: perl 5.12.RC0::Socket causes warnings
I've been chasing a bug that seems to propagate warnings from this module into everything that uses it. All that is required is to compile perl 5.12.0 and then run: $>perl -we 'use IO::Socket::INET6' Subroutine IO::Socket::INET6::inet_ntop redefined at /usr/local/cpanel/lib/perl5/5.12.0/Exporter.pm line 64. at /usr/local/cpanel/lib/perl5/site_lib/IO/Socket/INET6.pm line 21 Subroutine IO::Socket::INET6::inet_pton redefined at /usr/local/cpanel/lib/perl5/5.12.0/Exporter.pm line 64. at /usr/local/cpanel/lib/perl5/site_lib/IO/Socket/INET6.pm line 21 Some background on this issue: During development for perl 5.12, This commit added inet_pton inet_ntop to the default export list for Socket. http://perl5.git.perl.org/perl.git/commitdiff/4411113f31b3f00171bb335092b02104d29d7c d7 I discovered this yesterday and reported it on p5p. It looks like a patch to this module would probably be the best solution. I was hoping you could look at the issue. Here is the conversation: http://groups.google.com/group/perl.perl5.porters/browse_thread/thread/3ef6d32b1b907 daf
Looking at possible fixes, I think the best thing would be to remove "inet_ntop inet_pton" from the use Socket6 statement and then explicitly call out to Socket6::inet_pton whenever it's needed. The alternative is to do crazy if conditions in a begin block to control what gets imported, depending on what version of perl is running. Patch attached:
Subject: inet6_patch.txt
diff --git a/lib/IO/Socket/INET6.pm b/lib/IO/Socket/INET6.pm index 89f44d6..57c5298 100644 --- a/lib/IO/Socket/INET6.pm +++ b/lib/IO/Socket/INET6.pm @@ -18,7 +18,7 @@ use Socket; # IO::Socket and Socket already import stuff here - possibly AF_INET6 # and PF_INET6 so selectively import things from Socket6. use Socket6 ( - qw(AI_PASSIVE inet_ntop inet_pton getaddrinfo + qw(AI_PASSIVE getaddrinfo sockaddr_in6 unpack_sockaddr_in6_all pack_sockaddr_in6_all) ); @@ -55,7 +55,7 @@ sub _sock_info { my @serv = (); if (defined $addr) { - if (!inet_pton(AF_INET6,$addr)) { + if (!Socket6::inet_pton(AF_INET6,$addr)) { if($addr =~ s,^\[([\da-fA-F:]+)\]:([\w\(\)/]+)$,$1,) { $port = $2; } elsif($addr =~ s,^\[(::[\da-fA-F.:]+)\]:([\w\(\)/]+)$,$1,) { @@ -383,7 +383,7 @@ sub sockhost { @_ == 1 or croak 'usage: $sock->sockhost()'; my ($sock) = @_; return undef unless (my $addr = $sock->sockaddr); - inet_ntop($sock->sockdomain, $addr); + Socket6::inet_ntop($sock->sockdomain, $addr); } sub sockflow @@ -420,7 +420,7 @@ sub peerhost { @_ == 1 or croak 'usage: $sock->peerhost()'; my ($sock) = @_; return undef unless (my $addr = $sock->peeraddr); - inet_ntop($sock->sockdomain, $addr); + Socket6::inet_ntop($sock->sockdomain, $addr); } sub peerflow @@ -561,7 +561,7 @@ Suppose either you have no IPv6 connectivity or www.perl.org has no http service $sock = IO::Socket::INET6->new('[::1]:25'); $sock = IO::Socket::INET6->new(PeerPort => 9999, - PeerAddr => inet_ntop(AF_INET6,in6addr_broadcast), + PeerAddr => Socket6::inet_ntop(AF_INET6,in6addr_broadcast), Proto => udp, LocalAddr => 'localhost', Broadcast => 1 )
I just looked into if a test could be created to catch these warnings. Unfortunately, Exporter localizes the warning signal right before the warning we want to catch is emitted, so it will not be possible to make a test for this.
Thanks! I applied this patch in the Subversion repository. I'm still waiting on progress on the this bug: https://rt.cpan.org/Ticket/Display.html?id=55664 before I release a new version. Regards, -- Shlomi Fish
On Wed Mar 24 17:23:31 2010, SHLOMIF wrote: Show quoted text
> I applied this patch in the Subversion repository. I'm still waiting on > progress on the this bug: > https://rt.cpan.org/Ticket/Display.html?id=55664 before I release a new > version.
i'm not seeing this in perl 5.14. Has #55901 been fixed?
On Fri Mar 16 02:18:57 2012, DKG wrote: Show quoted text
> On Wed Mar 24 17:23:31 2010, SHLOMIF wrote: >
> > I applied this patch in the Subversion repository. I'm still waiting on > > progress on the this bug: > > https://rt.cpan.org/Ticket/Display.html?id=55664 before I release a new > > version.
> > i'm not seeing this in perl 5.14. Has #55901 been fixed?
shlomif[inet6]:$module$ perl -we 'use IO::Socket::INET6' shlomif[inet6]:$module$ perl -Mblib -we 'use IO::Socket::INET6' With: perl-5.14.2-6.mga2 So I think it has been fixed. Resolving. Regards, -- Shlomi Fish