Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package perl-Future-IO for openSUSE:Factory 
checked in at 2023-10-29 19:41:20
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Future-IO (Old)
 and      /work/SRC/openSUSE:Factory/.perl-Future-IO.new.17445 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "perl-Future-IO"

Sun Oct 29 19:41:20 2023 rev:5 rq:1120851 version:0.150.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-Future-IO/perl-Future-IO.changes    
2023-05-12 20:35:28.545270079 +0200
+++ /work/SRC/openSUSE:Factory/.perl-Future-IO.new.17445/perl-Future-IO.changes 
2023-10-29 19:41:35.910935884 +0100
@@ -1,0 +2,13 @@
+Thu Oct 19 03:07:08 UTC 2023 - Tina Müller <[email protected]>
+
+- updated to 0.15
+   see /usr/share/doc/packages/perl-Future-IO/Changes
+
+  0.15    2023-10-18
+          [BUGFIXES]
+           * Avoid creating a long `->then` chain of Futures when handling
+             EAGAIN (RT150117)
+           * Temporarily enable blocking mode on filehandles when the default
+             event loop is not using `select()`, to avoid a CPU spin (RT150117)
+
+-------------------------------------------------------------------

Old:
----
  Future-IO-0.14.tar.gz

New:
----
  Future-IO-0.15.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ perl-Future-IO.spec ++++++
--- /var/tmp/diff_new_pack.wxWNOK/_old  2023-10-29 19:41:36.922972702 +0100
+++ /var/tmp/diff_new_pack.wxWNOK/_new  2023-10-29 19:41:36.922972702 +0100
@@ -18,23 +18,29 @@
 
 %define cpan_name Future-IO
 Name:           perl-Future-IO
-Version:        0.14
+Version:        0.150.0
 Release:        0
+%define cpan_version 0.15
 License:        Artistic-1.0 OR GPL-1.0-or-later
 Summary:        Future-returning IO methods
 URL:            https://metacpan.org/release/%{cpan_name}
-Source0:        
https://cpan.metacpan.org/authors/id/P/PE/PEVANS/%{cpan_name}-%{version}.tar.gz
+Source0:        
https://cpan.metacpan.org/authors/id/P/PE/PEVANS/%{cpan_name}-%{cpan_version}.tar.gz
 Source1:        cpanspec.yml
 BuildArch:      noarch
 BuildRequires:  perl
 BuildRequires:  perl-macros
 BuildRequires:  perl(Future)
-BuildRequires:  perl(Module::Build) >= 0.400400
+BuildRequires:  perl(Module::Build) >= 0.4004
 BuildRequires:  perl(Struct::Dumb)
 BuildRequires:  perl(Test2::V0)
+BuildRequires:  perl(Test::ExpectAndCheck) >= 0.60.0
 BuildRequires:  perl(Test::Future::IO::Impl)
 Requires:       perl(Future)
 Requires:       perl(Struct::Dumb)
+Provides:       perl(Future::IO) = 0.150.0
+Provides:       perl(Future::IO::ImplBase) = 0.150.0
+Provides:       perl(Future::IO::System) = 0.150.0
+%define         __perllib_provides /bin/true
 %{perl_requires}
 
 %description
@@ -48,17 +54,17 @@
 implementation of these operations.
 
 %prep
-%autosetup  -n %{cpan_name}-%{version}
+%autosetup  -n %{cpan_name}-%{cpan_version}
 
 %build
-perl Build.PL installdirs=vendor
-./Build build flags=%{?_smp_mflags}
+perl Build.PL --installdirs=vendor
+./Build build --flags=%{?_smp_mflags}
 
 %check
 ./Build test
 
 %install
-./Build install destdir=%{buildroot} create_packlist=0
+./Build install --destdir=%{buildroot} --create_packlist=0
 %perl_gen_filelist
 
 %files -f %{name}.files

++++++ Future-IO-0.14.tar.gz -> Future-IO-0.15.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Future-IO-0.14/.editorconfig 
new/Future-IO-0.15/.editorconfig
--- old/Future-IO-0.14/.editorconfig    1970-01-01 01:00:00.000000000 +0100
+++ new/Future-IO-0.15/.editorconfig    2023-10-18 19:14:10.000000000 +0200
@@ -0,0 +1,4 @@
+root = true
+
+[*.{pm,pl,t}]
+indent_size = 3
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Future-IO-0.14/Build.PL new/Future-IO-0.15/Build.PL
--- old/Future-IO-0.14/Build.PL 2023-04-25 14:04:14.000000000 +0200
+++ new/Future-IO-0.15/Build.PL 2023-10-18 19:14:10.000000000 +0200
@@ -14,6 +14,7 @@
       'perl' => '5.014',
    },
    test_requires => {
+      'Test::ExpectAndCheck' => '0.06',
       'Test::Future::IO::Impl' => 0,
       'Test2::V0' => 0,
    },
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Future-IO-0.14/Changes new/Future-IO-0.15/Changes
--- old/Future-IO-0.14/Changes  2023-04-25 14:04:14.000000000 +0200
+++ new/Future-IO-0.15/Changes  2023-10-18 19:14:10.000000000 +0200
@@ -1,5 +1,12 @@
 Revision history for Future-IO
 
