Skip Menu |

This queue is for tickets about the CPAN-Site CPAN distribution.

Report information
The Basics
Id: 67829
Status: resolved
Priority: 0/
Queue: CPAN-Site

People
Owner: Nobody in particular
Requestors: MELEZHIK [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.06
Fixed in: (no value)



Subject: package versions of \d\.\d\.\d and \d\.\d\.\d\.d are not compared corectly when create cpan index
How to reproduce the bug: 1. create Module Foo of version 0.0.1 2. update cpan index tree via cpansite --site=/path-to-your-local-cpan/ 3. take a look at /path-to-your-local-cpan/ modules/02packages.details.txt.gz - found right index on package Foo at version 0.0.1 4. update Foo version to 0.0.1.1 5. update cpan index tree via cpansite --site=/path-to-your-local-cpan/ 6. take a look at /path-to-your-local-cpan/ modules/02packages.details.txt.gz - found right index on package Foo at version 0.0.1.1 7. update Foo version to 0.0.2 8. update cpan index tree via cpansite --site=/path-to-your-local-cpan/ 9. take a look at /path-to-your-local-cpan/ modules/02packages.details.txt.gz - found old index on package Foo at version 0.0.1.1
Subject: Re: [rt.cpan.org #67829] package versions of \d\.\d\.\d and \d\.\d\.\d\.d are not compared corectly when create cpan index
Date: Fri, 29 Apr 2011 11:37:28 +0200
To: Alexey Melezhik via RT <bug-CPAN-Site [...] rt.cpan.org>
From: Mark Overmeer <mark [...] overmeer.net>
* Alexey Melezhik via RT (bug-CPAN-Site@rt.cpan.org) [110429 08:34]: Show quoted text
> Fri Apr 29 04:34:15 2011: Request 67829 was acted upon. > Transaction: Ticket created by MELEZHIK > Queue: CPAN-Site
Show quoted text
> 4. update Foo version to 0.0.1.1 > 7. update Foo version to 0.0.2 > modules/02packages.details.txt.gz - found old index on package Foo at > version 0.0.1.1
What version of version.pm do you have? The core comparison is using qv() provided by that module. If I try this: perl -Mversion -we 'print "ok" if qv(0.0.2) > qv(0.0.1.1)' I get "ok". And you? -- Regards, MarkOv ------------------------------------------------------------------------ Mark Overmeer MSc MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net
Птн Апр 29 05:37:44 2011, Mark@Overmeer.net писал: Show quoted text
> * Alexey Melezhik via RT (bug-CPAN-Site@rt.cpan.org) [110429 08:34]:
> > Fri Apr 29 04:34:15 2011: Request 67829 was acted upon. > > Transaction: Ticket created by MELEZHIK > > Queue: CPAN-Site
>
> > 4. update Foo version to 0.0.1.1 > > 7. update Foo version to 0.0.2 > > modules/02packages.details.txt.gz - found old index on package Foo
at Show quoted text
> > version 0.0.1.1
> > What version of version.pm do you have? The core comparison is using > qv() provided by that module. > > If I try this: > perl -Mversion -we 'print "ok" if qv(0.0.2) > qv(0.0.1.1)' > I get "ok". And you?
the problem is not in version module, but *PERHAPS* because comparison for `numified-and-convered' version objects does not make a sense, I'll give you some example: use version; print "0.0.45 > 0.0.28.1\n" if qv("0.0.45") > qv("0.0.28.1"); print "numify: 0.0.28.1 ", qv(0.0.28.1)->numify, "\n"; print "0.0.45 < 0.0.28.1\n" if qv("0.0.45") < qv(qv("0.0.28.1")- Show quoted text
>numify);
-- the output will be : 0.0.45 > 0.0.28.1 numify: 0.0.28.1 0.000028001 0.0.45 < 0.0.28.1 --- this kind of comparison might happened in CPAN::Site::Index::collect_package_details sub: sub collect_package_details { ... code skipped ... $VERSION = $VERSION->numify if ref $VERSION; register $package, $VERSION, $dist ... code skipped ... } sub register { my ($package, $this_version, $dist) = @_; ... code skipped ... return if defined $registered_version && qv($registered_version) > qv($this_version); ... code skipped ... } --- last if-check won't work correctly if $this_version passed as result of numified method!
also: use version; print "0.0.45 < 0.0.28.1\n" if qv(qv("0.0.45")) < qv(qv("0.0.28.1")- Show quoted text
>numify);
will give 0.0.45 < 0.0.28.1 on my machine --- version module info: cpan[1]> m version CPAN: Storable loaded ok (v2.16) Going to read '/home/cpan/.cpan/Metadata' Database was generated on Fri, 29 Apr 2011 05:28:37 GMT Module id = version DESCRIPTION structured version objects CPAN_USERID JPEACOCK (John Peacock <jpeacock@cpan.org>) CPAN_VERSION 0.88 CPAN_FILE J/JP/JPEACOCK/version-0.88.tar.gz DSLIP_STATUS SdhOp (standard,developer,hybrid,object- oriented,Standard-Perl) MANPAGE version - Perl extension for Version Objects INST_FILE /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread- multi/version.pm INST_VERSION 0.88
Subject: Re: [rt.cpan.org #67829] package versions of \d\.\d\.\d and \d\.\d\.\d\.d are not compared corectly when create cpan index
Date: Fri, 29 Apr 2011 15:53:46 +0200
To: Alexey Melezhik via RT <bug-CPAN-Site [...] rt.cpan.org>
From: Mark Overmeer <solutions [...] overmeer.net>
* Alexey Melezhik via RT (bug-CPAN-Site@rt.cpan.org) [110429 13:41]: Show quoted text
> Queue: CPAN-Site > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=67829 > > > print "0.0.45 < 0.0.28.1\n" if qv(qv("0.0.45")) < qv(qv("0.0.28.1")-
> >numify);
> > will give > 0.0.45 < 0.0.28.1
You probably meant a '->numify' in the first case as well. Probably, you mean that I should ditch the $VERSION = $VERSION->numify if ref $VERSION; line... -- MarkOv ------------------------------------------------------------------------ drs Mark A.C.J. Overmeer MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net
Subject: Re: [rt.cpan.org #67829] package versions of \d\.\d\.\d and \d\.\d\.\d\.d are not compared corectly when create cpan index
Date: Mon, 2 May 2011 13:05:12 +0200
To: Alexey Melezhik via RT <bug-CPAN-Site [...] rt.cpan.org>
From: Mark Overmeer <mark [...] overmeer.net>
* Alexey Melezhik via RT (bug-CPAN-Site@rt.cpan.org) [110429 13:41]: Show quoted text
> Queue: CPAN-Site > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=67829 >
I have currently no decently sized test-setup available. Would you be able to test a new version for me? Please send me your email address to receive the code if you are willing to check it. -- Regards, MarkOv ------------------------------------------------------------------------ Mark Overmeer MSc MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net
Show quoted text
> Probably, you mean that I should ditch the > $VERSION = $VERSION->numify if ref $VERSION; > line...
Yes, it seems that 'numifying' version object before passing it to register sub cause wrong comparing of this `restored' version object and $registered_version taken at qv($registered_version) > qv($this_version)
Пнд Май 02 07:05:29 2011, Mark@Overmeer.net писал: Show quoted text
> * Alexey Melezhik via RT (bug-CPAN-Site@rt.cpan.org) [110429 13:41]:
> > Queue: CPAN-Site > > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=67829 >
> > I have currently no decently sized test-setup available. Would you > be able to test a new version for me? Please send me your email > address to receive the code if you are willing to check it.
yes, of course melezhik@gmail.com
just duplicate my last letter : --- Hi Mark! I have tried this version you send me on my test case, but bug still appear. I have written my own fix and it's pretty strait but it works, you can modify it to make it neater. 1. 1-st attachment - patch against version you send me (0.7) 2. 2-nd attachment - patch against version 0.6
Subject: cpan_site_version_fix.diff
1c1 < # Copyrights 1998,2005-2011 by Mark Overmeer. --- > # Copyrights 1998,2005-2010 by Mark Overmeer. 4c4 < # Pod stripped from pm file by OODoc 2.00. --- > # Pod stripped from pm file by OODoc 1.06. 10c10 < $VERSION = '1.07'; --- > $VERSION = '1.06'; 133c133 < use Scalar::Util qw(blessed); --- > 141,142c141 < my $registered_version = $findpkgs->{$package}[0] if exists $findpkgs->{$package}; < return if ! defined $this_version; --- > my $registered_version = $findpkgs->{$package}[0]; 144,148c143,144 < #trace("process $package $this_version"); < eval{ $this_version = version->parse($this_version) if defined $this_version && ! blessed($this_version);}; < my $err = $@; < if ($err) { trace("error when create version object : ".$err); return }; < --- > $this_version =~ s/^v// if defined $this_version; > return if !defined $this_version; 150c146 < && $registered_version > $this_version; --- > && qv($registered_version) > qv($this_version); 152c148 < trace ("setup version for $package : $this_version"); --- > 165,171c161 < my $ret_findpkgs = {}; < < for my $k ( keys %{$findpkgs}){ < # trace ("numify $k ".($findpkgs->{$k}->[0]->numify)); < $ret_findpkgs->{$k} = [$findpkgs->{$k}->[0]->numify, $findpkgs->{$k}->[1]] < } < ($ret_findpkgs, \%finddirs); --- > ($findpkgs, \%finddirs); 234c224 < if( m/^\s* package \s* ((?:\w+\:\:)*\w+) (?:\s+ (\S*))? \s* ;/x ) --- > if( m/^\s* package \s* ((?:\w+\:\:)*\w+) \s* ;/x ) 236,238d225 < my $thispkg = $1; < my $thisversion = $2 ? qv($2) : undef; < 240,241c227,230 < { register $package, $VERSION, $dist; < ($package, $VERSION) = ($thispkg, $thisversion); --- > { my $nextpkg = $1; > register $package, $VERSION, $dist; > undef $VERSION; > $package = $nextpkg; 244c233 < { ($package, $VERSION) = ($thispkg, $thisversion); --- > { $package = $1; 266c255 < # $VERSION = $VERSION->numify if ref $VERSION; --- > $VERSION = $VERSION->numify if ref $VERSION;
Subject: cpan_site_version_fix2.diff
133c133 < use Scalar::Util qw(blessed); --- > 141,142c141 < my $registered_version = $findpkgs->{$package}[0] if exists $findpkgs->{$package}; < return if ! defined $this_version; --- > my $registered_version = $findpkgs->{$package}[0]; 144,148c143,144 < #trace("process $package $this_version"); < eval{ $this_version = version->parse($this_version) if defined $this_version && ! blessed($this_version);}; < my $err = $@; < if ($err) { trace("error when create version object : ".$err); return }; < --- > $this_version =~ s/^v// if defined $this_version; > return if !defined $this_version; 150c146 < && $registered_version > $this_version; --- > && qv($registered_version) > qv($this_version); 152c148 < trace ("setup version for $package : $this_version"); --- > 165,171c161 < my $ret_findpkgs = {}; < < for my $k ( keys %{$findpkgs}){ < # trace ("numify $k ".($findpkgs->{$k}->[0]->numify)); < $ret_findpkgs->{$k} = [$findpkgs->{$k}->[0]->numify, $findpkgs->{$k}->[1]] < } < ($ret_findpkgs, \%finddirs); --- > ($findpkgs, \%finddirs); 266c256 < # $VERSION = $VERSION->numify if ref $VERSION; --- > $VERSION = $VERSION->numify if ref $VERSION;
Got patched in 1.07, but fix was incorrect