Skip Menu |

This queue is for tickets about the perl-ldap CPAN distribution.

Report information
The Basics
Id: 93122
Status: resolved
Priority: 0/
Queue: perl-ldap

People
Owner: Nobody in particular
Requestors: direkt1 [...] wolframhumann.de
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.58
Fixed in: 0.60



Subject: Net::LDAP and IO::Socket::INET6 don't cooperate in strawberry perl
Sorry I'm unable to establish if this is a bug in Net::LDAP or in IO::Socket::INET6. Previously working simple LDAP (precisely: Net::LDAP::Express) lookup script doesn't work anymore since updating to an newer Strawberry Perl. Error is "Bad file descriptor". It has been suggested in several places to remove or rename INET6.pm, and indeed this fixes the problem. References: https://rt.cpan.org/Public/Bug/Display.html?id=83967 http://forums.otterhub.org/viewtopic.php?f=81&t=22849 (which includes a reference to http://bugs.otrs.org/show_bug.cgi?id=10004) Code to reproduce "Bad file descriptor" message is e.g. first half of Net::LDAP Synopsis.
RT-Send-CC: direkt1 [...] wolframhumann.de
Hi, On Tue Feb 18 08:11:56 2014, whumann wrote: Show quoted text
> Sorry I'm unable to establish if this is a bug in Net::LDAP or in > IO::Socket::INET6.
Nor me. To me that sounds supiciously like a regression in Strawberry Perl. Show quoted text
> Previously working simple LDAP (precisely: Net::LDAP::Express) lookup > script doesn't work anymore since updating to an newer Strawberry > Perl.
If everything worked before the update of Strawberry Perl and now it doesn't, this sounds to me like a regression in Strawberry Perl, which should be fixed there. Show quoted text
> Error is "Bad file descriptor". It has been suggested in several > places to remove or rename INET6.pm, and indeed this fixes the > problem. References: > https://rt.cpan.org/Public/Bug/Display.html?id=83967 > http://forums.otterhub.org/viewtopic.php?f=81&t=22849 (which includes > a reference to http://bugs.otrs.org/show_bug.cgi?id=10004)
That sounds more like workaround than a solution. By removing IO:Socket::INET6 you sacrifice IPv6 for lots of Perl tools. My may try the attached patch from my private repo. If It is installed, it prefers IO::Socket::IP over IO::Socket::INET6. Pro: * IPv6 continues to work Con * Net::LDAP option Timeout ignored Please report feedback
Subject: perl-ldap_with_IO-Socket-IP.patch
commit 14880990bcdb6ea059628c2a01e714f3479360df Author: Peter Marschall <peter@adpm.de> Date: Sat Jun 8 18:46:14 2013 +0200 LDAP.pm: prefer IO::Socket::IP over IO::Socket::INET6 Check whether IO::Socket::IP 0.20 or higher exists, and if it does use it to create IPv6 & IPv4 sockets. Otherwise, check for IO::Socket::INET6 and use it when it is available for both, IPv4 & IPv6 socketr In all other cases, support IPv4 only using IO::socket::INET. diff --git a/lib/Net/LDAP.pm b/lib/Net/LDAP.pm index f03190e..eb4c623 100644 --- a/lib/Net/LDAP.pm +++ b/lib/Net/LDAP.pm @@ -28,7 +28,12 @@ use Net::LDAP::Constant qw(LDAP_SUCCESS LDAP_UNAVAILABLE ); -use constant CAN_IPV6 => eval { require IO::Socket::INET6 } ? 1 : 0; +# check for IPv6 support: prefer IO::Socket::IP 0.20+ over IO::Socket::INET6 +use constant CAN_IPV6 => eval { require IO::Socket::IP; IO::Socket::IP->VERSION(0.20); } + ? 'IO::Socket::IP' + : eval { require IO::Socket::INET6; } + ? 'IO::Socket::INET6' + : ''; our $VERSION = '0.58'; our @ISA = qw(Tie::StdHash Net::LDAP::Extra); @@ -141,7 +146,7 @@ sub new { sub connect_ldap { my ($ldap, $host, $arg) = @_; my $port = $arg->{port} || 389; - my $class = (CAN_IPV6) ? 'IO::Socket::INET6' : 'IO::Socket::INET'; + my $class = (CAN_IPV6) ? CAN_IPV6 : 'IO::Socket::INET'; my $domain = $arg->{inet4} ? AF_INET : ($arg->{inet6} ? AF_INET6 : AF_UNSPEC); # separate port from host overwriting given/default port
Subject: Re: [rt.cpan.org #93122] Net::LDAP and IO::Socket::INET6 don't cooperate in strawberry perl
Date: Thu, 06 Mar 2014 21:40:45 +0100
To: bug-perl-ldap [...] rt.cpan.org
From: Wolfram Humann <wolfram.humann [...] gmail.com>
Hi, couldn't test your patch so far (I'm not unixy enough to be a regular patchfile user...) but checked something else: It's not really a regression in Strawberry Perl itself, it's just that IO::Socket::INET6 wasn't included in the distribution prior to version 5.16.2.2. When I installed IO::Socket::INET6 into an old Strawberry Perl 5.12.x it showed the same symptoms. Will report again once I've tested with your patch applied but may be a couple of days before that happens. Wolfram On 04.03.2014 18:41, Peter Marschall via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=93122 > > > Hi, > > On Tue Feb 18 08:11:56 2014, whumann wrote:
>> Sorry I'm unable to establish if this is a bug in Net::LDAP or in >> IO::Socket::INET6.
> Nor me. To me that sounds supiciously like a regression in Strawberry Perl. >
>> Previously working simple LDAP (precisely: Net::LDAP::Express) lookup >> script doesn't work anymore since updating to an newer Strawberry >> Perl.
> If everything worked before the update of Strawberry Perl and now it doesn't, this sounds to me like a regression in Strawberry Perl, > which should be fixed there. >
>> Error is "Bad file descriptor". It has been suggested in several >> places to remove or rename INET6.pm, and indeed this fixes the >> problem. References: >> https://rt.cpan.org/Public/Bug/Display.html?id=83967 >> http://forums.otterhub.org/viewtopic.php?f=81&t=22849 (which includes >> a reference to http://bugs.otrs.org/show_bug.cgi?id=10004)
> That sounds more like workaround than a solution. > By removing IO:Socket::INET6 you sacrifice IPv6 for lots of Perl tools. > > My may try the attached patch from my private repo. > If It is installed, it prefers IO::Socket::IP over IO::Socket::INET6. > Pro: > * IPv6 continues to work > Con > * Net::LDAP option Timeout ignored > > Please report feedback > > >
Already wanted to report that the patch didn't help when I realized that I had IO::Socket::IP 0.17 installed. After upgrading to 0.29 the error was indeed gone with a patched LDAP.pm. In a separate attempt I added "use warnings" to LDAP.pm (any specific reason it's not there???) in a scenario where the error was still present and got: syswrite() on unopened filehandle GEN0 at C:/strawberry5.12_32bit_portable/perl/site/lib/Net/LDAP.pm line 868 (I *think* that's line 863 in an unpatched LDAP.pm) Does that give you any clue?
Hi, On Fri Mar 07 08:44:19 2014, whumann wrote: Show quoted text
> Already wanted to report that the patch didn't help when I realized > that I had IO::Socket::IP 0.17 installed. After upgrading to 0.29 the > error was indeed gone with a patched LDAP.pm.
Good to hear! Show quoted text
> In a separate attempt I added "use warnings" to LDAP.pm (any specific > reason it's not there???) in a scenario where the error was still > present and got: > > syswrite() on unopened filehandle GEN0 at > C:/strawberry5.12_32bit_portable/perl/site/lib/Net/LDAP.pm line 868 > > (I *think* that's line 863 in an unpatched LDAP.pm) Does that give you > any clue?
Yes, that recent versions of Strawberry Perl somehow broke code that worked for a decade ;-) Anyway, I included the patch I sent to you into perl-ldap 0.60, which is currently being processed by CPAN. So I consider the issue fixed.