+0.15    2023-10-18
+        [BUGFIXES]
+         * Avoid creating a long `->then` chain of Futures when handling
+           EAGAIN (RT150117)
+         * Temporarily enable blocking mode on filehandles when the default
+           event loop is not using `select()`, to avoid a CPU spin (RT150117)
+
 0.14    2023-04-25
         [CHANGES]
          * Moved `Test::Future::IO::Impl` into its own distribution, so that
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Future-IO-0.14/MANIFEST new/Future-IO-0.15/MANIFEST
--- old/Future-IO-0.14/MANIFEST 2023-04-25 14:04:14.000000000 +0200
+++ new/Future-IO-0.15/MANIFEST 2023-10-18 19:14:10.000000000 +0200
@@ -1,3 +1,4 @@
+.editorconfig
 Build.PL
 Changes
 lib/Future/IO.pm
@@ -21,4 +22,5 @@
 t/20impl-override.t
 t/21impl-before-load.t
 t/30system.t
+t/90rt150117.t
 t/99pod.t
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Future-IO-0.14/META.json new/Future-IO-0.15/META.json
--- old/Future-IO-0.14/META.json        2023-04-25 14:04:14.000000000 +0200
+++ new/Future-IO-0.15/META.json        2023-10-18 19:14:10.000000000 +0200
@@ -4,7 +4,7 @@
       "Paul Evans <[email protected]>"
    ],
    "dynamic_config" : 1,
-   "generated_by" : "Module::Build version 0.4231",
+   "generated_by" : "Module::Build version 0.4234",
    "license" : [
       "perl_5"
    ],
@@ -30,6 +30,7 @@
       "test" : {
          "requires" : {
             "Test2::V0" : "0",
+            "Test::ExpectAndCheck" : "0.06",
             "Test::Future::IO::Impl" : "0"
          }
       }
@@ -37,15 +38,15 @@
    "provides" : {
       "Future::IO" : {
          "file" : "lib/Future/IO.pm",
-         "version" : "0.14"
+         "version" : "0.15"
       },
       "Future::IO::ImplBase" : {
          "file" : "lib/Future/IO/ImplBase.pm",
-         "version" : "0.14"
+         "version" : "0.15"
       },
       "Future::IO::System" : {
          "file" : "lib/Future/IO/System.pm",
-         "version" : "0.14"
+         "version" : "0.15"
       }
    },
    "release_status" : "stable",
@@ -54,6 +55,6 @@
          "http://dev.perl.org/licenses/";
       ]
    },
-   "version" : "0.14",
+   "version" : "0.15",
    "x_serialization_backend" : "JSON::PP version 4.07"
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Future-IO-0.14/META.yml new/Future-IO-0.15/META.yml
--- old/Future-IO-0.14/META.yml 2023-04-25 14:04:14.000000000 +0200
+++ new/Future-IO-0.15/META.yml 2023-10-18 19:14:10.000000000 +0200
@@ -4,11 +4,12 @@
   - 'Paul Evans <[email protected]>'
 build_requires:
   Test2::V0: '0'
+  Test::ExpectAndCheck: '0.06'
   Test::Future::IO::Impl: '0'
 configure_requires:
   Module::Build: '0.4004'
 dynamic_config: 1
-generated_by: 'Module::Build version 0.4231, CPAN::Meta::Converter version 
2.150010'
+generated_by: 'Module::Build version 0.4234, CPAN::Meta::Converter version 
2.150010'
 license: perl
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -17,13 +18,13 @@
 provides:
   Future::IO:
     file: lib/Future/IO.pm
-    version: '0.14'
+    version: '0.15'
   Future::IO::ImplBase:
     file: lib/Future/IO/ImplBase.pm
-    version: '0.14'
+    version: '0.15'
   Future::IO::System:
     file: lib/Future/IO/System.pm
-    version: '0.14'
+    version: '0.15'
 requires:
   Future: '0'
   Struct::Dumb: '0'
@@ -31,5 +32,5 @@
   perl: '5.014'
 resources:
   license: http://dev.perl.org/licenses/
-version: '0.14'
+version: '0.15'
 x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Future-IO-0.14/README new/Future-IO-0.15/README
