Index index by Group index by Distribution index by Vendor index by creation date index by Name Mirrors Help Search

perl-Sys-SigAction-0.23-bp156.3.1 RPM for noarch

From OpenSuSE Leap 15.6 for noarch

Name: perl-Sys-SigAction Distribution: SUSE Linux Enterprise 15 SP6
Version: 0.23 Vendor: openSUSE
Release: bp156.3.1 Build date: Sat Jul 22 11:25:35 2023
Group: Development/Libraries/Perl Build host: goat42
Size: 37683 Source RPM: perl-Sys-SigAction-0.23-bp156.3.1.src.rpm
Packager: https://bugs.opensuse.org
Url: http://search.cpan.org/dist/Sys-SigAction/
Summary: Perl extension for Consistent Signal Handling
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.

Perl 5.8.0 and later versions implements 'safe' signal handling on
platforms which support the POSIX sigaction() function. This is
accomplished by having perl note that a signal has arrived, but deferring
the execution of the signal handler until such time as it is safe to do so.
Unfortunately these changes can break some existing scripts, if they
depended on a system routine being interrupted by the signal's arrival. The
perl 5.8.0 implementation was modified further in version 5.8.2.

From the perl 5.8.2 *perlvar* man page:

   The default delivery policy of signals changed in Perl 5.8.0
   from immediate (also known as "unsafe") to deferred, also
   known as "safe signals".

The implementation of this changed the 'sa_flags' with which the signal
handler is installed by perl, and it causes some system routines (like
connect()) to return EINTR, instead of another error when the signal
arrives. The problem comes when the code that made the system call sees the
EINTR code and decides it's going to call it again before returning. Perl
doesn't do this but some libraries do, including for instance, the Oracle
OCI library.

Thus the 'deferred signal' approach (as implemented by default in perl 5.8
and later) results in some system calls being retried prior to the signal
handler being called by perl. This breaks timeout logic for DBD-Oracle
which works with earlier versions of perl. This can be particularly vexing,
when, for instance, the host on which a database resides is not available:
'DBI->connect()' hangs for minutes before returning an error (and cannot
even be interrupted with control-C, even when the intended timeout is only
seconds). This is because SIGINT appears to be deferred as well. The result
is that it is impossible to implement open timeouts with code that looks
like this in perl 5.8.0 and later:

   eval {
      eval {
         local $SIG{ALRM} = sub { die "timeout" };
         alarm 2;
         $sth = DBI->connect(...);
         alarm 0;
      };
      alarm 0;
      die if $@;
   };

Or as the author of bug #50628 pointed out, might probably better be
written as:

   eval {
      local $SIG{ALRM} = sub { die "timeout" };
      eval {
         alarm 2;
         $sth = DBI->connect(...);
         alarm 0;
      };
      alarm 0;
      die if $@;
   };

The solution, if your system has the POSIX sigaction() function, is to use
perl's 'POSIX::sigaction()' to install the signal handler. With
'sigaction()', one gets control over both the signal mask, and the
'sa_flags' that are used to install the handler. Further, with perl 5.8.2
and later, a 'safe' switch is provided which can be used to ask for safe(r)
signal handling.

Using sigaction() ensures that the system call won't be resumed after it's
interrupted, so long as die is called within the signal handler. This is no
longer the case when one uses '$SIG{name}' to set signal handlers in perls
>= 5.8.0.

The usage of sigaction() is not well documented however, and in perl
versions less than 5.8.0, it does not work at all. (But that's OK, because
just setting '$SIG' does work in that case.) Using sigaction() requires
approximately 4 or 5 lines of code where previously one only had to set a
code reference into the %SIG hash.

Unfortunately, at least with perl 5.8.0, the result is that doing this
effectively reverts to the 'unsafe' signals behavior. It is not clear
whether this would be the case in perl 5.8.2, since the safe flag can be
used to ask for safe signal handling. I suspect this separates the logic
which uses the 'sa_flags' to install the handler, and whether deferred
signal handling is used.

The reader should also note, that the behavior of the 'safe' attribute is
not consistent with what this author expected. Specifically, it appears to
disable signal masking. This can be examined further in the t/safe.t and
the t/mask.t regression tests. Never-the-less, Sys::SigAction provides an
easy mechanism for the user to recover the pre-5.8.0 behavior for signal
handling, and the mask attribute clearly works. (see t/mask.t) If one is
looking for specific safe signal handling behavior that is considered
broken, and the breakage can be demonstrated, then a patch to t/safe.t
would be most welcome.

This module wraps up the POSIX:: routines and objects necessary to call
sigaction() in a way that is as efficient from a coding perspective as just
setting a localized '$SIG{SIGNAL}' with a code reference. Further, the user
has control over the 'sa_flags' passed to sigaction(). By default, if no
additional args are passed to sigaction(), then the signal handler will be
called when a signal (such as SIGALRM) is delivered.

