r7838 - in /branches/upstream/libversion-perl/current: Changes META.yml Makefile.PL README 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:47:11 UTC 2007


Author: dmn
Date: Sat Sep 22 05:47:10 2007
New Revision: 7838

URL: http://svn.debian.org/wsvn/?sc=1&rev=7838
Log:
[svn-upgrade] Integrating new upstream version, libversion-perl (0.7300)

Modified:
    branches/upstream/libversion-perl/current/Changes
    branches/upstream/libversion-perl/current/META.yml
    branches/upstream/libversion-perl/current/Makefile.PL
    branches/upstream/libversion-perl/current/README
    branches/upstream/libversion-perl/current/lib/version.pm
    branches/upstream/libversion-perl/current/t/coretests.pm
    branches/upstream/libversion-perl/current/vperl/vpp.pm
    branches/upstream/libversion-perl/current/vutil/lib/version/vxs.pm
    branches/upstream/libversion-perl/current/vutil/vutil.c

Modified: branches/upstream/libversion-perl/current/Changes
URL: http://svn.debian.org/wsvn/branches/upstream/libversion-perl/current/Changes?rev=7838&op=diff
==============================================================================
--- branches/upstream/libversion-perl/current/Changes (original)
+++ branches/upstream/libversion-perl/current/Changes Sat Sep 22 05:47:10 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: branches/upstream/libversion-perl/current/META.yml
URL: http://svn.debian.org/wsvn/branches/upstream/libversion-perl/current/META.yml?rev=7838&op=diff
==============================================================================
--- branches/upstream/libversion-perl/current/META.yml (original)
+++ branches/upstream/libversion-perl/current/META.yml Sat Sep 22 05:47:10 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: branches/upstream/libversion-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/branches/upstream/libversion-perl/current/Makefile.PL?rev=7838&op=diff
==============================================================================
--- branches/upstream/libversion-perl/current/Makefile.PL (original)
+++ branches/upstream/libversion-perl/current/Makefile.PL Sat Sep 22 05:47:10 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: branches/upstream/libversion-perl/current/README
URL: http://svn.debian.org/wsvn/branches/upstream/libversion-perl/current/README?rev=7838&op=diff
==============================================================================
--- branches/upstream/libversion-perl/current/README (original)
+++ branches/upstream/libversion-perl/current/README Sat Sep 22 05:47:10 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: branches/upstream/libversion-perl/current/lib/version.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libversion-perl/current/lib/version.pm?rev=7838&op=diff
==============================================================================
--- branches/upstream/libversion-perl/current/lib/version.pm (original)
+++ branches/upstream/libversion-perl/current/lib/version.pm Sat Sep 22 05:47:10 2007
@@ -6,7 +6,7 @@
 
 use vars qw(@ISA $VERSION $CLASS *qv);
 
-$VERSION = 0.7203;
+$VERSION = 0.73;
 
 $CLASS = 'version';
 

Modified: branches/upstream/libversion-perl/current/t/coretests.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libversion-perl/current/t/coretests.pm?rev=7838&op=diff
==============================================================================
--- branches/upstream/libversion-perl/current/t/coretests.pm (original)
+++ branches/upstream/libversion-perl/current/t/coretests.pm Sat Sep 22 05:47:10 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: branches/upstream/libversion-perl/current/vperl/vpp.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libversion-perl/current/vperl/vpp.pm?rev=7838&op=diff
==============================================================================
--- branches/upstream/libversion-perl/current/vperl/vpp.pm (original)
+++ branches/upstream/libversion-perl/current/vperl/vpp.pm Sat Sep 22 05:47:10 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: branches/upstream/libversion-perl/current/vutil/lib/version/vxs.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libversion-perl/current/vutil/lib/version/vxs.pm?rev=7838&op=diff
==============================================================================
--- branches/upstream/libversion-perl/current/vutil/lib/version/vxs.pm (original)
+++ branches/upstream/libversion-perl/current/vutil/lib/version/vxs.pm Sat Sep 22 05:47:10 2007
@@ -9,7 +9,7 @@
 
 @ISA = qw(DynaLoader);
 
-$VERSION = 0.7203;
+$VERSION = 0.73;
 
 $CLASS = 'version::vxs';
 

Modified: branches/upstream/libversion-perl/current/vutil/vutil.c
URL: http://svn.debian.org/wsvn/branches/upstream/libversion-perl/current/vutil/vutil.c?rev=7838&op=diff
==============================================================================
--- branches/upstream/libversion-perl/current/vutil/vutil.c (original)
+++ branches/upstream/libversion-perl/current/vutil/vutil.c Sat Sep 22 05:47:10 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