develooper Front page | perl.perl5.porters | Postings from June 2010

[perl #76138] perl inadvertently destroys signal handlers as of f746176000

Thread Previous | Thread Next
Ævar Arnfjörð Bjarmason
June 28, 2010 03:29
[perl #76138] perl inadvertently destroys signal handlers as of f746176000
Message ID:
# New Ticket Created by  "Ævar Arnfjörð Bjarmason" 
# Please include the string:  [perl #76138]
# in the subject line of all future correspondence about this issue. 
# <URL: >

As of f746176000 (Bareword sub lookups) by Zefram there's a regression
in how perl handles signals:

After f746176000:

    $ echo 'package Moo;sub x {Y::SIG->z};1' > /tmp/; perl -le'print $]; @INC = "/tmp"; $SIG{INT} = sub { warn "foo\n" }; require Moo; sleep 30'
    ^CSignal SIGINT received, but no signal handler set.


    $ echo 'package Moo;sub x {Y::SIG->z};1' > /tmp/; /usr/bin/perl -le'print $]; @INC = "/tmp"; $SIG{INT} = sub { warn "foo\n" }; require Moo; sleep 30'

Compiling Y::SIG->z is inadvertently overwriting %SIG. This might also
apply to some other symbols, but didn't with @INC and %ENV when I
tried them.

This bug was discovered in the wild when using signal handlers with
Net::DNS. When 'Net::DNS::RR::SIG->create..' was compiled the user's
signal handler was destroyed:
    677:SIG0 support is provided through the Net::DNS::RR::SIG class. This class is not part
    685:SIG0 support is experimental see Net::DNS::RR::SIG for details.
    687:The method will call C<Carp::croak()> if Net::DNS::RR::SIG cannot be found.
    701:            if ( UNIVERSAL::isa($arg,'Net::DNS::RR::SIG') ) {
    705:                    $sig0 = Net::DNS::RR::SIG->create('', $arg);
    707:            } elsif ( UNIVERSAL::isa($arg,'Net::DNS::RR::SIG::Private') ) {
    709:                    $sig0 = Net::DNS::RR::SIG->create('', $arg);
    717:            $sig0 = Net::DNS::RR::SIG->create('', $arg);

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About