r32379 - in /trunk/libanyevent-perl: Changes META.yml Makefile.PL README debian/changelog lib/AnyEvent.pm lib/AnyEvent/DNS.pm lib/AnyEvent/Handle.pm lib/AnyEvent/Impl/Perl.pm lib/AnyEvent/Socket.pm lib/AnyEvent/Strict.pm lib/AnyEvent/Util.pm

gregoa at users.alioth.debian.org gregoa at users.alioth.debian.org
Sun Mar 29 13:44:07 UTC 2009


Author: gregoa
Date: Sun Mar 29 13:44:02 2009
New Revision: 32379

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=32379
Log:
New upstream release.

Modified:
    trunk/libanyevent-perl/Changes
    trunk/libanyevent-perl/META.yml
    trunk/libanyevent-perl/Makefile.PL
    trunk/libanyevent-perl/README
    trunk/libanyevent-perl/debian/changelog
    trunk/libanyevent-perl/lib/AnyEvent.pm
    trunk/libanyevent-perl/lib/AnyEvent/DNS.pm
    trunk/libanyevent-perl/lib/AnyEvent/Handle.pm
    trunk/libanyevent-perl/lib/AnyEvent/Impl/Perl.pm
    trunk/libanyevent-perl/lib/AnyEvent/Socket.pm
    trunk/libanyevent-perl/lib/AnyEvent/Strict.pm
    trunk/libanyevent-perl/lib/AnyEvent/Util.pm

Modified: trunk/libanyevent-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/Changes?rev=32379&op=diff
==============================================================================
--- trunk/libanyevent-perl/Changes (original)
+++ trunk/libanyevent-perl/Changes Sun Mar 29 13:44:02 2009
@@ -1,4 +1,17 @@
 Revision history for Perl extension AnyEvent.
+
+4.35  Fri Mar 27 11:48:20 CET 2009
+        - event models relying on AnyEvent's signal watcher emulation did
+          invoke the callback asynchronously, contradicting documentation
+          and causing signals to get lost (this includes AnyEvent's own
+          event loop). AnyEvent now uses the standard pipe trick to make
+          callback execution synchronous to the event loop.
+        - AnyEvent::Handle didn't free TLS context data on DESTROY
+          (patch by Pavel Shaydo).
+        - work around the ever-incompatibly-changing API of MakeMaker.
+        - document that changing global variables without restoring them
+          is a bad idea in Perl (noted by Adam Rosenstein).
+        - AnyEvent::Strict now barfs if ->io is passed a file.
 
 4.34  Thu Feb 12 18:32:45 CET 2009
 	- separately buffer TLS read data, as otherwise the read queue could

Modified: trunk/libanyevent-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/META.yml?rev=32379&op=diff
==============================================================================
--- trunk/libanyevent-perl/META.yml (original)
+++ trunk/libanyevent-perl/META.yml Sun Mar 29 13:44:02 2009
@@ -1,20 +1,24 @@
 --- #YAML:1.0
-name:                AnyEvent
-version:             4.34
-abstract:            ~
-license:             ~
-author:              ~
-generated_by:        ExtUtils::MakeMaker version 6.42
-distribution_type:   module
-requires:     
+name:               AnyEvent
+version:            4.35
+abstract:           ~
+author:  []
+license:            unknown
+distribution_type:  module
+configure_requires:
+    ExtUtils::MakeMaker:  0
+requires:  {}
+no_index:
+    directory:
+        - t
+        - inc
+generated_by:       ExtUtils::MakeMaker version 6.48
 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
 recommends:
-  Net::SSLeay: 1.32
-  JSON: 2.09
-  JSON::XS 2.2
-  EV: 4.05
-  Guard: 0.5
-    
+    EV:           4.05
+    Guard:        0.5
+    JSON:         2.09
+    JSON::XS:     2.2
+    Net::SSLeay:  1.32

Modified: trunk/libanyevent-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/Makefile.PL?rev=32379&op=diff
==============================================================================
--- trunk/libanyevent-perl/Makefile.PL (original)
+++ trunk/libanyevent-perl/Makefile.PL Sun Mar 29 13:44:02 2009
@@ -28,13 +28,14 @@
     test         => { TESTS => "t/*.t t/handle/*.t" },
     NAME         => "AnyEvent",
     VERSION_FROM => "lib/AnyEvent.pm",
-    EXTRA_META => q{
-recommends:
-  Net::SSLeay: 1.32
-  JSON: 2.09
-  JSON::XS 2.2
-  EV: 4.05
-  Guard: 0.5
+    META_MERGE => {
+        recommends => {
+           "Net::SSLeay" => 1.32,
+           "JSON"        => 2.09,
+           "JSON::XS"    => 2.2,
+           "EV"          => 4.05,
+           "Guard"       => 0.5,
+        }
     },
 );
 

