r7841 - in /trunk/libversion-perl: Changes META.yml Makefile.PL README debian/changelog debian/watch lib/version.pm t/coretests.pm vperl/vpp.pm vutil/lib/version/vxs.pm vutil/vutil.c
dmn at users.alioth.debian.org
dmn at users.alioth.debian.org
Sat Sep 22 05:50:12 UTC 2007
Author: dmn
Date: Sat Sep 22 05:50:12 2007
New Revision: 7841
URL: http://svn.debian.org/wsvn/?sc=1&rev=7841
Log:
* New upstream release
Provide special handling for version numbers too large to represent as an
ordinary integer.
* Adapted debian/watch to cope with either two-digit or four-digit version
numbers
Modified:
trunk/libversion-perl/Changes
trunk/libversion-perl/META.yml
trunk/libversion-perl/Makefile.PL
trunk/libversion-perl/README
trunk/libversion-perl/debian/changelog
trunk/libversion-perl/debian/watch
trunk/libversion-perl/lib/version.pm
trunk/libversion-perl/t/coretests.pm
trunk/libversion-perl/vperl/vpp.pm
trunk/libversion-perl/vutil/lib/version/vxs.pm
trunk/libversion-perl/vutil/vutil.c
Modified: trunk/libversion-perl/Changes
URL: http://svn.debian.org/wsvn/trunk/libversion-perl/Changes?rev=7841&op=diff
==============================================================================
--- trunk/libversion-perl/Changes (original)
+++ trunk/libversion-perl/Changes Sat Sep 22 05:50:12 2007
@@ -1,3 +1,9 @@
+2007-09-20 John Peacock <jpeacock at cpan.org>
+
+ New code to handle versions too large to fit into an IV slot.
+ Both the pure Perl and XS code are now safe to use with ~0
+ Test new functionality.
+
2007-04-17 John Peacock <jpeacock at cpan.org>
Neglected to delete or comment out a $DB::single (again).
Modified: trunk/libversion-perl/META.yml
URL: http://svn.debian.org/wsvn/trunk/libversion-perl/META.yml?rev=7841&op=diff
==============================================================================
--- trunk/libversion-perl/META.yml (original)
+++ trunk/libversion-perl/META.yml Sat Sep 22 05:50:12 2007
@@ -1,6 +1,6 @@
---
name: version
-version: 0.7203
+version: 0.73
author:
- 'John Peacock E<lt>jpeacock at cpan.orgE<gt>'
abstract: Perl extension for Version Objects
@@ -13,11 +13,11 @@
provides:
version:
file: lib/version.pm
- version: 0.7203
+ version: 0.73
version::vxs:
file: vutil/lib/version/vxs.pm
- version: 0.7203
-generated_by: Module::Build version 0.2807
+ version: 0.73
+generated_by: Module::Build version 0.2808
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.2.html
version: 1.2
Modified: trunk/libversion-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/trunk/libversion-perl/Makefile.PL?rev=7841&op=diff
==============================================================================
--- trunk/libversion-perl/Makefile.PL (original)
+++ trunk/libversion-perl/Makefile.PL Sat Sep 22 05:50:12 2007
@@ -10,6 +10,11 @@
use File::Spec;
use vars qw ($no_xs $force_xs);
+
+if ( $] >= 5.009_001 && $] < 5.010_000 ) {
+ die "The CPAN module cannot be tested with Perl $]\n".
+ "Please update to the latest bleadperl...";
+}
for (@ARGV)
{
@@ -75,6 +80,7 @@
print MAKEFILE $_;
}
close MAKEFILE;
+ sleep(1);
@{ $hash }{ 'DIR' } = ['vutil'];
}
Modified: trunk/libversion-perl/README
URL: http://svn.debian.org/wsvn/trunk/libversion-perl/README?rev=7841&op=diff
==============================================================================
--- trunk/libversion-perl/README (original)
+++ trunk/libversion-perl/README Sat Sep 22 05:50:12 2007
@@ -1,4 +1,4 @@
-version 0.7203
+version 0.73
==================================
Provides the same version objects as included in Perl v5.9.x (and in the
@@ -9,6 +9,12 @@
in the core). If you are testing 5.9.x, you must check out bleadperl in
order to get the current changes (the CPAN release has no effect in
bleadperl).
+
+Major Changes in 0.73 - 2007-09-18
+===================================
+
+Provide special handling for version numbers too large to represent as an
+ordinary integer.
Major changes in 0.7203 - 2007-04-17
=====================================
Modified: trunk/libversion-perl/debian/changelog
URL: http://svn.debian.org/wsvn/trunk/libversion-perl/debian/changelog?rev=7841&op=diff
==============================================================================
--- trunk/libversion-perl/debian/changelog (original)
+++ trunk/libversion-perl/debian/changelog Sat Sep 22 05:50:12 2007
@@ -1,3 +1,13 @@
+libversion-perl (1:0.7300-1) UNRELEASED; urgency=low
+
+ * New upstream release
+ Provide special handling for version numbers too large to represent as an
+ ordinary integer.
+ * Adapted debian/watch to cope with either two-digit or four-digit version
+ numbers
+
+ -- Damyan Ivanov <dmn at debian.org> Sat, 22 Sep 2007 08:49:45 +0300
+
libversion-perl (1:0.7203-1) unstable; urgency=low
* New upstream release
Modified: trunk/libversion-perl/debian/watch
URL: http://svn.debian.org/wsvn/trunk/libversion-perl/debian/watch?rev=7841&op=diff
==============================================================================
--- trunk/libversion-perl/debian/watch (original)
+++ trunk/libversion-perl/debian/watch Sat Sep 22 05:50:12 2007
@@ -1,2 +1,3 @@
version=3
+opts="uversionmangle=s/(?<=\.\d\d)(?=$)/00/" \
http://www.cpan.org/authors/id/J/JP/JPEACOCK/version-([\d\.]+)\.tar\.gz
Modified: trunk/libversion-perl/lib/version.pm
URL: http://svn.debian.org/wsvn/trunk/libversion-perl/lib/version.pm?rev=7841&op=diff
==============================================================================
--- trunk/libversion-perl/lib/version.pm (original)
+++ trunk/libversion-perl/lib/version.pm Sat Sep 22 05:50:12 2007
@@ -6,7 +6,7 @@
use vars qw(@ISA $VERSION $CLASS *qv);
-$VERSION = 0.7203;
+$VERSION = 0.73;
$CLASS = 'version';
Modified: trunk/libversion-perl/t/coretests.pm
URL: http://svn.debian.org/wsvn/trunk/libversion-perl/t/coretests.pm?rev=7841&op=diff
==============================================================================
--- trunk/libversion-perl/t/coretests.pm (original)
+++ trunk/libversion-perl/t/coretests.pm Sat Sep 22 05:50:12 2007
@@ -472,6 +472,14 @@
eval 'my $v = $CLASS->new("1._1");';
unlike($@, qr/^Invalid version format \(alpha with zero width\)/,
"Invalid version format 1._1");
+
+ {
+ my $warning;
+ local $SIG{__WARN__} = sub { $warning = $_[0] };
+ eval 'my $v = $CLASS->new(~0);';
+ unlike($@, qr/Integer overflow in version/, "Too large version");
+ like($warning, qr/Integer overflow in version/, "Too large version");
+ }
}
Modified: trunk/libversion-perl/vperl/vpp.pm
URL: http://svn.debian.org/wsvn/trunk/libversion-perl/vperl/vpp.pm?rev=7841&op=diff
==============================================================================
--- trunk/libversion-perl/vperl/vpp.pm (original)
+++ trunk/libversion-perl/vperl/vpp.pm Sat Sep 22 05:50:12 2007
@@ -3,7 +3,7 @@
use locale;
use vars qw ($VERSION @ISA @REGEXS);
-$VERSION = 0.7203;
+$VERSION = 0.73;
push @REGEXS, qr/
^v? # optional leading 'v'
@@ -20,6 +20,17 @@
'bool' => \&vbool,
'nomethod' => \&vnoop,
);
+
+my $VERSION_MAX = 0x7FFFFFFF;
+
+eval "use warnings";
+if ($@) {
+ eval '
+ package warnings;
+ sub enabled {return $^W;}
+ 1;
+ ';
+}
sub new
{
@@ -73,6 +84,7 @@
my $alpha = 0;
my $width = 3;
my $saw_period = 0;
+ my $vinf = 0;
my ($start, $last, $pos, $s);
$s = 0;
@@ -91,9 +103,8 @@
while ( substr($value,$pos,1) =~ /[._\d]/ ) {
if ( substr($value,$pos,1) eq '.' ) {
if ($alpha) {
- require Carp;
Carp::croak("Invalid version format ".
- "(underscores before decimal)");
+ "(underscores before decimal)");
}
$saw_period++;
$last = $pos;
@@ -102,7 +113,7 @@
if ($alpha) {
require Carp;
Carp::croak("Invalid version format ".
- "(multiple underscores)");
+ "(multiple underscores)");
}
$alpha = 1;
$width = $pos - $last - 1; # natural width of sub-version
@@ -112,18 +123,21 @@
if ( $alpha && !$saw_period ) {
require Carp;
- Carp::croak("Invalid version format (alpha without decimal)");
+ Carp::croak("Invalid version format ".
+ "(alpha without decimal)");
}
if ( $alpha && $saw_period && $width == 0 ) {
require Carp;
- Carp::croak("Invalid version format (misplaced _ in number)");
+ Carp::croak("Invalid version format ".
+ "(misplaced _ in number)");
}
if ( $saw_period > 1 ) {
$qv = 1; # force quoted version processing
}
+ $last = $pos;
$pos = $s;
if ( $qv ) {
@@ -163,9 +177,14 @@
$orev = $rev;
$rev += substr($value,$s,1) * $mult;
$mult /= 10;
- if ( abs($orev) > abs($rev) ) {
- require Carp;
- Carp::croak("Integer overflow in version");
+ if ( abs($orev) > abs($rev)
+ || abs($rev) > abs($VERSION_MAX) ) {
+ if ( warnings::enabled("overflow") ) {
+ require Carp;
+ Carp::carp("Integer overflow in version");
+ }
+ $s = $end - 1;
+ $rev = $VERSION_MAX;
}
$s++;
if ( substr($value,$s,1) eq '_' ) {
@@ -178,9 +197,14 @@
$orev = $rev;
$rev += substr($value,$end,1) * $mult;
$mult *= 10;
- if ( abs($orev) > abs($rev) ) {
- require Carp;
- Carp::croak("Integer overflow in version");
+ if ( abs($orev) > abs($rev)
+ || abs($rev) > abs($VERSION_MAX) ) {
+ if ( warnings::enabled("overflow") ) {
+ require Carp;
+ Carp::carp("Integer overflow in version");
+ }
+ $end = $s - 1;
+ $rev = $VERSION_MAX;
}
}
}
@@ -228,12 +252,21 @@
}
if ( substr($value,$pos) ) { # any remaining text
- warn "Version string '$value' contains invalid data; ".
- "ignoring: '".substr($value,$pos)."'";
+ if ( warnings::enabled("misc") ) {
+ require Carp;
+ Carp::carp("Version string '$value' contains invalid data; ".
+ "ignoring: '".substr($value,$pos)."'");
+ }
}
# cache the original value for use when stringification
- $self->{original} = substr($value,0,$pos);
+ if ( $vinf ) {
+ $self->{vinf} = 1;
+ $self->{original} = 'v.Inf';
+ }
+ else {
+ $self->{original} = substr($value,0,$pos);
+ }
return ($self);
}
Modified: trunk/libversion-perl/vutil/lib/version/vxs.pm
URL: http://svn.debian.org/wsvn/trunk/libversion-perl/vutil/lib/version/vxs.pm?rev=7841&op=diff
==============================================================================
--- trunk/libversion-perl/vutil/lib/version/vxs.pm (original)
+++ trunk/libversion-perl/vutil/lib/version/vxs.pm Sat Sep 22 05:50:12 2007
@@ -9,7 +9,7 @@
@ISA = qw(DynaLoader);
-$VERSION = 0.7203;
+$VERSION = 0.73;
$CLASS = 'version::vxs';
Modified: trunk/libversion-perl/vutil/vutil.c
URL: http://svn.debian.org/wsvn/trunk/libversion-perl/vutil/vutil.c?rev=7841&op=diff
==============================================================================
--- trunk/libversion-perl/vutil/vutil.c (original)
+++ trunk/libversion-perl/vutil/vutil.c Sat Sep 22 05:50:12 2007
@@ -8,6 +8,7 @@
#include "ppport.h"
#include "vutil.h"
+#define VERSION_MAX 0x7FFFFFFF
/*
=for apidoc scan_version
@@ -39,6 +40,7 @@
int saw_period = 0;
int alpha = 0;
int width = 3;
+ bool vinf = FALSE;
AV * const av = newAV();
SV * const hv = newSVrv(rv, "version"); /* create an SV and upgrade the RV */
(void)sv_upgrade(hv, SVt_PVHV); /* needs to be an HV type */
@@ -88,6 +90,7 @@
if ( saw_period > 1 )
qv = 1; /* force quoted version processing */
+ last = pos;
pos = s;
if ( qv )
@@ -108,7 +111,7 @@
/* this is atoi() that delimits on underscores */
const char *end = pos;
I32 mult = 1;
- I32 orev;
+ I32 orev;
/* the following if() will only be true after the decimal
* point of a version originally created with a bare
@@ -117,11 +120,18 @@
if ( !qv && s > start && saw_period == 1 ) {
mult *= 100;
while ( s < end ) {
- orev = rev;
+ orev = rev;
rev += (*s - '0') * mult;
mult /= 10;
- if ( PERL_ABS(orev) > PERL_ABS(rev) )
- Perl_croak(aTHX_ "Integer overflow in version");
+ if ( (PERL_ABS(orev) > PERL_ABS(rev))
+ || (PERL_ABS(rev) > VERSION_MAX )) {
+ if(ckWARN(WARN_OVERFLOW))
+ Perl_warner(aTHX_ packWARN(WARN_OVERFLOW),
+ "Integer overflow in version %d",VERSION_MAX);
+ s = end - 1;
+ rev = VERSION_MAX;
+ vinf = 1;
+ }
s++;
if ( *s == '_' )
s++;
@@ -129,18 +139,29 @@
}
else {
while (--end >= s) {
- orev = rev;
+ orev = rev;
rev += (*end - '0') * mult;
mult *= 10;
- if ( PERL_ABS(orev) > PERL_ABS(rev) )
- Perl_croak(aTHX_ "Integer overflow in version");
+ if ( (PERL_ABS(orev) > PERL_ABS(rev))
+ || (PERL_ABS(rev) > VERSION_MAX )) {
+ if(ckWARN(WARN_OVERFLOW))
+ Perl_warner(aTHX_ packWARN(WARN_OVERFLOW),
+ "Integer overflow in version");
+ end = s - 1;
+ rev = VERSION_MAX;
+ vinf = 1;
+ }
}
}
}
/* Append revision */
av_push(av, newSViv(rev));
- if ( *pos == '.' )
+ if ( vinf ) {
+ s = last;
+ break;
+ }
+ else if ( *pos == '.' )
s = ++pos;
else if ( *pos == '_' && isDIGIT(pos[1]) )
s = ++pos;
@@ -179,7 +200,12 @@
}
/* need to save off the current version string for later */
- if ( s > start ) {
+ if ( vinf ) {
+ SV * orig = newSVpvn("v.Inf", sizeof("v.Inf")-1);
+ hv_store((HV *)hv, "original", 8, orig, 0);
+ hv_store((HV *)hv, "vinf", 4, newSViv(1), 0);
+ }
+ else if ( s > start ) {
SV * orig = newSVpvn(start,s-start);
if ( qv && saw_period == 1 && *start != 'v' ) {
/* need to insert a v to be consistent */
More information about the Pkg-perl-cvs-commits
mailing list