Skip Menu |

This queue is for tickets about the version CPAN distribution.

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

People
Owner: jpeacock [...] cpan.org
Requestors: dagolden [...] cpan.org
Cc: ether [...] cpan.org
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.99
Fixed in: (no value)



Subject: version->new("0.52_0") numifies incorrectly
This is a bug report for perl from dagolden@cpan.org, generated with the help of perlbug 1.39 running under perl 5.16.0. ----------------------------------------------------------------- [Please describe your issue here] As discussed on #toolchain: Show quoted text
haarg> perl -mversion -le'print version->new("0.52_0")->numify' #
outputs 0._520 Show quoted text
xdg> haarg, i think it's a bug because 0._520 warns if eval'd
("misplaced _ in number") and that shouldn't happen. Show quoted text
xdg> i'm not sure what would be right. possibly 0.520_000, but that
might compare funny Show quoted text
xdg> $ perl -mversion -we 'my $v1=version->new("0.52_0"); my
$v2=version->new("0.520_000"); say $v1==$v2' # true (whew) Show quoted text
xdg> $ perl -mversion=is_lax -we 'my $v1=version->new("0.52_0"); say
$v1->normal . (is_lax($v1->normal) ? " lax" : " not lax")' Show quoted text
xdg> v0_520.0 not lax
Show quoted text
xdg> $ perl -mversion=is_lax -we 'my $v1=version->new("0.520_000"); say
$v1->normal . (is_lax($v1->normal) ? " lax" : " not lax")' Show quoted text
xdg> v0.520_0 lax
[Please do not change anything below this line] ----------------------------------------------------------------- --- Flags: category=core severity=medium --- Site configuration information for perl 5.16.0: Configured by david at Fri Jul 20 11:04:40 PDT 2012. Summary of my perl5 (revision 5 version 16 subversion 0) configuration: Platform: osname=linux, osvers=3.0.0-22-generic, archname=x86_64-linux uname='linux icarus 3.0.0-22-generic #36-ubuntu smp tue jun 12 17:37:42 utc 2012 x86_64 x86_64 x86_64 gnulinux ' config_args='-de -Dprefix=/home/david/perl5/perlbrew/perls/perl-5.16.0' hint=recommended, useposix=true, d_sigaction=define useithreads=undef, usemultiplicity=undef useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef use64bitint=define, use64bitall=define, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-O2', cppflags='-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include' ccversion='', gccversion='4.6.1', gccosandvers='' intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='cc', ldflags =' -fstack-protector -L/usr/local/lib' libpth=/usr/local/lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib /usr/lib libs=-lnsl -ldl -lm -lcrypt -lutil -lc perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc libc=, so=so, useshrplib=false, libperl=libperl.a gnulibc_version='2.13' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E' cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector' Locally applied patches: --- @INC for perl 5.16.0: /home/david/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/x86_64-linux /home/david/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0 /home/david/perl5/perlbrew/perls/perl-5.16.0/lib/5.16.0/x86_64-linux /home/david/perl5/perlbrew/perls/perl-5.16.0/lib/5.16.0 . --- Environment for perl 5.16.0: HOME=/home/david LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_COLLATE=C LC_CTYPE=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/home/david/perl5/perlbrew/bin:/home/david/perl5/perlbrew/perls/perl-5.16.0/bin:~/bin:~/git/utility-scripts:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/vagrant/bin:. PERLBREW_BASHRC_VERSION=0.45 PERLBREW_HOME=/home/david/.perlbrew PERLBREW_MANPATH=/home/david/perl5/perlbrew/perls/perl-5.16.0/man PERLBREW_PATH=/home/david/perl5/perlbrew/bin:/home/david/perl5/perlbrew/perls/perl-5.16.0/bin PERLBREW_PERL=perl-5.16.0 PERLBREW_ROOT=/home/david/perl5/perlbrew PERLBREW_VERSION=0.45 PERL_BADLANG (unset) PERL_EXTUTILS_AUTOINSTALL=--defaultdeps SHELL=/bin/bash
From: jpeacock [...] cpan.org
On Tue Aug 28 05:25:56 2012, JPEACOCK wrote: Show quoted text
> haarg> perl -mversion -le'print version->new("0.52_0")->numify' #
> outputs 0._520
The first question is here: WHY ARE YOU TRYING TO FORCE A NUMERIC REPRESENTATION IN THE FIRST PLACE??? As shown in the original bug, the version object itself compares as you would expect it to. If you just print the value, it looks exactly like it did on entry: $ perl -mversion -le'print version->new("0.52_0");' 0.52_0 Show quoted text
> xdg> haarg, i think it's a bug because 0._520 warns if eval'd
> ("misplaced _ in number") and that shouldn't happen.
It is a bug, but only in the non-dotted-decimal case: $ perl -mversion -le'print version->new("v0.52_0")->numify;' 0.052_000 $ perl -mversion -le'print version->new("v0.52_0")->normal;' v0.52_0 I should never have exposed those methods; they have only led to countless people thinking that they know better than the object class itself. The version objects work as designed: $ perl -mversion -le'print version->new("0.52_0") < version->new("0.52");' 1 (see the POD for why that is the case).
On Tue Aug 28 05:42:21 2012, JPEACOCK wrote: Show quoted text
> On Tue Aug 28 05:25:56 2012, JPEACOCK wrote:
> > haarg> perl -mversion -le'print version->new("0.52_0")->numify' #
> > outputs 0._520
> > The first question is here: WHY ARE YOU TRYING TO FORCE A NUMERIC > REPRESENTATION IN THE FIRST PLACE??? As shown in the original bug, the > version object itself compares as you would expect it to.
I don't think that's really the point. If it numifies at all, it should really numify to something that's a valid number.
Subject: Re: [rt.cpan.org #79259] version->new("0.52_0") numifies incorrectly
Date: Tue, 28 Aug 2012 06:56:53 -0400
To: bug-version [...] rt.cpan.org
From: David Golden <dagolden [...] cpan.org>
On Tue, Aug 28, 2012 at 5:42 AM, John Peacock via RT Show quoted text
> The first question is here: WHY ARE YOU TRYING TO FORCE A NUMERIC > REPRESENTATION IN THE FIRST PLACE???
Lot of distribution packagers find it helps to standardize the numbering to something the OS package manager can natively understand. David -- *David Golden* <dagolden@cpan.org> *Take back your inbox!* → http://www.bunchmail.com/ Twitter/IRC: @xdg
On Tue Aug 28 06:57:34 2012, DAGOLDEN wrote: Show quoted text
> On Tue, Aug 28, 2012 at 5:42 AM, John Peacock via RT >
> > The first question is here: WHY ARE YOU TRYING TO FORCE A NUMERIC > > REPRESENTATION IN THE FIRST PLACE???
> > > Lot of distribution packagers find it helps to standardize the
numbering to Show quoted text
> something the OS package manager can natively understand. > > David >
This is exactly the case that I was dealing with that led me to find this issue. The IPS package system requires dotted decimal version numbers, and I was hoping to use version.pm to do at least part of that normalization.
On Tue Aug 28 05:42:21 2012, JPEACOCK wrote: Show quoted text
> The first question is here: WHY ARE YOU TRYING TO FORCE A NUMERIC > REPRESENTATION IN THE FIRST PLACE??? As shown in the original bug, the > version object itself compares as you would expect it to. If you just > print the value, it looks exactly like it did on entry:
It's my case, it's interfacing with Module::Corelist. The keys of its version hash are numberish, not vstringish. Leon
Fixed in 0.9901 (and bleadperl when I get a patch submitted), available on CPAN in the next day or so...