--- old/Future-IO-0.14/README   2023-04-25 14:04:14.000000000 +0200
+++ new/Future-IO-0.15/README   2023-10-18 19:14:10.000000000 +0200
@@ -40,6 +40,10 @@
     problematic on MSWin32, depending on what type of filehandle is
     involved.
 
+    If select() is not being used then the default implementation will
+    temporarily set filehandles into blocking mode (by switching off the
+    O_NONBLOCK flag) while performing IO on them.
+
     For cases where multiple filehandles are required, or for doing more
     involved IO operations, a real implementation based on an actual event
     loop should be provided. The following are known to exist; CPAN may
@@ -130,7 +134,7 @@
 
  sysread_until_eof
 
-       $f = Future::IO->sysread_until_eof( $fh )
+       $f = Future::IO->sysread_until_eof( $fh );
 
     Since version 0.12.
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Future-IO-0.14/lib/Future/IO/ImplBase.pm 
new/Future-IO-0.15/lib/Future/IO/ImplBase.pm
--- old/Future-IO-0.14/lib/Future/IO/ImplBase.pm        2023-04-25 
14:04:14.000000000 +0200
+++ new/Future-IO-0.15/lib/Future/IO/ImplBase.pm        2023-10-18 
19:14:10.000000000 +0200
@@ -3,7 +3,7 @@
 #
 #  (C) Paul Evans, 2019-2021 -- [email protected]
 
-package Future::IO::ImplBase 0.14;
+package Future::IO::ImplBase 0.15;
 
 use v5.14;
 use warnings;
@@ -143,28 +143,40 @@
 
 =cut
 
