Subject: | [PATCH] Problem with FreeBSD's BSDPAN |
The attached patch against Safe 2.16 solves a problem with safeload.t
and FreeBSD's BSDPAN system. BSDPAN is a collection of modules which
overwrite standard CORE modules like MakeMaker.pm and Config.pm and is
part of the standard FreeBSD perl port.
The problem manifests like in this test report:
http://www.nntp.perl.org/group/perl.cpan.testers/2008/02/msg1026772.html
The BSDPAN/Config.pm module needs to access @INC, which it cannot in a
safe compartment, which eventually leads to the endless loop. The
attached patch just shares @main::INC to the compartment if it detects
that it runs under the BSDPAN system (BSDPAN is in @INC).
Regards,
Slaven
Subject: | Safe-2.16-BSDPAN.patch |
#### Patch data follows ####
diff -up '../build/Safe-2.16-9ucDzW/t/safeload.t' 'Safe-2.16/t/safeload.t'
Index: ./t/safeload.t
--- ./t/safeload.t Thu Mar 13 11:48:47 2008
+++ ./t/safeload.t Thu Mar 13 22:23:43 2008
@@ -26,5 +26,8 @@ plan(tests => 1);
my $c = new Safe;
$c->permit(qw(require caller entereval unpack));
+# FreeBSD's BSDPAN system overwrites Config.pm with BSDCPAN/Config.pm
+# which needs to read @INC
+$c->share_from('main', ['@INC']) if grep { m{/BSDPAN$} } @INC;
my $r = $c->reval(q{ use version; 1 });
ok( defined $r, "Can load version.pm in a Safe compartment" ) or diag $@;
#### End of Patch data ####