Modified: trunk/libanyevent-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/README?rev=32379&op=diff
==============================================================================
--- trunk/libanyevent-perl/README (original)
+++ trunk/libanyevent-perl/README Sun Mar 29 13:44:02 2009
@@ -134,6 +134,12 @@
     callback when the event occurs (of course, only when the event model is
     in control).
 
+    Note that callbacks must not permanently change global variables
+    potentially in use by the event loop (such as $_ or $[) and that
+    callbacks must not "die". The former is good programming practise in
+    Perl and the latter stems from the fact that exception handling differs
+    widely between event loops.
+
     To disable the watcher you have to destroy it (e.g. by setting the
     variable you store it in to "undef" or otherwise deleting all references
     to it).
@@ -158,11 +164,17 @@
     You can create an I/O watcher by calling the "AnyEvent->io" method with
     the following mandatory key-value pairs as arguments:
 
-    "fh" the Perl *file handle* (*not* file descriptor) to watch for events
-    (AnyEvent might or might not keep a reference to this file handle).
+    "fh" is the Perl *file handle* (*not* file descriptor) to watch for
+    events (AnyEvent might or might not keep a reference to this file
+    handle). Note that only file handles pointing to things for which
+    non-blocking operation makes sense are allowed. This includes sockets,
+    most character devices, pipes, fifos and so on, but not for example
+    files or block devices.
+
     "poll" must be a string that is either "r" or "w", which creates a
-    watcher waiting for "r"eadable or "w"ritable events, respectively. "cb"
-    is the callback to invoke each time the file handle becomes ready.
+    watcher waiting for "r"eadable or "w"ritable events, respectively.
+
+    "cb" is the callback to invoke each time the file handle becomes ready.
 
     Although the callback might get passed parameters, their value and
     presence is undefined and you cannot rely on them. Portable AnyEvent
@@ -872,8 +884,8 @@
 
         This variable can effectively be used for denial-of-service attacks
         against local programs (e.g. when setuid), although the impact is
-        likely small, as the program has to handle connection errors
-        already-
+        likely small, as the program has to handle conenction and other
+        failures anyways.
 
         Examples: "PERL_ANYEVENT_PROTOCOLS=ipv4,ipv6" - prefer IPv4 over
         IPv6, but support both and try to use both.
@@ -1389,7 +1401,7 @@
     Perl 5.8 has numerous memleaks that sometimes hit this module and are
     hard to work around. If you suffer from memleaks, first upgrade to Perl
     5.10 and check wether the leaks still show up. (Perl 5.10.0 has other
-    annoying mamleaks, such as leaking on "map" and "grep" but it is usually
+    annoying memleaks, such as leaking on "map" and "grep" but it is usually
     not as pronounced).
 
 SEE ALSO

Modified: trunk/libanyevent-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/debian/changelog?rev=32379&op=diff
==============================================================================
--- trunk/libanyevent-perl/debian/changelog (original)
+++ trunk/libanyevent-perl/debian/changelog Sun Mar 29 13:44:02 2009
@@ -1,3 +1,9 @@
+libanyevent-perl (4.350-1) UNRELEASED; urgency=low
+
+  * New upstream release.
+
+ -- gregor herrmann <gregoa at debian.org>  Sun, 29 Mar 2009 15:42:52 +0200
+
 libanyevent-perl (4.340-1) unstable; urgency=low
 
   [ Martín Ferrari ]

Modified: trunk/libanyevent-perl/lib/AnyEvent.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/lib/AnyEvent.pm?rev=32379&op=diff
==============================================================================
--- trunk/libanyevent-perl/lib/AnyEvent.pm (original)
+++ trunk/libanyevent-perl/lib/AnyEvent.pm Sun Mar 29 13:44:02 2009
@@ -139,6 +139,12 @@
 callback when the event occurs (of course, only when the event model
 is in control).
 
+Note that B<callbacks must not permanently change global variables>
+potentially in use by the event loop (such as C<$_> or C<$[>) and that B<<
+callbacks must not C<die> >>. The former is good programming practise in
+Perl and the latter stems from the fact that exception handling differs
+widely between event loops.
+
 To disable the watcher you have to destroy it (e.g. by setting the
 variable you store it in to C<undef> or otherwise deleting all references
 to it).
@@ -164,11 +170,17 @@
 You can create an I/O watcher by calling the C<< AnyEvent->io >> method
 with the following mandatory key-value pairs as arguments:
 
-C<fh> the Perl I<file handle> (I<not> file descriptor) to watch for events
-(AnyEvent might or might not keep a reference to this file handle). C<poll>
-must be a string that is either C<r> or C<w>, which creates a watcher
-waiting for "r"eadable or "w"ritable events, respectively. C<cb> is the
-callback to invoke each time the file handle becomes ready.
+C<fh> is the Perl I<file handle> (I<not> file descriptor) to watch
+for events (AnyEvent might or might not keep a reference to this file
+handle). Note that only file handles pointing to things for which
+non-blocking operation makes sense are allowed. This includes sockets,
+most character devices, pipes, fifos and so on, but not for example files
+or block devices.
+
+C<poll> must be a string that is either C<r> or C<w>, which creates a
+watcher waiting for "r"eadable or "w"ritable events, respectively.
+
+C<cb> is the callback to invoke each time the file handle becomes ready.
 
 Although the callback might get passed parameters, their value and
 presence is undefined and you cannot rely on them. Portable AnyEvent
@@ -863,7 +875,7 @@
 
 use Carp;
 
-our $VERSION = 4.34;
+our $VERSION = 4.35;
 our $MODEL;
 
 our $AUTOLOAD;
@@ -1006,8 +1018,6 @@
 sub _dupfh($$$$) {
    my ($poll, $fh, $r, $w) = @_;
 
-   require Fcntl;
-
    # cygwin requires the fh mode to be matching, unix doesn't
    my ($rw, $mode) = $poll eq "r" ? ($r, "<")
                    : $poll eq "w" ? ($w, ">")
@@ -1045,17 +1055,47 @@
 
 # default implementation for ->signal
 
-our %SIG_CB;
+our ($SIGPIPE_R, $SIGPIPE_W, %SIG_CB, %SIG_EV, $SIG_IO);
+
+sub _signal_exec {
+   sysread $SIGPIPE_R, my $dummy, 4;
+
+   while (%SIG_EV) {
+      for (keys %SIG_EV) {
+         delete $SIG_EV{$_};
+         $_->() for values %{ $SIG_CB{$_} || {} };
+      }
+   }
+}
 
 sub signal {
    my (undef, %arg) = @_;
 
+   unless ($SIGPIPE_R) {
+      if (AnyEvent::WIN32) {
+         ($SIGPIPE_R, $SIGPIPE_W) = AnyEvent::Util::portable_pipe ();
+         AnyEvent::Util::fh_nonblocking ($SIGPIPE_R) if $SIGPIPE_R;
+         AnyEvent::Util::fh_nonblocking ($SIGPIPE_W) if $SIGPIPE_W; # just in case
+      } else {
+         pipe $SIGPIPE_R, $SIGPIPE_W;
+         require Fcntl;
+         fcntl $SIGPIPE_R, &Fcntl::F_SETFL, &Fcntl::O_NONBLOCK if $SIGPIPE_R;
+         fcntl $SIGPIPE_W, &Fcntl::F_SETFL, &Fcntl::O_NONBLOCK if $SIGPIPE_W; # just in case
+      }
+
+      $SIGPIPE_R
+         or Carp::croak "AnyEvent: unable to create a signal reporting pipe: $!\n";
+
+      $SIG_IO = AnyEvent->io (fh => $SIGPIPE_R, poll => "r", cb => \&_signal_exec);
+   }
+
    my $signal = uc $arg{signal}
       or Carp::croak "required option 'signal' is missing";
 
    $SIG_CB{$signal}{$arg{cb}} = $arg{cb};
    $SIG{$signal} ||= sub {
-      $_->() for values %{ $SIG_CB{$signal} || {} };
+      syswrite $SIGPIPE_W, "\x00", 1 unless %SIG_EV;
+      undef $SIG_EV{$signal};
    };
 
    bless [$signal, $arg{cb}], "AnyEvent::Base::Signal"
@@ -1265,7 +1305,7 @@
 
 This variable can effectively be used for denial-of-service attacks
 against local programs (e.g. when setuid), although the impact is likely
-small, as the program has to handle connection errors already-
+small, as the program has to handle conenction and other failures anyways.
 
 Examples: C<PERL_ANYEVENT_PROTOCOLS=ipv4,ipv6> - prefer IPv4 over IPv6,
 but support both and try to use both.  C<PERL_ANYEVENT_PROTOCOLS=ipv4>
@@ -1829,7 +1869,7 @@
 Perl 5.8 has numerous memleaks that sometimes hit this module and are hard
 to work around. If you suffer from memleaks, first upgrade to Perl 5.10
 and check wether the leaks still show up. (Perl 5.10.0 has other annoying
-mamleaks, such as leaking on C<map> and C<grep> but it is usually not as
+memleaks, such as leaking on C<map> and C<grep> but it is usually not as
 pronounced).
 
 

Modified: trunk/libanyevent-perl/lib/AnyEvent/DNS.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/lib/AnyEvent/DNS.pm?rev=32379&op=diff
==============================================================================
--- trunk/libanyevent-perl/lib/AnyEvent/DNS.pm (original)
+++ trunk/libanyevent-perl/lib/AnyEvent/DNS.pm Sun Mar 29 13:44:02 2009
@@ -37,7 +37,7 @@
 use AnyEvent::Handle ();
 use AnyEvent::Util qw(AF_INET6);
 
-our $VERSION = 4.34;
+our $VERSION = 4.35;
 
 our @DNS_FALLBACK = (v208.67.220.220, v208.67.222.222);
 

Modified: trunk/libanyevent-perl/lib/AnyEvent/Handle.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/lib/AnyEvent/Handle.pm?rev=32379&op=diff
==============================================================================
--- trunk/libanyevent-perl/lib/AnyEvent/Handle.pm (original)
+++ trunk/libanyevent-perl/lib/AnyEvent/Handle.pm Sun Mar 29 13:44:02 2009
@@ -16,7 +16,7 @@
 
 =cut
 
-our $VERSION = 4.34;
+our $VERSION = 4.35;
 
 =head1 SYNOPSIS
 
@@ -1475,7 +1475,7 @@
 }
 
 sub DESTROY {
-   my $self = shift;
+   my ($self) = @_;
 
    &_freetls;
 

Modified: trunk/libanyevent-perl/lib/AnyEvent/Impl/Perl.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/lib/AnyEvent/Impl/Perl.pm?rev=32379&op=diff
==============================================================================
--- trunk/libanyevent-perl/lib/AnyEvent/Impl/Perl.pm (original)
+++ trunk/libanyevent-perl/lib/AnyEvent/Impl/Perl.pm Sun Mar 29 13:44:02 2009
@@ -91,7 +91,7 @@
 use AnyEvent ();
 use AnyEvent::Util ();
 
-our $VERSION = 4.34;
+our $VERSION = 4.35;
 
 our ($NOW, $MNOW);
 

Modified: trunk/libanyevent-perl/lib/AnyEvent/Socket.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/lib/AnyEvent/Socket.pm?rev=32379&op=diff
==============================================================================
--- trunk/libanyevent-perl/lib/AnyEvent/Socket.pm (original)
+++ trunk/libanyevent-perl/lib/AnyEvent/Socket.pm Sun Mar 29 13:44:02 2009
@@ -59,7 +59,7 @@
    tcp_connect
 );
 
-our $VERSION = 4.34;
+our $VERSION = 4.35;
 
 =item $ipn = parse_ipv4 $dotted_quad
 

Modified: trunk/libanyevent-perl/lib/AnyEvent/Strict.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/lib/AnyEvent/Strict.pm?rev=32379&op=diff
==============================================================================
--- trunk/libanyevent-perl/lib/AnyEvent/Strict.pm (original)
+++ trunk/libanyevent-perl/lib/AnyEvent/Strict.pm Sun Mar 29 13:44:02 2009
@@ -45,6 +45,8 @@
  
    defined fileno $arg{fh}
       or croak "AnyEvent->io called with illegal fh argument '$arg{fh}'";
+   -f $arg{fh}
+      and croak "AnyEvent->io called with fh argument pointing to a file";
    delete $arg{fh};
  
    $arg{poll} =~ /^[rw]$/

Modified: trunk/libanyevent-perl/lib/AnyEvent/Util.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-perl/lib/AnyEvent/Util.pm?rev=32379&op=diff
==============================================================================
--- trunk/libanyevent-perl/lib/AnyEvent/Util.pm (original)
+++ trunk/libanyevent-perl/lib/AnyEvent/Util.pm Sun Mar 29 13:44:02 2009
@@ -34,7 +34,7 @@
 our @EXPORT = qw(fh_nonblocking guard fork_call portable_pipe portable_socketpair);
 our @EXPORT_OK = qw(AF_INET6 WSAEWOULDBLOCK WSAEINPROGRESS WSAEINVAL WSAWOULDBLOCK);
 
-our $VERSION = 4.34;
+our $VERSION = 4.35;
 
 BEGIN {
    my $posix = 1 * eval { local $SIG{__DIE__}; require POSIX };




More information about the Pkg-perl-cvs-commits mailing list