Hello community,
here is the log from the commit of package perl-Sys-SigAction for
openSUSE:Factory checked in at 2013-07-29 17:50:48
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Sys-SigAction (Old)
and /work/SRC/openSUSE:Factory/.perl-Sys-SigAction.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Sys-SigAction"
Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-Sys-SigAction/perl-Sys-SigAction.changes
2012-11-28 14:32:21.000000000 +0100
+++
/work/SRC/openSUSE:Factory/.perl-Sys-SigAction.new/perl-Sys-SigAction.changes
2013-07-29 17:50:50.000000000 +0200
@@ -1,0 +2,41 @@
+Fri Jul 26 05:33:50 UTC 2013 - [email protected]
+
+- updated to 0.18
+ Fix "bareword" error on some platforms at least, by explicitly importing
+ INT_MAX from POSIX module.
+
+ Fix Changes file which listed verson 0.16 twice when it should have
+ list version 0.17 for the more recent changes.
+
+ =head2 Changes in Sys::SigAction 0.17 22 Jul 2013
+
+ Fix timeout.t to use POSIX::pause() instead of select(), which was used
+ to optimized the while ( 1 ) loop in the forever function. This caused
+ failures on some platforms. pause() is right solution -- thanks (again)
+ to Carsten Gaebler and for the suggestion for handling the Time::HiRes
+ request.
+
+ More double eval documentation cleanup that had not been previously
+ caught in the POD. (bug #79130).
+
+ When Time::HiRes is present, allow for long timeouts longer than the
+ POSIX::MAX_INT microseconds when Time::HiRes is present. Just call
+ call alarm() instead of ualarm() in the case where input argument
+ would result in a msecs value in an argument to ualarm which is
+ larger than POSIX::INT_MAX (and, of course, add a test for this in
+ timeout.t). (bug/enhancement request #75784)
+
+ Fix typos in dbd-oracle-timeout.POD (bug #87141). It appears that
+ the DBD:oracle module may now have internal handling for this problem
+ (DBD::oracle not longer references Sys::SigAction).
+
+ =head2 Changes in Sys::SigAction 0.16 21 Jul 2013
+
+ Thanks to excellent patches from Carsten Gaebler (contact me
+ if you want to contact him), timeout_call() now supports
+ passing an array of arguments which it will pass to the code
+ it executes.
+
+ Minor tweak to POD.
+
+-------------------------------------------------------------------
Old:
----
Sys-SigAction-0.15.tar.gz
New:
----
Sys-SigAction-0.18.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-Sys-SigAction.spec ++++++
--- /var/tmp/diff_new_pack.eXmk9d/_old 2013-07-29 17:50:51.000000000 +0200
+++ /var/tmp/diff_new_pack.eXmk9d/_new 2013-07-29 17:50:51.000000000 +0200
@@ -1,7 +1,7 @@
#
# spec file for package perl-Sys-SigAction
#
-# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -17,24 +17,28 @@
Name: perl-Sys-SigAction
+Version: 0.18
+Release: 0
%define cpan_name Sys-SigAction
Summary: Perl extension for Consistent Signal Handling
License: Artistic-1.0 or GPL-1.0+
Group: Development/Libraries/Perl
-Version: 0.15
-Release: 0
-Url: http://www.cpan.org
-Source0:
http://www.cpan.org/authors/id/L/LB/LBAXTER/%{cpan_name}-%{version}.tar.gz
+Url: http://search.cpan.org/dist/Sys-SigAction/
+Source:
http://www.cpan.org/authors/id/L/LB/LBAXTER/%{cpan_name}-%{version}.tar.gz
+BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-%{perl_requires}
BuildRequires: perl
BuildRequires: perl-macros
+#BuildRequires: perl(Sys::SigAction)
+%{perl_requires}
%description
-Sys::SigAction provides EASY access to POSIX::sigaction()
-for signal handling on systems the support sigaction().
-
-perldoc Sys::SigAction for more information.
+Prior to version 5.8.0 perl implemented 'unsafe' signal handling. The
+reason it is consider unsafe, is that there is a risk that a signal will
+arrive, and be handled while perl is changing internal data structures.
+This can result in all kinds of subtle and not so subtle problems. For this
+reason it has always been recommended that one do as little as possible in
+a signal handler, and only variables that already exist be manipulated.
%prep
%setup -q -n %{cpan_name}-%{version}
++++++ Sys-SigAction-0.15.tar.gz -> Sys-SigAction-0.18.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Sys-SigAction-0.15/Changes
new/Sys-SigAction-0.18/Changes
--- old/Sys-SigAction-0.15/Changes 2011-07-02 02:22:10.000000000 +0200
+++ new/Sys-SigAction-0.18/Changes 2013-07-25 00:38:14.000000000 +0200
@@ -8,6 +8,45 @@
Revision history for Sys::SigAction.
+=head2 Changes in Sys::SigAction 0.18 24 Jul 2013
+
+Fix "bareword" error on some platforms at least, by explicitly importing
+INT_MAX from POSIX module.
+
+Fix Changes file which listed verson 0.16 twice when it should have
+list version 0.17 for the more recent changes.
+
+=head2 Changes in Sys::SigAction 0.17 22 Jul 2013
+
+Fix timeout.t to use POSIX::pause() instead of select(), which was used
+to optimized the while ( 1 ) loop in the forever function. This caused
+failures on some platforms. pause() is right solution -- thanks (again)
+to Carsten Gaebler and for the suggestion for handling the Time::HiRes
+request.
+
+More double eval documentation cleanup that had not been previously
+caught in the POD. (bug #79130).
+
+When Time::HiRes is present, allow for long timeouts longer than the
+POSIX::MAX_INT microseconds when Time::HiRes is present. Just call
+call alarm() instead of ualarm() in the case where input argument
+would result in a msecs value in an argument to ualarm which is
+larger than POSIX::INT_MAX (and, of course, add a test for this in
+timeout.t). (bug/enhancement request #75784)
+
+Fix typos in dbd-oracle-timeout.POD (bug #87141). It appears that
+the DBD:oracle module may now have internal handling for this problem
+(DBD::oracle not longer references Sys::SigAction).
+
+=head2 Changes in Sys::SigAction 0.16 21 Jul 2013
+
+Thanks to excellent patches from Carsten Gaebler (contact me
+if you want to contact him), timeout_call() now supports
+passing an array of arguments which it will pass to the code
+it executes.
+
+Minor tweak to POD.
+
=head2 Changes in Sys::SigAction 0.15 1 Jul 2011
Clean up POD. Close bug #69057. Other minor tweaks to POD.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Sys-SigAction-0.15/META.yml
new/Sys-SigAction-0.18/META.yml
--- old/Sys-SigAction-0.15/META.yml 2011-07-02 02:23:03.000000000 +0200
+++ new/Sys-SigAction-0.18/META.yml 2013-07-25 01:06:02.000000000 +0200
@@ -1,6 +1,6 @@
--- #YAML:1.0
name: Sys-SigAction
-version: 0.15
+version: 0.18
abstract: Perl extension for Consistent Signal Handling
author:
- Lincoln A. Baxter <lab-at-lincolnbaxter-dot-com>
@@ -17,7 +17,7 @@
directory:
- t
- inc
-generated_by: ExtUtils::MakeMaker version 6.55_02
+generated_by: ExtUtils::MakeMaker version 6.57_05
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: 1.4
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Sys-SigAction-0.15/README
new/Sys-SigAction-0.18/README
--- old/Sys-SigAction-0.15/README 2009-01-24 20:49:05.000000000 +0100
+++ new/Sys-SigAction-0.18/README 2013-07-21 19:23:10.000000000 +0200
@@ -20,10 +20,15 @@
This module requires these other modules and libraries:
Test::More
+ posix( sigactioni, ceil )
+
+This module will use the follow module if present:
+
+ Time::HiRes( ualarm) for fractional second timeouts.
COPYRIGHT AND LICENCE
-Copyright (c) 2004-2009 Lincoln A. Baxter
+Copyright (c) 2004-2013 Lincoln A. Baxter
You may distribute under the terms of either the GNU General Public
License or the Artistic License, as specified in the Perl README file,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Sys-SigAction-0.15/dbd-oracle-timeout.POD
new/Sys-SigAction-0.18/dbd-oracle-timeout.POD
--- old/Sys-SigAction-0.15/dbd-oracle-timeout.POD 2011-06-19
02:55:56.000000000 +0200
+++ new/Sys-SigAction-0.18/dbd-oracle-timeout.POD 2013-07-23
01:58:50.000000000 +0200
@@ -122,7 +122,7 @@
there is no SIGALRM handler in place to catch the signal, or the
wrong handler (not the local handler) will be called.
-All the code sames here have been adjusted to execute the code to be
+All the code samples here have been adjusted to execute the code to be
timed out in an inner eval to correct for this problem.
=head2 The Problem
@@ -131,17 +131,17 @@
code has worked just fine. We understood that with perl 5.6 (and prior)
signal handling was 'unsafe', and we accepted the risk that the signal
handler could be called at an in-opportune time, causing non-reentrant
-system routines to fail. We accepted the possibilty of a perl core dump,
+system routines to fail. We accepted the possibility of a perl core dump,
and program termination. For real-time services this is considered an
acceptable risk since failing quickly is preferable to hanging around
without returning.
-We, like most programmers facing this this problem, simply built mechanisms to
+We, like most programmers facing this problem, simply built mechanisms to
restart things should such a catastrophic failure (perl core dump) occur.
Another technique we use, is to take ourselves out on error, letting a
new (clean) instance of our service be created (by the above mechanism).
-Upon moving to perl 5.8 or higher however, we discovered that that the
+Upon moving to perl 5.8 or higher however, we discovered that the
above code (especially the connect code) no longer works. Instead,
it just hangs. This is a result of the changes to the way
Unix signal handlers are implemented in perl 5.8 (and later versions).
@@ -177,7 +177,7 @@
Using C<POSIX::sigaction()> does ensure that the signal handler is
called when the signal is fired. Calling die() within the signal handler,
-will cause the system call will be interupted, and control will return to the
+will cause the system call will be interrupted, and control will return to the
perl script. But doing this effectively implements returns us to the
'unsafe' signals behavior -- at least in perl 5.8.0. In perl 5.8.2, it
is possible to ask for 'deferred' signal handling while still controlling
@@ -187,7 +187,7 @@
The usage of C<POSIX::sigaction()> however is not well
documented (except for several examples in the C<posix.t> test in the perl
core). And in perl versions less than 5.8.0, while C<POSIX::sigaction()>
-is defined, it appears to be broken. But thats OK, because just setting
+is defined, it appears to be broken. But that's OK, because just setting
C<$SIG{NAME}> works.
=head2 The Pain
@@ -231,7 +231,7 @@
have to replicate all that code every where I had timeout logic,
I implemented a module that makes using C<POSIX::sigaction()>
as easy as setting a localized C<$SIG{ALRM}> was in perl 5.6.x.
-The C<Sys::SigAction> module can be retrieved from from CPAN by going to:
+The C<Sys::SigAction> module can be retrieved from CPAN by going to:
http://search.cpan.org/~lbaxter/Sys-SigAction/
@@ -269,7 +269,7 @@
Note that with Sys::SigAction version 0.06, this script was changed to
explicitly set
safe=>0 (instead of safe=>1). The reason is that Sys::SigAction (version 0.04
and less)
-did not correctly set this paramter on the POSIX::sigaction call. When that
+did not correctly set this parameter on the POSIX::sigaction call. When that
was fixed with version 0.06 this script had to be fixed.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Sys-SigAction-0.15/lib/Sys/SigAction.pm
new/Sys-SigAction-0.18/lib/Sys/SigAction.pm
--- old/Sys-SigAction-0.15/lib/Sys/SigAction.pm 2011-07-02 02:22:34.000000000
+0200
+++ new/Sys-SigAction-0.18/lib/Sys/SigAction.pm 2013-07-25 01:02:39.000000000
+0200
@@ -8,33 +8,26 @@
require 5.005;
use strict;
#use warnings;
-use POSIX qw( :signal_h ceil ) ;
+use POSIX qw( :signal_h ceil INT_MAX ) ;
require Exporter;
use vars qw( $VERSION @ISA @EXPORT_OK %EXPORT_TAGS );
#support high resolution time transparently in timeout_call by defining
-#the function sig_alarm() which calls ualarm if Time::HiRes
-#is load able or alarm with the ciel of the value passed if
-#Time::HiRes is not loadable.
+#the function sig_alarm() which calls Time::HiRes::alarm if available
+#or core alarm with the ceil of the value passed otherwise.
#timeout_call uses sig_alarm()
-my $have_hires = 1;
-{
- eval "use Time::HiRes qw( ualarm )";
- if ( $@ ) {
- $have_hires = 0;
- }
-}
-sub have_hires() { return $have_hires; }; #test support
+
+use constant HAVE_HIRES => scalar eval 'use Time::HiRes ();
Time::HiRes::alarm(0); 1;';
+
+sub have_hires() { HAVE_HIRES }; #test support
sub sig_alarm #replacement for alarm, takes factional seconds in floating
point format
{
- my ( $secs ) = @_;
+ my $secs = shift;
#print print "secs=$secs\n";
- if ( $have_hires )
- {
- $secs = $secs * 1000000.0;
- #print "have hires: secs modified to $secs\n";
- ualarm( $secs );
+
+ if ( HAVE_HIRES && $secs*1_000_000 <= INT_MAX ) {
+ Time::HiRes::alarm( $secs );
}
else
{
@@ -46,7 +39,7 @@
@ISA = qw( Exporter );
@EXPORT_OK = qw( set_sig_handler timeout_call sig_name sig_number sig_alarm );
-$VERSION = '0.15';
+$VERSION = '0.18';
use Config;
my %signame = ();
@@ -87,7 +80,7 @@
my ( $attrs ) = @_ ;
#my $act = POSIX::SigAction->new( $handler ,$mask ,$attrs->{flags}
,$attrs->{safe} );
#steve ( [email protected] submitted
http://rt.cpan.org/Ticket/Display.html?id=19916
- # puts out the above liin is a mis-interpretation of the API for
POSIX::SigAcation
+ # puts out the above line is a mis-interpretation of the API for
POSIX::SigAcation
# so here is the fix (per his suggestion)... lab:
#
#http://rt.cpan.org/Public/Bug/Display.html?id=21777
@@ -164,29 +157,27 @@
}
use constant TIMEDOUT => {};
-sub timeout_call( $$;$ )
+sub timeout_call( $$@ )
{
- my ( $timeout ,$code ) = @_;
+ my ( $timeout, $code, @args ) = @_;
+
+ if (!$timeout) {
+ &$code(@args);
+ return 0;
+ }
+
my $timed_out = 0;
- my $ex;
eval {
- #lab-20060625 unecessary: my $h = sub { $timed_out = 1; die TIMEDOUT; };
my $sa = set_sig_handler( SIGALRM ,sub { $timed_out = 1; die TIMEDOUT; }
);
eval {
- #print "timeout=$timeout\n" ;
sig_alarm( $timeout );
- &$code;
- sig_alarm(0);
+ &$code(@args);
};
sig_alarm(0);
die $@ if $@;
};
- if ($@)
- {
- #print "$@\n" ;
- die $@ if not ref $@;
- die $@ if $@ != TIMEDOUT;
- }
+ die $@ if $@ and (not ref $@ or $@ != TIMEDOUT);
+
return $timed_out;
}
sub new {
@@ -254,7 +245,6 @@
alarm(0);
die $@ if $@;
}; #signal handler is reset when $h goes out of scope
- alarm(0);
if ( $@ or $alarm ) ...
or
@@ -287,11 +277,11 @@
handler and (optionally) returns an object which causes the signal
handler to be reset to the previous value, when it goes out of scope.
-Also implemented is C<timeout_call()> which takes a timeout value and
-a code reference, and executes the code reference wrapped with an
-alarm timeout. timeout_call accepts seconds in floating point format,
-so you can time out call with a resolution of 0.000001 seconds (assumes
-Time::HiRes is loadable.
+Also implemented is C<timeout_call()> which takes a timeout value, a
+code reference and optional arguments, and executes the code reference
+wrapped with an alarm timeout. timeout_call accepts seconds in floating
+point format, so you can time out call with a resolution of 0.000001
+seconds (assumes Time::HiRes is loadable).
Finally, two convenience routines are defined which allow one to get the
@@ -344,13 +334,15 @@
that looks like this in perl 5.8.0 and later:
eval {
- local $SIG{ALRM} = sub { die "timeout" };
- alarm 2;
- $sth = DBI->connect(...);
+ eval {
+ local $SIG{ALRM} = sub { die "timeout" };
+ alarm 2;
+ $sth = DBI->connect(...);
+ alarm 0;
+ };
alarm 0;
+ die if $@;
};
- alarm 0;
- die if $@;
Or as the author of bug #50628 pointed out,
might probably better be written as:
@@ -362,9 +354,9 @@
$sth = DBI->connect(...);
alarm 0;
};
- }
- alarm 0;
- die if $@;
+ alarm 0;
+ die if $@;
+ };
The solution, if your system has the POSIX sigaction() function,
@@ -477,16 +469,20 @@
=head2 timeout_call()
- $timeout ,$coderef
+ $timeout, $coderef, @args
-Given a code reference, and a timeout value (in seconds), timeout()
+Given a code reference, and a timeout value (in seconds), timeout_call()
will (in an eval) setup a signal handler for SIGALRM (which will die),
-set an alarm clock, and execute the code reference. $time (seconds) may
-be expressed as a floating point number.
+set an alarm clock, and execute the code reference with optional
+arguments @args. $timeout (seconds) may be expressed as a floating point
+number.
+
If Time::HiRes is present and useable, timeout_call() can be used with a
-timer resolution of 0.000001 seconds. If Time:HiRes is not available then
factional
-second values less than 1.0 are tranparently converted to 1.
+timer resolution of 0.000001 seconds. If HiRes is not loadable,
+Sys::SigAction will "do the right thing" and convert the factional
+seconds to the next higher integer value using the posix ceil() function.
+
If the alarm goes off the code will be interrupted. The alarm is
canceled if the code returns before the alarm is fired. The routine
@@ -495,16 +491,13 @@
The original signal handler is restored, prior to returning to the caller.
-If HiRes is not loadable, Sys::SigAction will do the right thing
-and convert
-
=head2 sig_alarm()
ex:
sig_alarm( 1.2 );
-sig_alarm() is a drop in replacment for the standard alarm() function.
+sig_alarm() is a drop in replacement for the standard alarm() function.
The argument may be expressed as a floating point number.
If Time::HiRes is present and useable, the alarm timers will be set
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Sys-SigAction-0.15/t/timeout.t
new/Sys-SigAction-0.18/t/timeout.t
--- old/Sys-SigAction-0.15/t/timeout.t 2011-06-26 04:15:27.000000000 +0200
+++ new/Sys-SigAction-0.18/t/timeout.t 2013-07-25 00:48:14.000000000 +0200
@@ -26,27 +26,36 @@
use Carp qw( carp cluck croak confess );
use Data::Dumper;
use Sys::SigAction qw( set_sig_handler timeout_call );
-use POSIX ':signal_h' ;
+use POSIX qw( INT_MAX pause :signal_h );
+
+my $num_args_seen;
+my $sum_args_seen;
sub hash { die { hash=>1 }; }
+sub sleep_one { sleep 1; die "sleep_one"; }
sub immediate { die "immediate"; }
-sub forever { while ( 1 ) { 1; } }
+sub forever { pause; }
+sub forever_w_args {
+ $num_args_seen = @_;
+ $sum_args_seen += $_ for @_;
+ forever();
+}
my $ret = 0;
my $num_tests = 1; #start at 1 because of use_ok above
eval {
- $ret = timeout_call( 1, sub { hash(); } );
+ $ret = timeout_call( 1, \&hash );
};
ok( (ref( $@ ) and exists($@->{'hash'})) ,'die with hash' ); $num_tests++;
ok( $ret == 0 ,'hash did not timeout' ); $num_tests++;
$ret = 0;
eval {
- $ret = timeout_call( 1, sub { immediate(); } );
+ $ret = timeout_call( 1, \&immediate );
};
ok( (not ref($@) and $@ ),'immediate -- die with string' ); $num_tests++;
ok( $ret == 0 ,'immediate did not timeout' ); $num_tests++;
-
+
$ret = 0;
eval {
$ret = Sys::SigAction::timeout_call( 1, \&forever );
@@ -59,10 +68,25 @@
ok( (not $@ ) ,'forever did NOT die' ); $num_tests++;
ok( $ret ,'forever timed out' ); $num_tests++;
+foreach my $args ([1], [2, 3]) {
+ $ret = 0;
+ my $num_args_ok = @$args;
+ my $sum_args_ok = 0;
+ $sum_args_ok += $_ for @$args;
+ $num_args_seen = $sum_args_seen = 0;
+ eval {
+ $ret = Sys::SigAction::timeout_call( 1, \&forever_w_args, @$args );
+ };
+ local $" = ', ';
+ ok( (not $@ ) ,"forever_w_args(@$args) did NOT die" ); $num_tests++;
+ ok( $ret ,"forever_w_args(@$args) timed out" ); $num_tests++;
+ ok( $num_args_seen == $num_args_ok,"forever_w_args(@$args) got
$num_args_seen args" ); $num_tests++;
+ ok( $sum_args_seen == $sum_args_ok,"forever_w_args(@$args) args sum is
$sum_args_seen" ); $num_tests++;
+}
if ( Sys::SigAction::have_hires() )
{
- diag( "testing fractional second timeout" );
+ diag( "fractional second timeout tests" );
$ret = 0;
my $btime;
my $etime;
@@ -75,13 +99,20 @@
print "hires: why did forever throw exception:" .Dumper( $@ );
}
$etime = time();
-# diag( $btime );
-# diag( $etime );
-# diag( ($etime-$btime) );
ok( (not $@ ) ,'hires: forever did NOT die' ); $num_tests++;
ok( $ret ,'hires: forever timed out' ); $num_tests++;
ok( (($etime - $btime) < 0.2 ), "hires: timeout in < 0.2 seconds" );
$num_tests++;
+
+ #diag( "testing HiRes where msecs would be greater than maxint ("
.POSIX::INT_MAX.")" );
+ my $toobig = INT_MAX/1_000_000.0 + 1.1;
+ $ret = 0;
+ eval {
+ $ret = timeout_call( $toobig, \&sleep_one );
+ };
+ ok( (not ref($@) and $@ ),"immediate -- die with string (toobig=$toobig)"
); $num_tests++;
+ ok( $ret == 0 ,"immediate did not timeout (with toobig=$toobig)" );
$num_tests++;
+
}
else
{
@@ -89,12 +120,4 @@
}
plan tests => $num_tests;
-#foreach my $level ( @levels )
-#{
-# ok( $level ,"level $i" );
-# print "level $i = $level\n" ;
-# $i++;
-#}
-
-
exit;
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]