In perl.git, the branch maint-5.12 has been updated <http://perl5.git.perl.org/perl.git/commitdiff/2f420d278aaae7859725c1813d9f6b7ea6a0fe55?hp=32eee7b2a40f73fbac2f621427e5a004f9d811ee>
- Log ----------------------------------------------------------------- commit 2f420d278aaae7859725c1813d9f6b7ea6a0fe55 Author: Jesse Vincent <[email protected]> Date: Thu May 13 16:00:26 2010 -0400 Perl 5.12.1 now includes Safe.pm 2.27. Module::CoreList should say so M dist/Module-CoreList/lib/Module/CoreList.pm commit 68586f71620639990e79199c361b0b612fe0dd18 Author: Jesse Vincent <[email protected]> Date: Thu May 13 15:58:51 2010 -0400 New release date for 5.12.1 in light of the new RC M dist/Module-CoreList/lib/Module/CoreList.pm M pod/perlhist.pod commit 7ecbc3da3c049655fce6b77e81d08f2025e54c57 Author: Jesse Vincent <[email protected]> Date: Thu May 13 15:55:40 2010 -0400 Note that we now include Safe.pm 2.27 M pod/perl5121delta.pod commit ffe434bf93bf81566455871a58825ad4f4734520 Author: Rafael Garcia-Suarez <[email protected]> Date: Tue May 4 15:36:47 2010 +0200 die() no longer propagates outside of a Safe compartment so mark the test for that as a TODO. We'll decide later what behaviour is desirable here. Note that it warns instead. M dist/Safe/t/safesort.t commit 506e320741acbbd16f78aeb1fa384c5e9ed1c395 Author: Rafael Garcia-Suarez <[email protected]> Date: Thu Apr 29 22:25:36 2010 +0200 Bump Safe's version to 2.27 and update Changes and META.yml M dist/Safe/Changes M dist/Safe/META.yml M dist/Safe/Safe.pm commit 8c4f6d1697b224348f414b009ae6062fb24768df Author: Rafael Garcia-Suarez <[email protected]> Date: Thu Apr 29 17:13:42 2010 +0200 Mention that Safe::reval() no wraps returned coderefs M dist/Safe/Safe.pm commit 41f5edcf34994a7fecc17228dfa4bbfd30818c61 Author: Rafael Garcia-Suarez <[email protected]> Date: Thu Apr 29 13:02:27 2010 +0200 Revert "Un-TODO warning test" This reverts commit efbe327085cc15510d8c261772e9ac21be3635de. M dist/Safe/t/safesort.t commit a46e80ed642ab023aa78575b0e7f7bb22bb05efe Author: Rafael Garcia-Suarez <[email protected]> Date: Thu Apr 29 13:02:01 2010 +0200 Wrap by default coderefs returned by rdo and reval (suggested by Tim Bunce) M dist/Safe/Safe.pm M dist/Safe/t/safesort.t commit 9530b26ab64ab10c3f9463ada0c7b7c630c1f0f3 Author: Rafael Garcia-Suarez <[email protected]> Date: Thu Apr 29 12:30:06 2010 +0200 Add &version::vxs::stringify to the default share M dist/Safe/Safe.pm commit 759efeb57373ab491460d0540cd0476f7c04a520 Author: Rafael Garcia-Suarez <[email protected]> Date: Tue Mar 9 10:08:37 2010 +0100 Bump version to 2.26 M dist/Safe/Changes M dist/Safe/META.yml M dist/Safe/Safe.pm commit cbfe6b993239fc26ff053a2a8c22c2631a930d7e Author: Rafael Garcia-Suarez <[email protected]> Date: Tue Mar 9 11:06:43 2010 +0100 More backwards-compatible way to force loading of SWASHNEW in Safe M dist/Safe/Safe.pm M dist/Safe/t/safeutf8.t commit 47cadbf5184ffeea1fd5457f8355ab6075226769 Author: Rafael Garcia-Suarez <[email protected]> Date: Mon Mar 8 16:11:43 2010 +0100 B::sub_generation is not available for perls < 5.8.9 M dist/Safe/Safe.pm commit e13a24c7c450550de857d73dc39be8bf246d97c1 Author: Jesse Vincent <[email protected]> Date: Thu May 13 13:07:06 2010 -0400 We'll have an RC2. M patchlevel.h ----------------------------------------------------------------------- Summary of changes: dist/Module-CoreList/lib/Module/CoreList.pm | 6 ++-- dist/Safe/Changes | 7 ++++++ dist/Safe/META.yml | 28 +++++++++++++++++--------- dist/Safe/Safe.pm | 26 +++++++++++++++++++----- dist/Safe/t/safesort.t | 10 ++------ dist/Safe/t/safeutf8.t | 4 +- patchlevel.h | 4 +- pod/perl5121delta.pod | 4 +++ pod/perlhist.pod | 2 +- 9 files changed, 60 insertions(+), 31 deletions(-) diff --git a/dist/Module-CoreList/lib/Module/CoreList.pm b/dist/Module-CoreList/lib/Module/CoreList.pm index 4dbcac7..dd88b45 100644 --- a/dist/Module-CoreList/lib/Module/CoreList.pm +++ b/dist/Module-CoreList/lib/Module/CoreList.pm @@ -2,7 +2,7 @@ package Module::CoreList; use strict; use vars qw/$VERSION %released %version %families %upstream %bug_tracker %deprecated/; -$VERSION = '2.32'; +$VERSION = '2.33'; =head1 NAME @@ -325,7 +325,7 @@ sub removed_raw { 5.011005 => '2010-02-20', 5.012000 => '2010-04-12', 5.013000 => '2010-04-20', - 5.012001 => '2010-05-13', + 5.012001 => '2010-05-16', ); for my $version ( sort { $a <=> $b } keys %released ) { @@ -15255,7 +15255,7 @@ for my $version ( sort { $a <=> $b } keys %released ) { 'Pod::Text::Termcap' => '2.06', 'Pod::Usage' => '1.36', 'SDBM_File' => '1.06', - 'Safe' => '2.25', + 'Safe' => '2.27', 'Scalar::Util' => '1.22', 'Scalar::Util::PP' => '1.22', 'Search::Dict' => '1.02', diff --git a/dist/Safe/Changes b/dist/Safe/Changes index f246eb7..a00878b 100644 --- a/dist/Safe/Changes +++ b/dist/Safe/Changes @@ -1,3 +1,10 @@ +2.27 Thu Apr 29 2010 + - Wrap coderefs returned by reval() and rdo() + - Add even more version::vxs routines to the default share + +2.26 Mon Mar 9 2010 + - Restore compatibility with perls < 5.8.9 + 2.25 Sun Mar 7 2010 - More security fixes by Nick Cleaton diff --git a/dist/Safe/META.yml b/dist/Safe/META.yml index 2afb0d5..6718a37 100644 --- a/dist/Safe/META.yml +++ b/dist/Safe/META.yml @@ -1,12 +1,20 @@ --- #YAML:1.0 -name: Safe -version: 2.25 -abstract: ~ -license: ~ -author: ~ -generated_by: ExtUtils::MakeMaker version 6.42 -distribution_type: module -requires: +name: Safe +version: 2.27 +abstract: ~ +author: [] +license: unknown +distribution_type: module +configure_requires: + ExtUtils::MakeMaker: 0 +build_requires: + ExtUtils::MakeMaker: 0 +requires: {} +no_index: + directory: + - t + - inc +generated_by: ExtUtils::MakeMaker version 6.56 meta-spec: - url: http://module-build.sourceforge.net/META-spec-v1.3.html - version: 1.3 + url: http://module-build.sourceforge.net/META-spec-v1.4.html + version: 1.4 diff --git a/dist/Safe/Safe.pm b/dist/Safe/Safe.pm index e33598e..bca4dfe 100644 --- a/dist/Safe/Safe.pm +++ b/dist/Safe/Safe.pm @@ -3,9 +3,8 @@ package Safe; use 5.003_11; use strict; use Scalar::Util qw(reftype); -use B qw(sub_generation); -$Safe::VERSION = "2.25"; +$Safe::VERSION = "2.27"; # *** Don't declare any lexicals above this point *** # @@ -32,6 +31,18 @@ BEGIN { eval q{ use Carp::Heavy; } } +use B (); +BEGIN { + no strict 'refs'; + if (defined &B::sub_generation) { + *sub_generation = \&B::sub_generation; + } + else { + # fake sub generation changing for perls < 5.8.9 + my $sg; *sub_generation = sub { ++$sg }; + } +} + use Opcode 1.01, qw( opset opset_to_ops opmask_add empty_opset full_opset invert_opset verify_opset @@ -55,7 +66,7 @@ require utf8; # and also loads the ToFold SWASH. # (Swashes are cached internally by perl in PL_utf8_* variables # independent of being inside/outside of Safe. So once loaded they can be) -do { my $unicode = pack('U',0xC4).'1a'; $unicode =~ /\xE4/i; }; +do { my $a = pack('U',0xC4); my $b = chr 0xE4; utf8::upgrade $b; $a =~ /$b/i }; # now we can safely include utf8::SWASHNEW in $default_share defined below. my $default_root = 0; @@ -120,6 +131,7 @@ my $default_share = [qw[ &version::vxs::declare &version::vxs::qv &version::vxs::_VERSION + &version::vxs::stringify &version::vxs::new &version::vxs::parse ]), ($] >= 5.011 && qw[ @@ -346,6 +358,7 @@ sub reval { ? Opcode::_safe_call_sv($root, $obj->{Mask}, $evalsub) : scalar Opcode::_safe_call_sv($root, $obj->{Mask}, $evalsub); _clean_stash($root.'::') if $sg != sub_generation(); + $obj->wrap_code_refs_within(@subret); return (wantarray) ? @subret : $subret[0]; } @@ -424,6 +437,7 @@ sub rdo { ? Opcode::_safe_call_sv($root, $obj->{Mask}, $evalsub) : scalar Opcode::_safe_call_sv($root, $obj->{Mask}, $evalsub); _clean_stash($root.'::') if $sg != sub_generation(); + $obj->wrap_code_refs_within(@subret); return (wantarray) ? @subret : $subret[0]; } @@ -637,9 +651,9 @@ expression evaluated, or a return statement may be used, just as with subroutines and B<eval()>. The context (list or scalar) is determined by the caller as usual. -This behaviour differs from the beta distribution of the Safe extension -where earlier versions of perl made it hard to mimic the return -behaviour of the eval() command and the context was always scalar. +If the return value of reval() is (or contains) any code reference, +those code references are wrapped to be themselves executed always +in the compartment. See L</wrap_code_refs_within>. The formerly undocumented STRICT argument sets strictness: if true 'use strict;' is used, otherwise it uses 'no strict;'. B<Note>: if diff --git a/dist/Safe/t/safesort.t b/dist/Safe/t/safesort.t index 797e155..366358d 100644 --- a/dist/Safe/t/safesort.t +++ b/dist/Safe/t/safesort.t @@ -33,13 +33,7 @@ EOS is $@, '', 'reval should not fail'; is ref $func, 'CODE', 'reval should return a CODE ref'; -# $func1 will work in non-threaded perl -# but RT#60374 "Safe.pm sort {} bug with -Dusethreads" -# means the sorting won't work unless we wrap the code ref -# such that it's executed with Safe 'in effect' at runtime -my $func2 = $safe->wrap_code_ref($func1); - -my ($l_sorted, $p_sorted) = $func2->(3,1,2); +my ($l_sorted, $p_sorted) = $func1->(3,1,2); is $l_sorted, "1,2,3"; is $p_sorted, "1,2,3"; @@ -55,7 +49,9 @@ is $@, 42, 'successful closure call should not alter $@'; { my $warns = 0; local $SIG{__WARN__} = sub { $warns++ }; + local $TODO = $] >= 5.013 ? "Doesn't die in 5.13" : undef; ok !eval { $die_func->("died\n"); 1 }, 'should die'; is $@, "died\n", '$@ should be set correctly'; + local $TODO = "Shouldn't warn"; is $warns, 0; } diff --git a/dist/Safe/t/safeutf8.t b/dist/Safe/t/safeutf8.t index 28441da..42b84ef 100644 --- a/dist/Safe/t/safeutf8.t +++ b/dist/Safe/t/safeutf8.t @@ -16,12 +16,12 @@ use Opcode qw(full_opset); pass; my $safe = Safe->new('PLPerl'); -$safe->permit(qw(pack)); +$safe->deny_only(); # Expression that triggers require utf8 and call to SWASHNEW. # Fails with "Undefined subroutine PLPerl::utf8::SWASHNEW called" # if SWASHNEW is not shared, else returns true if unicode logic is working. -my $trigger = q{ my $a = pack('U',0xC4); $a =~ /\\xE4/i }; +my $trigger = q{ my $a = pack('U',0xC4); my $b = chr 0xE4; utf8::upgrade $b; $a =~ /$b/i }; ok $safe->reval( $trigger ), 'trigger expression should return true'; is $@, '', 'trigger expression should not die'; diff --git a/patchlevel.h b/patchlevel.h index f304b1e..2315246 100644 --- a/patchlevel.h +++ b/patchlevel.h @@ -126,8 +126,8 @@ hunk. #include "git_version.h" # endif static const char * const local_patches[] = { - NULL - ,"RC0" + NULL, + "RC2" #ifdef PERL_GIT_UNCOMMITTED_CHANGES ,"uncommitted-changes" #endif diff --git a/pod/perl5121delta.pod b/pod/perl5121delta.pod index 01bde12..2c8a08f 100644 --- a/pod/perl5121delta.pod +++ b/pod/perl5121delta.pod @@ -58,6 +58,10 @@ parsing. We made a small fix to the L<CPANPLUS> test suite to fix an occasional spurious test failure. +=item * + +We upgraded L<Safe> to version 2.27 to wrap coderefs retured by C<reval()> and C<rdo()>. + =back =head1 Changes to Existing Documentation diff --git a/pod/perlhist.pod b/pod/perlhist.pod index 7e94e2c..fcbfa3b 100644 --- a/pod/perlhist.pod +++ b/pod/perlhist.pod @@ -411,7 +411,7 @@ the strings?). Jesse 5.12.0-RC1 2010-Mar-29 Jesse 5.12.0 2010-Apr-12 Leon 5.13.0 2010-Apr-20 - Jesse 5.12.1 2010-May-13 + Jesse 5.12.1 2010-May-16 =head2 SELECTED RELEASE SIZES -- Perl5 Master Repository
