Subject: | broken %SIG in version .56 |
Date: | Fri, 11 Jan 2019 21:41:36 +0000 |
To: | "bug-Data-DPath [...] rt.cpan.org" <bug-Data-DPath [...] rt.cpan.org> |
From: | Chloe Palenchar <CPalenchar [...] nvidia.com> |
Starting with Data::DPath verion .56, “use”ing the module after setting signal handlers clears them. This seems directly related to known Safe module bug https://rt.cpan.org/Public/Bug/Display.html?id=112092.
Here’s a repro script:
Show quoted text
>cat test.pl
BEGIN {
$SIG{INT} = $SIG{WINCH} = sub { print "GOT $_[0]\n" };
}
use Data::DPath;
$| = 1;
print "Running as PID $$\n";
for my $i (1 .. 30) {
print "$i..";
sleep 1;
}
When running the script:
Show quoted text> perl test.pl
Running as PID 54623
1..2..^CSignal SIGINT received, but no signal handler set.
With a WAR to prevent Safe from wiping out my signal handlers:
Show quoted text>cat test.pl
BEGIN {
$SIG{INT} = $SIG{WINCH} = sub { print "GOT $_[0]\n" };
}
BEGIN {
local (
$SIG{WINCH}, $SIG{INT}
);
require Data::DPath;
}
$| = 1;
print "Running as PID $$\n";
for my $i (1 .. 30) {
print "$i..";
sleep 1;
}
Show quoted text> perl test.pl
Running as PID 55950
1..2..3..4..5..6..7..8..^CGOT INT
9..10..11..12..13..14..^CGOT INT
15..16..17..18..19..20..21..22..23..24..25..26..27..28..29..30..
I have tested these versions of Data::DPath:
.55- no issue
.56- bug repro
.57- bug repro
-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information. Any unauthorized review, use, disclosure or distribution
is prohibited. If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------