Since sigaction() is not fully functional in perl versions less than 5.8,
this module implements equivalent behavior using the standard '%SIG' array.
The version checking and implementation of the 'right' code is handled by
this module, so the user does not have to write perl version dependent
code. The attrs hashref argument to set_sig_handler() is silently ignored,
in perl versions less than 5.8. When this module was developed it was
tested on perl 5.005 on solaris. That was in 2004. Now only perl versions
>= 5.6 are supported. If you want this to work on perl 5.5 you will have
comment out "use warnings" everywhere.

It is hoped that with the use of this module, your signal handling behavior
can be coded in a way that does not change from one perl version to the
next, and that sigaction() will be easier for you to use.

Provides

Requires

License

Artistic-1.0 or GPL-1.0+

Changelog

* Sun Sep 11 2016 coolo@suse.com
  - updated to 0.23
    see /usr/share/doc/packages/perl-Sys-SigAction/Changes
* Tue Jul 26 2016 coolo@suse.com
  - updated to 0.22
    see /usr/share/doc/packages/perl-Sys-SigAction/Changes
    =head2 Changes in Sys::SigAction 0.22  20 Nov 2013
    Fix lack of interpolation in Makefile.PL for unsupported MSWin OS.
* Tue Nov 26 2013 coolo@suse.com
  - updated to 0.21
    Remove erroneous note at the end of the POD related to references to
    this module in DBD:Oracle.  In reality the reference was in DBI, and it
    is still there.
    Close pod error bug (which referred to the above paragraph) submitted
    by the Debian Packaging team.
* Tue Aug 06 2013 coolo@suse.com
  - updated to 0.20
    Even if C<Time::HiRes::ualarm()> exists, it may not necessarily
    work. (There were way too many broken smoke tests with were
    the result of this. One reason for this may bave been that the test
    was looking for too small an interval of sub-second timeouts.  On busy
    systems, this may have been causing tests to fail.
    Got rid of the attempt at tracking broken environments in timeout.t
    (the hash structure mentioned in the previous change.
    The sub-second timer tests now set a timeout at 0.1 seconds, and check
    for a delta time the is less then 0.8 seconds. Proving that they completed
    in under 1 second, but give a wide range of execution time to account
    for busy systems.
    Also Makefile.PL now looks for C<Time::HiRes::ualarm()>, and tests it.
    If it works, high resolution timeouts are enabled in Sys
    Makefile.PL reports what it finds, and t/timeout.t reports when high
    resolution tests are disabled, but timeout.t should not fail because of
    this... it will just run fewer tests.
    =head2 Changes in Sys::SigAction 0.19  27 Jul 2013
    Change sig_alarm() to use HiRes::ualarm() instead of
    HiRes::alarm().  Hoping to fix hires test failures
    on some platforms.
    Build a hash structure in timeout.t to disable
    the HiRes tests on certain platforms where these functions may
    to be consistently broken, but disable them for at least
    another round, hoping that the change to using HiRes::ualarm()
    solves the problem.
    Also, restructure timeout.t to hardcode the number of tests
    run.  Apparently Test::More on perl 5.8.x insisteds on getting
    the plan before ANY tests are run.
* Fri Jul 26 2013 coolo@suse.com
  - 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.
* Tue Nov 27 2012 crrodriguez@opensuse.org
  - skip test suite when building in qemu arm emulator
* Sun Jan 01 2012 coolo@suse.com
  - update to 0.15
    No functional changes. Fix for test timeout.t.
    Fix strict undefined symbol error in timeout.t, when Time::HiRes is not present.
    Not sure if constant pragma will exist in all supported perl versions,
    so, we just commented out the use strict in this test
* Wed Dec 01 2010 coolo@novell.com
  - switch to perl_requires macro
* Sat Jul 25 2009 chris@computersalat.de
  - spec mods
    * removed ^----------
    * removed ^#---------
* Wed Jul 01 2009 chris@computersalat.de
  - update to 0.11
  - added perl-macros
    o autogen filelist with perl_gen_filelist

Files

/usr/lib/perl5/vendor_perl/5.26.1/Sys
/usr/lib/perl5/vendor_perl/5.26.1/Sys/SigAction
/usr/lib/perl5/vendor_perl/5.26.1/Sys/SigAction.pm
/usr/lib/perl5/vendor_perl/5.26.1/Sys/SigAction/Alarm.pm
/usr/lib/perl5/vendor_perl/5.26.1/x86_64-linux-thread-multi
/usr/share/doc/packages/perl-Sys-SigAction
/usr/share/doc/packages/perl-Sys-SigAction/Changes
/usr/share/doc/packages/perl-Sys-SigAction/README
/usr/share/man/man3/Sys::SigAction.3pm.gz


Generated by rpm2html 1.8.1

Fabrice Bellet, Fri Apr 26 23:30:45 2024