Skip Menu |

This queue is for tickets about the Safe CPAN distribution.

Report information
The Basics
Id: 48505
Status: new
Priority: 0/
Queue: Safe

People
Owner: Nobody in particular
Requestors: jdhedden [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 2.17
Fixed in: 2.19



Subject: [PATCH] t/safeuniversal.t failure under 5.8.9
The "no warnings 'redefined'" directives in the compartments in t/safeuniversal.t cause test failures under 5.8.9 because warnings.pm has a 'use Carp' directive and Carp.pm uses 'eval' to 'require Carp::Heavy': # 'eval "string"' trapped by operation mask at /usr/lib/perl5/5.8.9/Carp.pm line 33. # Compilation failed in require at /usr/lib/perl5/5.8.9/warnings.pm line 134. # BEGIN failed--compilation aborted at /usr/lib/perl5/5.8.9/warnings.pm line 134. # Compilation failed in require at (eval 6) line 2. # BEGIN failed--compilation aborted at (eval 6) line 2. The attached patch replaces the "no warnings 'redefined'" directive with a $SIG{__WARN__} trap for 5.8.9. While the redefine warning for UNIVERSAL::can is suppressed by the trap, the warning UNIVERSAL::isa still shows up. However, the failing test will now pass under 5.8.9.
Subject: Safe.patch
--- Safe-2.17/t/safeuniversal.t.orig 2009-08-06 19:29:20.925465500 -0400 +++ Safe-2.17/t/safeuniversal.t 2009-08-06 20:17:04.279542600 -0400 @@ -22,8 +22,11 @@ my $c = new Safe; $c->permit(qw(require caller)); -my $r = $c->reval(q! - no warnings 'redefine'; +my $no_warn_redef = ($] != 5.008009) + ? q(no warnings 'redefine';) + : q($SIG{__WARN__}=sub{};); + +my $r = $c->reval($no_warn_redef . q! sub UNIVERSAL::isa { "pwned" } (bless[],"Foo")->isa("Foo"); !); @@ -33,8 +36,7 @@ sub Foo::foo {} -$r = $c->reval(q! - no warnings 'redefine'; +$r = $c->reval($no_warn_redef . q! sub UNIVERSAL::can { "pwned" } (bless[],"Foo")->can("foo"); !);