diff options
author | John Peacock <jpeacock@cpan.org> | 2017-04-24 20:06:01 -0400 |
---|---|---|
committer | James E Keenan <jkeenan@cpan.org> | 2017-06-01 09:12:11 -0400 |
commit | dddb22758b5060ae9de978fbb03317185af97b24 (patch) | |
tree | b29bc938d145242ceda016a20b338fbaa0e31abc | |
parent | 53fdf12aede2fd58b0c5ee236a58025184f49def (diff) | |
download | perl-dddb22758b5060ae9de978fbb03317185af97b24.tar.gz |
Update core with version 0.9918
-rw-r--r-- | MANIFEST | 1 | ||||
-rw-r--r-- | cpan/version/lib/version.pm | 6 | ||||
-rw-r--r-- | cpan/version/lib/version/regex.pm | 16 | ||||
-rw-r--r-- | cpan/version/t/01base.t | 8 | ||||
-rw-r--r-- | cpan/version/t/02derived.t | 8 | ||||
-rw-r--r-- | cpan/version/t/03require.t | 8 | ||||
-rw-r--r-- | cpan/version/t/04strict_lax.t | 15 | ||||
-rw-r--r-- | cpan/version/t/05sigdie.t | 2 | ||||
-rw-r--r-- | cpan/version/t/06noop.t | 2 | ||||
-rw-r--r-- | cpan/version/t/07locale.t | 2 | ||||
-rw-r--r-- | cpan/version/t/08_corelist.t | 2 | ||||
-rw-r--r-- | cpan/version/t/09_list_util.t | 2 | ||||
-rw-r--r-- | cpan/version/t/11_taint.t | 24 | ||||
-rw-r--r-- | t/porting/customized.dat | 2 | ||||
-rw-r--r-- | vutil.c | 6 | ||||
-rw-r--r-- | vutil.h | 2 | ||||
-rw-r--r-- | vxs.inc | 11 |
17 files changed, 88 insertions, 29 deletions
@@ -3150,6 +3150,7 @@ cpan/version/t/07locale.t Tests for version objects cpan/version/t/08_corelist.t Tests for version objects cpan/version/t/09_list_util.t Tests for version objects cpan/version/t/10_lyon.t Tests for version objects +cpan/version/t/11_taint.t Tests for version objects cpan/version/t/coretests.pm Tests for version objects cpan/Win32/longpath.inc Win32 extension long path support cpan/Win32/Makefile.PL Win32 extension makefile writer diff --git a/cpan/version/lib/version.pm b/cpan/version/lib/version.pm index 36d130f2dc..c85e8a029b 100644 --- a/cpan/version/lib/version.pm +++ b/cpan/version/lib/version.pm @@ -10,7 +10,7 @@ if ($] >= 5.015) { use vars qw(@ISA $VERSION $CLASS $STRICT $LAX *declare *qv); -$VERSION = 0.9917; +$VERSION = 0.9918; $CLASS = 'version'; # avoid using Exporter @@ -18,7 +18,11 @@ require version::regex; *version::is_lax = \&version::regex::is_lax; *version::is_strict = \&version::regex::is_strict; *LAX = \$version::regex::LAX; +*LAX_DECIMAL_VERSION = \$version::regex::LAX_DECIMAL_VERSION; +*LAX_DOTTED_DECIMAL_VERSION = \$version::regex::LAX_DOTTED_DECIMAL_VERSION; *STRICT = \$version::regex::STRICT; +*STRICT_DECIMAL_VERSION = \$version::regex::STRICT_DECIMAL_VERSION; +*STRICT_DOTTED_DECIMAL_VERSION = \$version::regex::STRICT_DOTTED_DECIMAL_VERSION; sub import { no strict 'refs'; diff --git a/cpan/version/lib/version/regex.pm b/cpan/version/lib/version/regex.pm index d635c38d4b..8d66e19c00 100644 --- a/cpan/version/lib/version/regex.pm +++ b/cpan/version/lib/version/regex.pm @@ -2,9 +2,13 @@ package version::regex; use strict; -use vars qw($VERSION $CLASS $STRICT $LAX); +use vars qw( + $VERSION $CLASS $STRICT $LAX + $STRICT_DECIMAL_VERSION $STRICT_DOTTED_DECIMAL_VERSION + $LAX_DECIMAL_VERSION $LAX_DOTTED_DECIMAL_VERSION +); -$VERSION = 0.9917; +$VERSION = 0.9918; #--------------------------------------------------------------------------# # Version regexp components @@ -57,13 +61,13 @@ my $LAX_ALPHA_PART = qr/_[0-9]+/; # Strict decimal version number. -my $STRICT_DECIMAL_VERSION = +$STRICT_DECIMAL_VERSION = qr/ $STRICT_INTEGER_PART $FRACTION_PART? /x; # Strict dotted-decimal version number. Must have both leading "v" and # at least three parts, to avoid confusion with decimal syntax. -my $STRICT_DOTTED_DECIMAL_VERSION = +$STRICT_DOTTED_DECIMAL_VERSION = qr/ v $STRICT_INTEGER_PART $STRICT_DOTTED_DECIMAL_PART{2,} /x; # Complete strict version number syntax -- should generally be used @@ -80,7 +84,7 @@ $STRICT = # allowing an alpha suffix or allowing a leading or trailing # decimal-point -my $LAX_DECIMAL_VERSION = +$LAX_DECIMAL_VERSION = qr/ $LAX_INTEGER_PART (?: $FRACTION_PART | \. )? $LAX_ALPHA_PART? | $FRACTION_PART $LAX_ALPHA_PART? @@ -92,7 +96,7 @@ my $LAX_DECIMAL_VERSION = # enough, without the leading "v", Perl takes .1.2 to mean v0.1.2, # so when there is no "v", the leading part is optional -my $LAX_DOTTED_DECIMAL_VERSION = +$LAX_DOTTED_DECIMAL_VERSION = qr/ v $LAX_INTEGER_PART (?: $LAX_DOTTED_DECIMAL_PART+ $LAX_ALPHA_PART? )? | diff --git a/cpan/version/t/01base.t b/cpan/version/t/01base.t index 8e5ab71ce8..df0f6f096e 100644 --- a/cpan/version/t/01base.t +++ b/cpan/version/t/01base.t @@ -8,11 +8,13 @@ use Test::More qw/no_plan/; use File::Spec; BEGIN { - my $coretests = File::Spec->catpath( - (File::Spec->splitpath($0))[0,1], 'coretests.pm' + my $coretests = File::Spec->rel2abs( + File::Spec->catpath( + (File::Spec->splitpath($0))[0,1], 'coretests.pm' + ) ); require $coretests; - use_ok('version', 0.9917); + use_ok('version', 0.9918); } BaseTests("version","new","qv"); diff --git a/cpan/version/t/02derived.t b/cpan/version/t/02derived.t index fb77270342..3191c9ad1a 100644 --- a/cpan/version/t/02derived.t +++ b/cpan/version/t/02derived.t @@ -9,11 +9,13 @@ use File::Spec; use File::Temp qw/tempfile/; BEGIN { - my $coretests = File::Spec->catpath( - (File::Spec->splitpath($0))[0,1], 'coretests.pm' + my $coretests = File::Spec->rel2abs( + File::Spec->catpath( + (File::Spec->splitpath($0))[0,1], 'coretests.pm' + ) ); require $coretests; - use_ok("version", 0.9917); + use_ok("version", 0.9918); # If we made it this far, we are ok. } diff --git a/cpan/version/t/03require.t b/cpan/version/t/03require.t index 6a968a5324..d4744867b4 100644 --- a/cpan/version/t/03require.t +++ b/cpan/version/t/03require.t @@ -8,8 +8,10 @@ use Test::More qw/no_plan/; use File::Spec; BEGIN { - my $coretests = File::Spec->catpath( - (File::Spec->splitpath($0))[0,1], 'coretests.pm' + my $coretests = File::Spec->rel2abs( + File::Spec->catpath( + (File::Spec->splitpath($0))[0,1], 'coretests.pm' + ) ); require $coretests; } @@ -17,7 +19,7 @@ BEGIN { # Don't want to use, because we need to make sure that the import doesn't # fire just yet (some code does this to avoid importing qv() and delare()). require_ok("version"); -is $version::VERSION, 0.9917, "Make sure we have the correct class"; +is $version::VERSION, 0.9918, "Make sure we have the correct class"; ok(!"main"->can("qv"), "We don't have the imported qv()"); ok(!"main"->can("declare"), "We don't have the imported declare()"); diff --git a/cpan/version/t/04strict_lax.t b/cpan/version/t/04strict_lax.t index 298fcf7f6f..861e4df2b5 100644 --- a/cpan/version/t/04strict_lax.t +++ b/cpan/version/t/04strict_lax.t @@ -21,6 +21,21 @@ SKIP: { ($v) = ( "snapshot-v1.2.3ga-001-432" =~ /($version::STRICT)/ ); is $v, 'v1.2.3', "Extract just the version: $v"; } + + is ref($version::LAX_DECIMAL_VERSION), 'Regexp', 'Can see $version::LAX_DECIMAL_VERSION '.$version::LAX_DECIMAL_VERSION ; + is ref($version::LAX_DOTTED_DECIMAL_VERSION), 'Regexp', 'Can see $version::LAX_DOTTED_DECIMAL_VERSION '.$version::LAX_DOTTED_DECIMAL_VERSION ; + is ref($version::STRICT_DECIMAL_VERSION), 'Regexp', 'Can see $version::STRICT_DECIMAL_VERSION '.$version::STRICT_DECIMAL_VERSION; + is ref($version::STRICT_DOTTED_DECIMAL_VERSION), 'Regexp', 'Can see $version::STRICT_DOTTED_DECIMAL_VERSION '.$version::STRICT_DOTTED_DECIMAL_VERSION; + { # https://rt.cpan.org/Ticket/Display.html?id=119669 + ($v) = ( "snapshot-1.2.3ga-001-432" =~ /($version::LAX_DOTTED_DECIMAL_VERSION)/ ); + is $v, '1.2.3', "Extract just the version: $v"; + ($v) = ( "snapshot-1.2ga-001-432" =~ /($version::LAX_DECIMAL_VERSION)/ ); + is $v, '1.2', "Extract just the version: $v"; + ($v) = ( "snapshot-v1.2.3ga-001-432" =~ /($version::STRICT_DOTTED_DECIMAL_VERSION)/ ); + is $v, 'v1.2.3', "Extract just the version: $v"; + ($v) = ( "snapshot-1.2ga-001-432" =~ /($version::STRICT_DECIMAL_VERSION)/ ); + is $v, '1.2', "Extract just the version: $v"; + } } diff --git a/cpan/version/t/05sigdie.t b/cpan/version/t/05sigdie.t index 6776adc164..3801a35ad6 100644 --- a/cpan/version/t/05sigdie.t +++ b/cpan/version/t/05sigdie.t @@ -14,7 +14,7 @@ BEGIN { } BEGIN { - use version 0.9917; + use version 0.9918; } pass "Didn't get caught by the wrong DIE handler, which is a good thing"; diff --git a/cpan/version/t/06noop.t b/cpan/version/t/06noop.t index f118786ffc..6c6de7f4f3 100644 --- a/cpan/version/t/06noop.t +++ b/cpan/version/t/06noop.t @@ -7,7 +7,7 @@ use Test::More qw/no_plan/; BEGIN { - use_ok('version', 0.9917); + use_ok('version', 0.9918); } my $v1 = version->new('1.2'); diff --git a/cpan/version/t/07locale.t b/cpan/version/t/07locale.t index 1dcc6db31a..a197bdcf16 100644 --- a/cpan/version/t/07locale.t +++ b/cpan/version/t/07locale.t @@ -11,7 +11,7 @@ use Test::More tests => 8; use Config; BEGIN { - use_ok('version', 0.9917); + use_ok('version', 0.9918); } SKIP: { diff --git a/cpan/version/t/08_corelist.t b/cpan/version/t/08_corelist.t index 4678c14926..92a76bdf78 100644 --- a/cpan/version/t/08_corelist.t +++ b/cpan/version/t/08_corelist.t @@ -5,7 +5,7 @@ ######################### use Test::More tests => 3; -use_ok("version", 0.9917); +use_ok("version", 0.9918); # do strict lax tests in a sub to isolate a package to test importing SKIP: { diff --git a/cpan/version/t/09_list_util.t b/cpan/version/t/09_list_util.t index 6e94839ab8..a263c2d47f 100644 --- a/cpan/version/t/09_list_util.t +++ b/cpan/version/t/09_list_util.t @@ -4,7 +4,7 @@ ######################### use strict; -use_ok("version", 0.9917); +use_ok("version", 0.9918); use Test::More; BEGIN { diff --git a/cpan/version/t/11_taint.t b/cpan/version/t/11_taint.t new file mode 100644 index 0000000000..5307b01268 --- /dev/null +++ b/cpan/version/t/11_taint.t @@ -0,0 +1,24 @@ +#!perl -T +use Test::More; +use version; + +BEGIN { + eval "use Test::Taint"; + if ($@) { + plan skip_all => "No Test::Taint available"; + } else { + plan tests => 6; + } +} + +taint_checking_ok(); +my $v = 'v1.2.3'; +taint($v); +tainted_ok($v, 'Set string as tainted'); +my $v2 = version->parse($v); +isnt("$v2", '', 'Correctly parsed the tainted string'); +tainted_ok($v2, 'Resulting version object is tainted'); + +my $vs = "$v2"; +tainted_ok($vs, 'Stringified object still tainted'); +is $v2, 'v1.2.3', 'Comparison to tainted object'; diff --git a/t/porting/customized.dat b/t/porting/customized.dat index 5014b3e210..4f247c563f 100644 --- a/t/porting/customized.dat +++ b/t/porting/customized.dat @@ -80,4 +80,4 @@ Test::Harness cpan/Test-Harness/lib/TAP/Parser/YAMLish/Writer.pm bf1fbfff9720330 Test::Harness cpan/Test-Harness/lib/Test/Harness.pm da2d76ba673372da129060c9d0adb8cf0d91f9f7 Test::Simple cpan/Test-Simple/t/Test2/modules/IPC/Driver/Files.t 59648b5745fda06177d81c2c21f55b09f6e129bb autodie cpan/autodie/t/mkdir.t 9e70d2282a3cc7d76a78bf8144fccba20fb37dac -version cpan/version/lib/version.pm a032a751524bdd07a93c945d2a1703abe7ad8ef0 +version cpan/version/lib/version.pm bee369df1bd84e09107a90d72ec12c38bcb97cce @@ -968,7 +968,11 @@ Perl_vstringify(pTHX_ SV *vs) if (svp) { SV *pv; pv = *svp; - if ( SvPOK(pv) ) + if ( SvPOK(pv) +#if PERL_VERSION_LT(5,17,2) + || SvPOKp(pv) +#endif + ) return newSVsv(pv); else return &PL_sv_undef; @@ -115,7 +115,7 @@ S_croak_xs_usage(pTHX_ const CV *const cv, const char *const params) Perl_croak_nocontext("Usage: %s(%s)", gvname, params); } else { /* Pants. I don't think that it should be possible to get here. */ - Perl_croak_nocontext("Usage: CODE(0x%"UVxf")(%s)", PTR2UV(cv), params); + Perl_croak_nocontext("Usage: CODE(0x%" UVxf ")(%s)", PTR2UV(cv), params); } } @@ -138,7 +138,7 @@ VXS(universal_version) name, SvPVx_nolen_const(req)); #else Perl_croak(aTHX_ - "%"HEKf" does not define $%"HEKf + "%" HEKf " does not define $%"HEKf "::VERSION--version check failed", HEKfARG(name), HEKfARG(name)); #endif @@ -146,7 +146,8 @@ VXS(universal_version) else { #if PERL_VERSION >= 8 Perl_croak(aTHX_ - "%"SVf" defines neither package nor VERSION--version check failed", + "%" SVf " defines neither package nor VERSION--" + "version check failed", (void*)(ST(0)) ); #else Perl_croak(aTHX_ "%s does not define $%s::VERSION--version check failed", @@ -162,7 +163,7 @@ VXS(universal_version) } if ( VCMP( req, sv ) > 0 ) { - if ( hv_existss(MUTABLE_HV(SvRV(req)), "qv") ) { + if ( hv_exists(MUTABLE_HV(SvRV(req)), "qv", 2 ) ) { req = VNORMAL(req); sv = VNORMAL(sv); } @@ -170,8 +171,8 @@ VXS(universal_version) req = VSTRINGIFY(req); sv = VSTRINGIFY(sv); } - Perl_croak(aTHX_ "%"HEKf" version %"SVf" required--" - "this is only version %"SVf"", HEKfARG(HvNAME_HEK(pkg)), + Perl_croak(aTHX_ "%" HEKf " version %" SVf " required--" + "this is only version %" SVf, HEKfARG(HvNAME_HEK(pkg)), SVfARG(sv_2mortal(req)), SVfARG(sv_2mortal(sv))); } |