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

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

Thread Previous | Thread Next
From:
Ævar Arnfjörð Bjarmason
Date:
June 28, 2010 03:29
Subject:
[perl #76138] perl inadvertently destroys signal handlers as of f746176000
Message ID:
rt-3.6.HEAD-4976-1277635611-946.76138-75-0@perl.org
# 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: http://rt.perl.org/rt3/Ticket/Display.html?id=76138 >



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/Moo.pm; perl -le'print $]; @INC = "/tmp"; $SIG{INT} = sub { warn "foo\n" }; require Moo; sleep 30'
    5.013002
    ^CSignal SIGINT received, but no signal handler set.

Before:

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

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:
    
    lib/Net/DNS/Packet.pm
    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


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About