Skip Menu |

This queue is for tickets about the version CPAN distribution.

Report information
The Basics
Id: 50347
Status: resolved
Priority: 0/
Queue: version

People
Owner: Nobody in particular
Requestors: pub08-bcard [...] davor.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in:
  • 0.76
  • 0.7702
Fixed in: (no value)



Subject: Version 1.2.3 does not compare less than 1.2.3.1 -- pure-Perl only
The pure-Perl variant of "version" fails the following test: use version; ok(qv(1.2.3) < qv(1.2.3.1)); This one passes: ok(qv("1.2.3") < qv("1.2.3.1")); Both pass under the XS version. Two files are attached: - bug.t file contains these two tests (plus variants with leading "v"s) - vpp.patch contains a suggested fix Thanks, - Eric "perl -V" output: Summary of my perl5 (revision 5 version 8 subversion 8) configuration: Platform: osname=linux, osvers=2.6.18-53.el5, archname=i386-linux-thread-multi uname='linux builder10.centos.org 2.6.18-53.el5 #1 smp mon nov 12 02:14:55 est 2007 i686 athlon i386 gnulinux ' config_args='-des -Doptimize=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -Dversion=5.8.8 -Dmyhostname=localhost -Dperladmin=root@localhost -Dcc=gcc -Dcf_by=Red Hat, Inc. -Dinstallprefix=/usr -Dprefix=/usr -Darchname=i386-linux -Dvendorprefix=/usr -Dsiteprefix=/usr -Duseshrplib -Dusethreads -Duseithreads -Duselargefiles -Dd_dosuid -Dd_semctl_semun -Di_db -Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio -Dinstallusrbinperl=n -Ubincompat5005 -Uversiononly -Dpager=/usr/bin/less -isr -Dd_gethostent_r_proto -Ud_endhostent_r_proto -Ud_sethostent_r_proto -Ud_endprotoent_r_proto -Ud_setprotoent_r_proto -Ud_endservent_r_proto -Ud_setservent_r_proto -Dinc_version_list=5.8.7 5.8.6 5.8.5 -Dscriptdir=/usr/bin' hint=recommended, useposix=true, d_sigaction=define usethreads=define use5005threads=undef useithreads=define usemultiplicity=define useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm', optimize='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables', cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -I/usr/include/gdbm' ccversion='', gccversion='4.1.2 20080704 (Red Hat 4.1.2-44)', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=4, prototype=define Linker and Libraries: ld='gcc', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib libs=-lresolv -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc perllibs=-lresolv -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc libc=/lib/libc-2.5.so, so=so, useshrplib=true, libperl=libperl.so gnulibc_version='2.5' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-rpath,/usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE' cccdlflags='-fPIC', lddlflags='-shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP USE_ITHREADS USE_LARGE_FILES USE_PERLIO USE_REENTRANT_API Built under linux Compiled at Apr 2 2009 19:40:19 %ENV: PERL_HOME="/usr/" @INC: /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.7/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl/5.8.7 /usr/lib/perl5/site_perl/5.8.6 /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.7/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl/5.8.7 /usr/lib/perl5/vendor_perl/5.8.6 /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.8/i386-linux-thread-multi /usr/lib/perl5/5.8.8 .
Subject: bug.t
#!/usr/bin/env perl $^W = 0; use warnings; use strict; use Test::More tests => 4; use version; # Check that the qv() implementation does not change ok(qv(1.2.3) < qv(1.2.3.1)); ok(qv(v1.2.3) < qv(v1.2.3.1)); ok(qv("1.2.3") < qv("1.2.3.1")); ok(qv("v1.2.3") < qv("v1.2.3.1"));
Subject: vpp.patch
diff -u ../vvanilla/vperl/vpp.pm vperl/vpp.pm --- ../vvanilla/vperl/vpp.pm 2009-09-07 19:25:38.000000000 -0400 +++ vperl/vpp.pm 2009-10-08 22:37:43.000000000 -0400 @@ -496,10 +496,11 @@ sub _un_vstring { my $value = shift; # may be a v-string - if ( $] >= 5.006_000 && length($value) == 3 && $value !~ /[._]/ + if ( $] >= 5.006_000 && length($value) >= 3 && $value !~ /[._]/ && (ord($value) < ord('0') || ord($value) > ord('9')) ) { my $tvalue = sprintf("v%vd",$value); - if ( $tvalue =~ /^v\d+\.\d+\.\d+$/ ) { + #if ( $tvalue =~ /^v\d+\.\d+\.[\d.]*\d$/ ) { + if ( $tvalue =~ /^v\d+(\.\d+){2,}$/ ) { # must be a v-string $value = $tvalue; }
The previous version of vpp.patch contains a superfluous commented-out line of code. This version fixes that. Sorry.
Subject: vpp.patch
diff -u ../vvanilla/vperl/vpp.pm vperl/vpp.pm --- ../vvanilla/vperl/vpp.pm 2009-09-07 19:25:38.000000000 -0400 +++ vperl/vpp.pm 2009-10-08 22:37:43.000000000 -0400 @@ -496,10 +496,11 @@ sub _un_vstring { my $value = shift; # may be a v-string - if ( $] >= 5.006_000 && length($value) == 3 && $value !~ /[._]/ + if ( $] >= 5.006_000 && length($value) >= 3 && $value !~ /[._]/ && (ord($value) < ord('0') || ord($value) > ord('9')) ) { my $tvalue = sprintf("v%vd",$value); - if ( $tvalue =~ /^v\d+\.\d+\.\d+$/ ) { + #if ( $tvalue =~ /^v\d+\.\d+\.[\d.]*\d$/ ) { + if ( $tvalue =~ /^v\d+(\.\d+){2,}$/ ) { # must be a v-string $value = $tvalue; }
Let's try that yet again. RT seems not to have accepted the modified version. Trying with a different file name...
Download vpp.patch2
application/octet-stream 676b

Message body not shown because it is not plain text.

Or else it's just me being careless and sleepy :-/ One last try; if that stupid comment is still there, I'm sure you can deal with it. Apologies for the noise! - Eric
Download vpp.patch3
application/octet-stream 629b

Message body not shown because it is not plain text.

Thanks for the well-written bug report (modulo the multiple attempts to send the patch file). ;-) Unfortunately, your fix in and of itself is not sufficient. I'm supporting version.pm back to all "modern" Perl's (5.004_05, 5.6.2, 5.8.x, and 5.10.x). From 5.6.0 up to and including 5.8.0, v-strings were a valid syntax, yet the result was not a magic v-string (meaning I have no way of knowing for sure that any given scalar was a v-string). Your bugfix works great for the pure-Perl version code, but the XS code for 5.6.2-5.8.0 also needs a patch. I've got a potential fix, but I'm getting some other test failures with 5.6.2 now... :( John
Reolved in 0.78