In perl.git, the branch dual/Safe has been updated <http://perl5.git.perl.org/perl.git/commitdiff/d3f461d309ebce94be1d2a5489ffeba0b70322fe?hp=2c9ec40e3923bc3222014f8549ec33543a583a2e>
- Log ----------------------------------------------------------------- commit d3f461d309ebce94be1d2a5489ffeba0b70322fe Author: Rafael Garcia-Suarez <r...@consttype.org> Date: Tue Apr 3 08:41:29 2012 +0200 Fix MANIFEST and release Safe version 2.33 M dist/Safe/Changes M dist/Safe/MANIFEST M dist/Safe/Safe.pm commit 7ec8d481ac36c9219cf1e7b69c1c488d68cafc4e Merge: 2c9ec40 65ae636 Author: Rafael Garcia-Suarez <r...@consttype.org> Date: Tue Apr 3 08:33:01 2012 +0200 Merge branch 'blead' into dual/Safe Conflicts: dist/Safe/t/safeload.t ----------------------------------------------------------------------- Summary of changes: Configure | 49 +++++++++++++++++++++++++++++++++++++++++------ Porting/Glossary | 5 ++++ Porting/pod_lib.pl | 10 +++----- dist/Safe/Changes | 4 +++ dist/Safe/MANIFEST | 1 + dist/Safe/Safe.pm | 8 +++--- dist/Safe/t/safeload.t | 9 +++++++- dist/Safe/t/safeops.t | 23 +++++++++++++++++++-- hints/netbsd.sh | 2 +- uconfig.h | 2 +- uconfig.sh | 1 + 11 files changed, 91 insertions(+), 23 deletions(-) diff --git a/Configure b/Configure index f87e6fd..fdbbf20 100755 --- a/Configure +++ b/Configure @@ -28,7 +28,7 @@ # See Porting/pumpkin.pod for more information on metaconfig. # -# Generated on Thu Feb 16 16:57:30 CET 2012 [metaconfig 3.5 PL0] +# Generated on Sun Apr 1 12:00:35 CEST 2012 [metaconfig 3.5 PL0] # (with additional metaconfig patches by perl...@perl.org) cat >c1$$ <<EOF @@ -843,6 +843,7 @@ cccdlflags='' ccdlflags='' dlsrc='' ld='' +ld_can_script='' lddlflags='' usedl='' doublesize='' @@ -7945,8 +7946,9 @@ Some systems use ld to create libraries that can be dynamically loaded, while other systems (such as those using ELF) use $cc. EOM - case "$ld" in - '') $cat >try.c <<EOM + +: Determine if this is ELF + $cat >try.c <<EOM /* Test for whether ELF binaries are produced */ #include <fcntl.h> #$i_stdlib I_STDLIB @@ -7963,22 +7965,26 @@ int main() { if(i == -1) exit(1); /* fail */ if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F') - exit(0); /* succeed (yes, it's ELF) */ + exit(0); /* succeed (yes, it is ELF) */ else exit(1); /* fail */ } EOM - if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then + if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then + bin_ELF="$define" + fi + $rm_try + + case "$ld" in + '') if $test $bin_ELF = "$define"; then cat <<EOM You appear to have ELF support. I'll use $cc to build dynamic libraries. EOM dflt="$cc" - bin_ELF="$define" else echo "I'll use ld to build dynamic libraries." dflt='ld' fi - $rm_try ;; *) dflt="$ld" ;; @@ -8085,6 +8091,34 @@ EOM ;; esac +ld_can_script="$undef" +case "$bin_ELF$usedl" in +$define$define) + # Abuse try.h and a.out names for neat cleanup + $cat >try.c <<EOM +void foo() {} +void bar() {} +EOM + $cat >try.h <<EOM +LIBTEST_42 { + global: + foo; + local: *; + }; +EOM + if $cc $cccdlflags $ccdlflags $ccflags \ + $ldflags $lddlflags -o a.out try.c \ + -Wl,--version-script=try.h >/dev/null 2>&1 \ + && $test -s a.out ; then + echo "ld supports scripting" >&4 + ld_can_script="$define" + else + echo "ld does not support scripting" >&4 + fi + $rm_try + ;; +esac + : Do we want a shared libperl? also='' case "$usedl" in @@ -23471,6 +23505,7 @@ ivtype='$ivtype' known_extensions='$known_extensions' ksh='$ksh' ld='$ld' +ld_can_script='$ld_can_script' lddlflags='$lddlflags' ldflags='$ldflags' ldflags_uselargefiles='$ldflags_uselargefiles' diff --git a/Porting/Glossary b/Porting/Glossary index e42d750..23ffbfe 100644 --- a/Porting/Glossary +++ b/Porting/Glossary @@ -3619,6 +3619,11 @@ ld (dlsrc.U): On ELF systems, it should be $cc. Mostly, we'll try to respect the hint file setting. +ld_can_script (dlsrc.U): + This variable shows if the loader accepts scripts in the form of + -Wl,--version-script=ld.script. This is currently only supported + for GNU ld on ELF in dynamic loading builds. + lddlflags (dlsrc.U): This variable contains any special flags that might need to be passed to $ld to create a shared library suitable for dynamic diff --git a/Porting/pod_lib.pl b/Porting/pod_lib.pl index 98c32f4..b257c66 100644 --- a/Porting/pod_lib.pl +++ b/Porting/pod_lib.pl @@ -248,11 +248,9 @@ sub get_pod_metadata { my (%cpanpods, %cpanpods_leaf); my (%our_pods); - # These are stub files for deleted documents. We don't want them to show up - # in perl.pod, they just exist so that if someone types "perldoc perltoot" - # they get some sort of pointer to the new docs. - my %ignoredpods - = map { ( "$_.pod" => 1 ) } qw( perlboot perlbot perltooc perltoot ); + # There are files that we don't want to list in perl.pod. + # Maybe the various stub manpages should be listed there. + my %ignoredpods = map { ( "$_.pod" => 1 ) } qw( ); # Convert these to a list of filenames. ++$our_pods{"$_.pod"} foreach keys %{$state{pods}}; @@ -300,7 +298,7 @@ sub get_pod_metadata { my @inconsistent; foreach my $i (sort keys %disk_pods) { push @inconsistent, "$0: $i exists but is unknown by buildtoc\n" - unless $our_pods{$i}; + unless $our_pods{$i} || $ignoredpods{$i}; push @inconsistent, "$0: $i exists but is unknown by MANIFEST\n" if !$BuildFiles{'MANIFEST'} # Ignore if we're rebuilding MANIFEST && !$manipods{$i} && !$manireadmes{$i} && !$state{copies}{$i} diff --git a/dist/Safe/Changes b/dist/Safe/Changes index 55c22d9..7acc3d5 100644 --- a/dist/Safe/Changes +++ b/dist/Safe/Changes @@ -1,3 +1,7 @@ +2.33 Tue Apr 3 2012 + - Donât eval code under âno strictâ (Father Chrysostomos) + cf. Perl 5 change 25dc25e774abbe993644899cf4d9f9925a9fb9a8 + 2.32 Sat Mar 31 2012 - Make Safe play nice with Devel::Cover diff --git a/dist/Safe/MANIFEST b/dist/Safe/MANIFEST index b527bc4..560b93e 100644 --- a/dist/Safe/MANIFEST +++ b/dist/Safe/MANIFEST @@ -9,6 +9,7 @@ t/safe3.t t/safeload.t t/safenamedcap.t t/safeops.t +t/saferegexp.t t/safesort.t t/safeuniversal.t t/safeutf8.t diff --git a/dist/Safe/Safe.pm b/dist/Safe/Safe.pm index 97654cb..cd6586c 100644 --- a/dist/Safe/Safe.pm +++ b/dist/Safe/Safe.pm @@ -1,10 +1,9 @@ package Safe; use 5.003_11; -use strict; use Scalar::Util qw(reftype refaddr); -$Safe::VERSION = "2.32"; +$Safe::VERSION = "2.33"; # *** Don't declare any lexicals above this point *** # @@ -22,10 +21,11 @@ sub lexless_anon_sub { # Uses a closure (on $__ExPr__) to pass in the code to be executed. # (eval on one line to keep line numbers as expected by caller) eval sprintf - 'package %s; %s strict; sub { @_=(); eval q[my $__ExPr__;] . $__ExPr__; }', - $_[0], $_[1] ? 'use' : 'no'; + 'package %s; %s sub { @_=(); eval q[my $__ExPr__;] . $__ExPr__; }', + $_[0], $_[1] ? 'use strict;' : ''; } +use strict; use Carp; BEGIN { eval q{ use Carp::Heavy; diff --git a/dist/Safe/t/safeload.t b/dist/Safe/t/safeload.t index 3ed2793..4d4e7b5 100644 --- a/dist/Safe/t/safeload.t +++ b/dist/Safe/t/safeload.t @@ -18,7 +18,7 @@ BEGIN { use strict; use Test::More; use Safe; -plan(tests => 2); +plan(tests => 3); my $c = new Safe; $c->permit(qw(require caller entereval unpack)); @@ -28,3 +28,10 @@ ok( defined $r, "Can load version.pm in a Safe compartment" ) or diag $@; $r = $c->reval(q{ version->new(1.2) }); is(ref $r, "Safe::Root0::version", "version objects rerooted"); $r or diag $@; + +# Does this test really belong here? We are testing the "loading" of +# a perl version number. +# This should died because of strictures under 5.12+ and because of the +# perl version in 5.10-. +ok !$c->reval(q{use 5.012; $undeclared; 1}), + 'reval does not prevent use 5.012 from enabling strict'; diff --git a/dist/Safe/t/safeops.t b/dist/Safe/t/safeops.t index 616a848..885b0db 100644 --- a/dist/Safe/t/safeops.t +++ b/dist/Safe/t/safeops.t @@ -12,10 +12,13 @@ BEGIN { if ($Config{'extensions'} !~ /\bOpcode\b/ && $Config{'osname'} ne 'VMS') { print "1..0\n"; exit 0; } + + # We need test.pl for runperl(). Since this test script is only run in + # the perl core, this should be fine: + require '../../t/test.pl'; } use strict; -use Test::More; use Safe; # Read the op names and descriptions directly from opcode.pl @@ -37,7 +40,7 @@ while (<$fh>) { } close $fh; -plan(tests => scalar @op); +plan(tests => scalar @op + 1); sub testop { my ($op, $opname, $code) = @_; @@ -53,11 +56,25 @@ foreach (@op) { if ($_->[2]) { testop @$_; } else { - local $TODO = "No test yet for $_->[1]"; + local our $TODO = "No test yet for $_->[1]"; fail(); } } +# Test also that the errors resulting from disallowed ops do not cause +# âUnbalancedâ warnings. +{ + local $ENV{PERL_DESTRUCT_LEVEL}=2; + unlike + runperl( + switches => [ '-MSafe', '-w' ], + prog => 'Safe->new->reval(q(use strict))', + stderr => 1, + ), + qr/Unbalanced/, + 'No Unbalanced warnings when disallowing ops'; +} + # things that begin with SKIP are skipped, for various reasons (notably # optree modified by the optimizer -- Safe checks are done before the # optimizer modifies the optree) diff --git a/hints/netbsd.sh b/hints/netbsd.sh index 4ecd181..17a4ff6 100644 --- a/hints/netbsd.sh +++ b/hints/netbsd.sh @@ -89,7 +89,7 @@ case "$osvers" in ;; esac case "$osvers" in -0.9*|1.*|2.*|3.*|4.*|5.*) +0.9*|1.*|2.*|3.*|4.*|5.*|6.*) d_getprotoent_r="$undef" d_getprotobyname_r="$undef" d_getprotobynumber_r="$undef" diff --git a/uconfig.h b/uconfig.h index d17bd9a..fc958ed 100644 --- a/uconfig.h +++ b/uconfig.h @@ -4735,5 +4735,5 @@ /* Generated from: * d9b6a68b192c72c0695b560fae6e4916b381f55df5fdf7911b0ef434840f092e config_h.SH - * 3dad514f97a86deca0eebb6544f7785077651da24e7c6231ef7a22963ff4fd5d uconfig.sh + * 57694ed3f0d8607c648dcda8db17e8301e376b16cd7b7bed04772c713c1d5818 uconfig.sh * ex: set ro: */ diff --git a/uconfig.sh b/uconfig.sh index 076fde4..11ad894 100644 --- a/uconfig.sh +++ b/uconfig.sh @@ -638,6 +638,7 @@ intsize='4' ivdformat='"ld"' ivsize='4' ivtype='long' +ld_can_script='define' lib_ext='.a' localtime_r_proto='0' longdblsize=8 -- Perl5 Master Repository