-sub sysread
+sub _sysread1
 {
    my $self = shift;
-   my ( $fh, $length ) = @_;
+   my ( $f, $fh, $length ) = @_;
 
-   $self->ready_for_read( $fh )->then( sub {
+   my $waitf = $self->ready_for_read( $fh )->on_done( sub {
       my $ret = $fh->sysread( my $buf, $length );
       if( $ret ) {
-         return Future->done( $buf );
+         $f->done( $buf );
       }
       elsif( defined $ret ) {
          # EOF
-         return Future->done();
+         $f->done();
       }
       elsif( $! == EAGAIN or $! == EWOULDBLOCK ) {
          # Try again
-         return $self->sysread( $fh, $length );
+         $self->_sysread1( $f, $fh, $length );
       }
       else {
-         return Future->fail( "sysread: $!\n", sysread => $fh, $! );
+         $f->fail( "sysread: $!\n", sysread => $fh, $! );
       }
    });
+
+   $f //= $waitf->new;
+
+   $f->on_cancel( $waitf );
+
+   return $f;
+}
+
+sub sysread
+{
+   my $self = shift;
+   return $self->_sysread1( undef, @_ );
 }
 
 =head2 syswrite
@@ -178,24 +190,36 @@
 
 =cut
 
-sub syswrite
+sub _syswrite1
 {
    my $self = shift;
-   my ( $fh, $data ) = @_;
+   my ( $f, $fh, $data ) = @_;
 
-   return $self->ready_for_write( $fh )->then( sub {
+   my $waitf = $self->ready_for_write( $fh )->on_done( sub {
       my $len = $fh->syswrite( $data );
       if( defined $len ) {
-         return Future->done( $len );
+         $f->done( $len );
       }
       elsif( $! == EAGAIN or $! == EWOULDBLOCK ) {
          # Try again
-         return $self->syswrite( $fh, $data );
+         $self->_syswrite1( $f, $fh, $data );
       }
       else {
-         return Future->fail( "syswrite: $!\n", syswrite => $fh, $! );
+         $f->fail( "syswrite: $!\n", syswrite => $fh, $! );
       }
    });
+
+   $f //= $waitf->new;
+
+   $f->on_cancel( $waitf );
+
+   return $f;
+}
+
+sub syswrite
+{
+   my $self = shift;
+   return $self->_syswrite1( undef, @_ );
 }
 
 =head1 AUTHOR
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Future-IO-0.14/lib/Future/IO/System.pm 
new/Future-IO-0.15/lib/Future/IO/System.pm
--- old/Future-IO-0.14/lib/Future/IO/System.pm  2023-04-25 14:04:14.000000000 
+0200
+++ new/Future-IO-0.15/lib/Future/IO/System.pm  2023-10-18 19:14:10.000000000 
+0200
@@ -3,7 +3,7 @@
 #
 #  (C) Paul Evans, 2023 -- [email protected]
 
-package Future::IO::System 0.14;
+package Future::IO::System 0.15;
 
 use v5.14;
 use warnings;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Future-IO-0.14/lib/Future/IO.pm 
new/Future-IO-0.15/lib/Future/IO.pm
--- old/Future-IO-0.14/lib/Future/IO.pm 2023-04-25 14:04:14.000000000 +0200
+++ new/Future-IO-0.15/lib/Future/IO.pm 2023-10-18 19:14:10.000000000 +0200
@@ -3,7 +3,7 @@
 #
 #  (C) Paul Evans, 2019-2023 -- [email protected]
 
-package Future::IO 0.14;
+package Future::IO 0.15;
 
 use v5.14;
 use warnings;
@@ -60,6 +60,10 @@
 will use C<select()> to wait for either. This may be problematic on MSWin32,
 depending on what type of filehandle is involved.
 
+If C<select()> is not being used then the default implementation will
+temporarily set filehandles into blocking mode (by switching off the
+C<O_NONBLOCK> flag) while performing IO on them.
+
 For cases where multiple filehandles are required, or for doing more involved
 IO operations, a real implementation based on an actual event loop should be
 provided. The following are known to exist; CPAN may provide others:
@@ -249,7 +253,7 @@
 
 =head2 sysread_until_eof
 
-   $f = Future::IO->sysread_until_eof( $fh )
+   $f = Future::IO->sysread_until_eof( $fh );
 
 I<Since version 0.12.>
 
@@ -567,11 +571,21 @@
       $wready = !!@writers;
    }
 
+   my $was_blocking;
+
    if( $rready ) {
-      ( shift @readers )->f->done;
+      my $rd = shift @readers;
+
+      $was_blocking = $rd->fh->blocking(1) if !$do_select;
+      $rd->f->done;
+      $rd->fh->blocking(0) if !$do_select and !$was_blocking;
    }
    if( $wready ) {
-      ( shift @writers )->f->done;
+      my $wr = shift @writers;
+
+      $was_blocking = $wr->fh->blocking(1) if !$do_select;
+      $wr->f->done;
+      $wr->fh->blocking(0) if !$do_select and !$was_blocking;
    }
 
    my $now = time();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Future-IO-0.14/t/90rt150117.t 
new/Future-IO-0.15/t/90rt150117.t
--- old/Future-IO-0.14/t/90rt150117.t   1970-01-01 01:00:00.000000000 +0100
+++ new/Future-IO-0.15/t/90rt150117.t   2023-10-18 19:14:10.000000000 +0200
@@ -0,0 +1,81 @@
+#!/usr/bin/perl
+
+use v5.14;
+use warnings;
+
+use Test2::V0;
+use Test::ExpectAndCheck 0.06; # ->will_return_using can modify caller args
+
+use Errno qw( EAGAIN );
+
+# We need to ensure we have a pureperl Future implementation for the following
+# helper function to work properly
+BEGIN { $ENV{PERL_FUTURE_NO_XS} = 1; }
+
+use Future;
+use Future::IO;
+
+BEGIN { Future->isa( "Future::PP" ) or
+   plan skip_all => "Unable to ensure that Future uses the pure-perl 
implementation"; }
+
+sub get_future_oncancel
+{
+   my ( $f ) = @_;
+   # gut-wrenching into Future
+   my $on_cancel = $f->{on_cancel} or return;
+   return grep { defined } @$on_cancel;
+}
+
+sub count_future_dependents
+{
+   my ( $f ) = @_;
+
+   my $count = 0;
+
+   my @queue = ( $f );
+   while( @queue ) {
+      my $f = shift @queue;
+      $count++;
+      push @queue, get_future_oncancel $f;
+   }
+
+   return $count;
+}
+
+my ( $controller, $puppet ) = Test::ExpectAndCheck->create;
+
+# ->sysread does not build long future chains on EAGAIN
+{
+   my $read_f;
+
+   my $dep_count;
+
+   # 100 times yield undef/EAGAIN
+   for( 1 .. 100 ) {
+      $controller->expect( blocking => 1 )
+         ->will_return( 1 );
+      $controller->expect( sysread => Test::Deep::ignore(), 128 )
+         ->will_return_using( sub { $! = EAGAIN; return undef } );
+   }
+
+   $controller->expect( blocking => 1 )
+      ->will_return( 1 );
+   $controller->expect( sysread => Test::Deep::ignore(), 128 )
+      ->will_return_using( sub {
+         my ( $args ) = @_;
+         $args->[0] = "result";
+
+         $dep_count = count_future_dependents $read_f;
+
+         return length $args->[0];
+      });
+
+   $read_f = Future::IO->sysread( $puppet, 128 );
+   is( $read_f->get, "result", '->sysread yields result' );
+
+   is( $dep_count, 1, '->sysread future did not build a big dependent chain' );
+
+   $controller->check_and_clear( '->sysread' );
+}
+
+done_testing;

Reply via email to