Skip Menu |

This queue is for tickets about the AnyEvent CPAN distribution.

Report information
The Basics
Id: 36434
Status: resolved
Priority: 0/
Queue: AnyEvent

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

Bug Information
Severity: Important
Broken in: 4.12
Fixed in: 4.13



Subject: [PATCH] AnyEvent::DNS + any non-perl backend issue on systems without ipv6
Hi, On my system function socket in AnyEvent/DNS.pm: socket my $fh6, AF_INET6, &Socket::SOCK_DGRAM, 0; makes var $fh6 to true value, but without any fileno, it's works for Impl::Perl (without any bads), but dies in Impl::EV for ex. I'am create copy of core tests (that's shown trouble) for testing with EV, they are can be applied with: cd AnyEvent-4.12; patch -p1 < anyevent-add-evtests.patch And fix, that work for me, was in testing return value of socket, patch can be applied with: cd AnyEvent-4.12; patch -p1 < anyevent-fix.patch OS: FreeBSD 6.2-RELEASE-p1 #1: Thu Feb 15 17:00:27 MSK 2007 amd64 perl -V: Summary of my perl5 (revision 5 version 10 subversion 0) configuration: Platform: osname=freebsd, osvers=6.2-release-p1, archname=amd64-freebsd uname='freebsd zoo.rambler.ru 6.2-release-p1 freebsd 6.2-release-p1 #1: thu feb 15 17:00:27 msk 2007 root@zoo.rambler.ru:usrobjusrsrcsyszoo amd64 ' config_args='-des -Duseshrplib -Uusemymalloc -Dprefix=/spool/home/vovkasm/perl5.10 -Dprivlib=/spool/home/vovkasm/perl5.10/lib/perl5 -Darchlib=/spool/home/vovkasm/perl5.10/lib/perl5 -Dsitelib=/spool/home/vovkasm/perl5.10/lib/perl5 -Dsitearch=/spool/home/vovkasm/perl5.10/lib/perl5 -Dcccdlflags=-DPIC -fPIC -Dlibs=-lm -lcrypt -lutil -lc -Dccflags=-fno-strict-aliasing -O -pipe -Dcf_email=v.timofeev@rambler-co.ru -Dperladmin=v.timofeev@rambler-co.ru -Dloclibpth=/spool/home/vovkasm/perl5.10/lib /usr/local/lib -Dlocincpth=/spool/home/vovkasm/perl5.10/include /usr/local/include -A lddlflags=-L/spool/home/vovkasm/perl5.10/lib -L/usr/local/lib' hint=recommended, useposix=true, d_sigaction=define useithreads=undef, usemultiplicity=undef useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef use64bitint=define, use64bitall=define, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-fno-strict-aliasing -O -pipe -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -I/spool/home/vovkasm/perl5.10/include -I/usr/local/include', optimize='-O', cppflags='-fno-strict-aliasing -O -pipe -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -I/spool/home/vovkasm/perl5.10/include -I/usr/local/include' ccversion='', gccversion='3.4.6 [FreeBSD] 20060305', gccosandvers='' intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='cc', ldflags ='-Wl,-E -L/usr/local/lib' libpth=/usr/lib /usr/local/lib libs=-lm -lcrypt -lutil -lc perllibs=-lm -lcrypt -lutil -lc libc=, so=so, useshrplib=true, libperl=libperl.so gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' -Wl,-R/spool/home/vovkasm/perl5.10/lib/perl5/CORE' cccdlflags='-DPIC -fPIC', lddlflags='-shared -L/spool/home/vovkasm/perl5.10/lib -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: PERL_DONT_CREATE_GVSV PERL_MALLOC_WRAP USE_64_BIT_ALL USE_64_BIT_INT USE_LARGE_FILES USE_PERLIO Built under freebsd Compiled at Feb 22 2008 03:41:49 %ENV: PERL5LIB="/spool/home/vovkasm/module-install-libs:/spool/home/vovkasm/lib/perl" @INC: /spool/home/vovkasm/module-install-libs /spool/home/vovkasm/lib/perl /spool/home/vovkasm/perl5.10/lib/perl5 /spool/home/vovkasm/perl5.10/lib/perl5 .
Subject: anyevent-fix.patch
Binary files AnyEvent-4.12/lib/AnyEvent/.swp and AnyEvent-4.12-fix/lib/AnyEvent/.swp differ diff -urN AnyEvent-4.12/lib/AnyEvent/DNS.pm AnyEvent-4.12-fix/lib/AnyEvent/DNS.pm --- AnyEvent-4.12/lib/AnyEvent/DNS.pm Tue Jun 3 13:02:23 2008 +++ AnyEvent-4.12-fix/lib/AnyEvent/DNS.pm Wed Jun 4 15:45:42 2008 @@ -713,11 +713,10 @@ # try to create a ipv4 and an ipv6 socket # only fail when we cnanot create either - socket my $fh4, AF_INET , &Socket::SOCK_DGRAM, 0; - socket my $fh6, AF_INET6, &Socket::SOCK_DGRAM, 0; + my $is_fh4 = socket( my $fh4, AF_INET , &Socket::SOCK_DGRAM, 0); + my $is_fh6 = socket( my $fh6, AF_INET6, &Socket::SOCK_DGRAM, 0); - $fh4 || $fh6 - or Carp::croak "unable to create either an IPv6 or an IPv4 socket"; + if (!$is_fh4 && !$is_fh6) { Carp::croak "unable to create either an IPv6 or an IPv4 socket"; } my $self = bless { server => [], @@ -735,7 +734,7 @@ Scalar::Util::weaken (my $wself = $self); - if ($fh4) { + if ($is_fh4) { AnyEvent::Util::fh_nonblocking $fh4, 1; $self->{fh4} = $fh4; $self->{rw4} = AnyEvent->io (fh => $fh4, poll => "r", cb => sub { @@ -745,7 +744,7 @@ }); } - if ($fh6) { + if ($is_fh6) { $self->{fh6} = $fh6; AnyEvent::Util::fh_nonblocking $fh6, 1; $self->{rw6} = AnyEvent->io (fh => $fh6, poll => "r", cb => sub {
Subject: anyevent-add-evtests.patch
diff -urN AnyEvent-4.12/Makefile.PL AnyEvent-4.12-tests/Makefile.PL --- AnyEvent-4.12/Makefile.PL Sat May 31 01:37:38 2008 +++ AnyEvent-4.12-tests/Makefile.PL Wed Jun 4 14:47:11 2008 @@ -25,7 +25,7 @@ COMPRESS => 'gzip -9v', SUFFIX => '.gz', }, - test => { TESTS => "t/*.t t/handle/*.t" }, + test => { TESTS => "t/*.t t/handle/*.t t/ev/*.t" }, NAME => "AnyEvent", VERSION_FROM => "lib/AnyEvent.pm", EXTRA_META => q{ Binary files AnyEvent-4.12/t/ev/.00_load.t.swp and AnyEvent-4.12-tests/t/ev/.00_load.t.swp differ Binary files AnyEvent-4.12/t/ev/.01_basic.t.swp and AnyEvent-4.12-tests/t/ev/.01_basic.t.swp differ Binary files AnyEvent-4.12/t/ev/.02_signals.t.swp and AnyEvent-4.12-tests/t/ev/.02_signals.t.swp differ Binary files AnyEvent-4.12/t/ev/.03_child.t.swp and AnyEvent-4.12-tests/t/ev/.03_child.t.swp differ Binary files AnyEvent-4.12/t/ev/.04_condvar.t.swp and AnyEvent-4.12-tests/t/ev/.04_condvar.t.swp differ Binary files AnyEvent-4.12/t/ev/.05_dns.t.swp and AnyEvent-4.12-tests/t/ev/.05_dns.t.swp differ Binary files AnyEvent-4.12/t/ev/.swp and AnyEvent-4.12-tests/t/ev/.swp differ diff -urN AnyEvent-4.12/t/ev/00_load.t AnyEvent-4.12-tests/t/ev/00_load.t --- AnyEvent-4.12/t/ev/00_load.t Thu Jan 1 03:00:00 1970 +++ AnyEvent-4.12-tests/t/ev/00_load.t Wed Jun 4 14:54:56 2008 @@ -0,0 +1,20 @@ +$|=1; +BEGIN { unless (eval "require EV") { print "1..0 # skip because EV isn't installed"; exit } } +BEGIN { print "1..13\n" } + +require AnyEvent; print "ok 1\n"; +require AnyEvent::Impl::EV; print "ok 2\n"; +require AnyEvent::Util; print "ok 3\n"; +require AnyEvent::Handle; print "ok 4\n"; +require AnyEvent::DNS; print "ok 5\n"; + +1 && require AnyEvent::Impl::EV; print "ok 6\n"; +0 && require AnyEvent::Impl::Event; print "ok 7\n"; +0 && require AnyEvent::Impl::EventLib; print "ok 8\n"; +0 && require AnyEvent::Impl::Glib; print "ok 9\n"; +0 && require AnyEvent::Impl::Tk; print "ok 10\n"; +0 && require AnyEvent::Impl::Perl; print "ok 11\n"; +0 && require AnyEvent::Impl::POE; print "ok 12\n"; +0 && require AnyEvent::Impl::Qt; print "ok 13\n"; + + diff -urN AnyEvent-4.12/t/ev/01_basic.t AnyEvent-4.12-tests/t/ev/01_basic.t --- AnyEvent-4.12/t/ev/01_basic.t Thu Jan 1 03:00:00 1970 +++ AnyEvent-4.12-tests/t/ev/01_basic.t Wed Jun 4 14:55:19 2008 @@ -0,0 +1,25 @@ +$|=1; +BEGIN { unless (eval "require EV") { print "1..0 # skip because EV isn't installed"; exit } } +BEGIN { print "1..6\n" } + +use AnyEvent; +use AnyEvent::Impl::EV; + +print "ok 1\n"; + +my $cv = AnyEvent->condvar; + +print "ok 2\n"; + +my $timer1 = AnyEvent->timer (after => 0.1, cb => sub { print "ok 5\n"; $cv->broadcast }); + +print "ok 3\n"; + +AnyEvent->timer (after => 0.01, cb => sub { print "not ok 5\n" }); + +print "ok 4\n"; + +$cv->wait; + +print "ok 6\n"; + diff -urN AnyEvent-4.12/t/ev/02_signals.t AnyEvent-4.12-tests/t/ev/02_signals.t --- AnyEvent-4.12/t/ev/02_signals.t Thu Jan 1 03:00:00 1970 +++ AnyEvent-4.12-tests/t/ev/02_signals.t Wed Jun 4 14:57:39 2008 @@ -0,0 +1,36 @@ +$|=1; +BEGIN { unless (eval "require EV") { print "1..0 # skip because EV isn't installed"; exit } } +BEGIN { + print "1..5\n"; +} + +use AnyEvent; +use AnyEvent::Impl::EV; + +print "ok 1\n"; + +my $cv = AnyEvent->condvar; + +my $error = AnyEvent->timer (after => 5, cb => sub { + print <<EOF; +Bail out! No signal caught. +EOF + exit 0; +}); + +my $sw = AnyEvent->signal (signal => 'INT', cb => sub { + print "ok 3\n"; + $cv->broadcast; +}); + +print "ok 2\n"; +kill 'INT', $$; +$cv->wait; +undef $error; + +print "ok 4\n"; + +undef $sw; + +print "ok 5\n"; + diff -urN AnyEvent-4.12/t/ev/03_child.t AnyEvent-4.12-tests/t/ev/03_child.t --- AnyEvent-4.12/t/ev/03_child.t Thu Jan 1 03:00:00 1970 +++ AnyEvent-4.12-tests/t/ev/03_child.t Wed Jun 4 14:58:12 2008 @@ -0,0 +1,76 @@ +$|=1; +BEGIN { unless (eval "require EV") { print "1..0 # skip because EV isn't installed"; exit } } + +BEGIN { + # check for broken perls + if ($^O =~ /mswin32/i) { + my $ok; + local $SIG{CHLD} = sub { $ok = 1 }; + kill 'CHLD', 0; + + unless ($ok) { + print <<EOF; +1..0 # Your perl interpreter is badly BROKEN. Child watchers will not work, ever. Try upgrading to a newer perl or a working perl (cygwin's perl is known to work). If that is not an option, you should be able to use the remaining functionality of AnyEvent, but child watchers WILL NOT WORK. +EOF + exit 0; + } + } +} + +BEGIN { + print "1..7\n" +} + +use AnyEvent; +use AnyEvent::Impl::EV; + +print "ok 1\n"; + +AnyEvent::detect; # force-load event model + +my $pid = fork; + +defined $pid or die "unable to fork"; + +# work around Tk bug until it has been fixed. +#my $timer = AnyEvent->timer (after => 2, cb => sub { }); + +my $cv = AnyEvent->condvar; + +unless ($pid) { + print "ok 2\n"; + exit 3; +} + +my $w = AnyEvent->child (pid => $pid, cb => sub { + print $pid == $_[0] ? "" : "not ", "ok 3\ # $pid == $_[0]\n"; + print 3 == ($_[1] >> 8) ? "" : "not ", "ok 4 # 3 == $_[1] >> 8 ($_[1])\n"; + $cv->broadcast; +}); + +$cv->wait; + +my $pid2 = fork || exit 7; + +my $cv2 = AnyEvent->condvar; + +my $w2 = AnyEvent->child (pid => 0, cb => sub { + print $pid2 == $_[0] ? "" : "not ", "ok 5 # $pid2 == $_[0]\n"; + print 7 == ($_[1] >> 8) ? "" : "not ", "ok 6 # 7 == $_[1] >> 8 ($_[1])\n"; + $cv2->broadcast; +}); + +my $error = AnyEvent->timer (after => 5, cb => sub { + print <<EOF; +Bail out! No child exit detected. This is either a bug in AnyEvent or a bug in your Perl (mostly some windows distributions suffer from that): child watchers might not work properly on this platform. You can force installation of this module if you do not rely on child watchers, or you could upgrade to a working version of Perl for your platform.\n"; +EOF + exit 0; +}); + +$cv2->wait; + +print "ok 7\n"; + + + + diff -urN AnyEvent-4.12/t/ev/04_condvar.t AnyEvent-4.12-tests/t/ev/04_condvar.t --- AnyEvent-4.12/t/ev/04_condvar.t Thu Jan 1 03:00:00 1970 +++ AnyEvent-4.12-tests/t/ev/04_condvar.t Wed Jun 4 14:58:52 2008 @@ -0,0 +1,76 @@ +$|=1; +BEGIN { unless (eval "require EV") { print "1..0 # skip because EV isn't installed"; exit } } +BEGIN { + print "1..21\n" +} + +use AnyEvent; +use AnyEvent::Impl::EV; + +print "ok 1\n"; + +{ + my $cv = AnyEvent->condvar; + + $cv->cb (sub { + print $_[0]->ready ? "" : "not ", "ok 4\n"; + + my $x = $_[0]->recv; + print $x == 7 ? "" : "not ", "ok 5 # $x == 7\n"; + + my @x = $_[0]->recv; + print $x[1] == 5 ? "" : "not ", "ok 6 # $x[1] == 5\n"; + + my $y = $cv->recv; + print $y == 7 ? "" : "not ", "ok 7 # $x == 7\n"; + }); + + my $t = AnyEvent->timer (after => 0, cb => sub { + print "ok 3\n"; + $cv->send (7, 5); + }); + + print "ok 2\n"; + $cv->wait; + print "ok 8\n"; + + my @x = $cv->recv; + print $x[1] == 5 ? "" : "not ", "ok 9 # $x[1] == 5\n"; +} + +{ + my $cv = AnyEvent->condvar; + + $cv->cb (sub { + print $_[0]->ready ? "" : "not ", "ok 12\n"; + + my $x = eval { $_[0]->recv }; + print !defined $x ? "" : "not ", "ok 13\n"; + print $@ =~ /^kill/ ? "" : "not ", "ok 14 # $@\n"; + }); + + my $t = AnyEvent->timer (after => 0, cb => sub { + print "ok 11\n"; + $cv->croak ("kill"); + print "ok 15\n"; + $cv->send (8, 6, 4); + print "ok 16\n"; + }); + + print "ok 10\n"; + my @x = eval { $cv->recv }; + print !@x ? "" : "not ", "ok 17 # @x\n"; + print $@ =~ /^kill / ? "" : "not ", "ok 18 # $@\n"; +} + +{ + my $cv = AnyEvent->condvar; + + print "ok 19\n"; + my $t = AnyEvent->timer (after => 0, cb => $cv); + + print "ok 20\n"; + $cv->recv; + print "ok 21\n"; +} + diff -urN AnyEvent-4.12/t/ev/05_dns.t AnyEvent-4.12-tests/t/ev/05_dns.t --- AnyEvent-4.12/t/ev/05_dns.t Thu Jan 1 03:00:00 1970 +++ AnyEvent-4.12-tests/t/ev/05_dns.t Wed Jun 4 14:59:08 2008 @@ -0,0 +1,33 @@ +$|=1; +BEGIN { unless (eval "require EV") { print "1..0 # skip because EV isn't installed"; exit } } +BEGIN { print "1..5\n" } + +# we avoid complicated tests here because some systems will +# not have working DNS + +use AnyEvent::Impl::EV; +use AnyEvent::DNS; + +print "ok 1\n"; + +AnyEvent::DNS::resolver; + +print "ok 2\n"; + +# make sure we timeout faster +AnyEvent::DNS::resolver->{timeout} = [0.5]; +AnyEvent::DNS::resolver->_compile; + +print "ok 3\n"; + +my $cv = AnyEvent->condvar; + +AnyEvent::DNS::a "www.google.de", sub { + print "ok 4 # www.google.de => @_\n"; + $cv->send; +}; + +$cv->recv; + +print "ok 5\n"; +
CC: undisclosed-recipients: ;
Subject: Re: [rt.cpan.org #36434] [PATCH] AnyEvent::DNS + any non-perl backend issue on systems without ipv6
Date: Wed, 4 Jun 2008 22:50:53 +0200
To: Vladimir Timofeev via RT <bug-AnyEvent [...] rt.cpan.org>
From: Marc Lehmann <schmorp [...] schmorp.de>
Hi, your report might get be ignored when sent to rt.cpan.org and not the official contact address mentioned in the module documentation. Please close your report again and use the contact address from the module documentation to report any issues. If this is an inconvenience to you please consider petitioning the rt.cpan.org authors to make their service optional and not enforced, so this inconvenience can be avoided in the future. (Note that rt.cpan.org creates little gain and a lot of work for the maintainers, who, after all, provide their modules as a free service). Thanks a lot, Marc Lehmann <schmorp@schmorp.de>
I delete this report because of module's author request. This request should be sent directly to the author of AnyEvent module.