Skip Menu |
 

This queue is for tickets about the Sort-Versions CPAN distribution.

Report information
The Basics
Id: 34622
Status: open
Priority: 0/
Queue: Sort-Versions

People
Owner: Nobody in particular
Requestors: Matthias.Schroder [...] cern.ch
Cc:
AdminCc:

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



Subject: Strange result from versioncmp
Date: Wed, 2 Apr 2008 16:41:22 +0200
To: <bug-Sort-Versions [...] rt.cpan.org>
From: Matthias Schroeder <Matthias.Schroder [...] cern.ch>
Download (untitled) / with headers
text/plain 1.2k
Dear perl-Sort-Version Expert(s), using perl-Sort-Versions-1.5-1.2.el4.rf on Scientific Linux 4 (i386 machine as well as x86_64 machine), I get strange results from versioncmp. The following demonstrates the effect: [whatprompt?] cat ./testSortVersions.pl #!/usr/local/bin/perl -w # use Sort::Versions; # perl-Sort-Versions from DAG repo &myCompare('1.4.1', '1.4.1'); &myCompare('1.4.1', '1.4.1.el4'); &myCompare('1.4.1', '1.4.2'); &myCompare('1.4.1-12', '1.4.1-12.0.3'); &myCompare('1.4.1-12.el4', '1.4.1-12.0.3.el4'); sub myCompare(){ my ( $a, $b ) = @_; my $rc; $rc = versioncmp($a,$b); if ( $rc == 1 ){ print "$a is newer than $b\n"; } elsif( $rc == -1 ){ print "$a is older than $b\n"; } else{ print "$a is as old as $b\n"; } } [whatprompt?] ./testSortVersions.pl 1.4.1 is as old as 1.4.1 1.4.1 is older than 1.4.1.el4 1.4.1 is older than 1.4.2 1.4.1-12 is older than 1.4.1-12.0.3 1.4.1-12.el4 is newer than 1.4.1-12.0.3.el4 [whatprompt?] The result of the first four comparisons are fine with me, but I just can not agree on the result of the fifth test. Is that a known feature? Is it perhaps fixed already? The perl version used is v5.8.5. Thanks in advance for your help, Matthias
Download (untitled) / with headers
text/plain 517b
On 2008-04-02 07:42:39, Matthias.Schroder@cern.ch wrote: Show quoted text
> Dear perl-Sort-Version Expert(s), > > using perl-Sort-Versions-1.5-1.2.el4.rf on Scientific Linux 4 (i386 > machine as well as x86_64 machine), I get strange results from versioncmp.
Show quoted text
> [whatprompt?] ./testSortVersions.pl > 1.4.1 is as old as 1.4.1 > 1.4.1 is older than 1.4.1.el4 > 1.4.1 is older than 1.4.2 > 1.4.1-12 is older than 1.4.1-12.0.3 > 1.4.1-12.el4 is newer than 1.4.1-12.0.3.el4
1.4.1.e14, 1.4.1-12 and 1.4.1-12.el4 are not valid versions.
Download (untitled) / with headers
text/plain 811b
On 2015-04-29 18:58:04, ETHER wrote: Show quoted text
> On 2008-04-02 07:42:39, Matthias.Schroder@cern.ch wrote:
> > Dear perl-Sort-Version Expert(s), > > > > using perl-Sort-Versions-1.5-1.2.el4.rf on Scientific Linux 4 (i386 > > machine as well as x86_64 machine), I get strange results from versioncmp.
>
> > [whatprompt?] ./testSortVersions.pl > > 1.4.1 is as old as 1.4.1 > > 1.4.1 is older than 1.4.1.el4 > > 1.4.1 is older than 1.4.2 > > 1.4.1-12 is older than 1.4.1-12.0.3 > > 1.4.1-12.el4 is newer than 1.4.1-12.0.3.el4
> > > 1.4.1.e14, 1.4.1-12 and 1.4.1-12.el4 are not valid versions.
At least versions with dashes are explicitly mentioned in Sort::Versions documentation: For an explanation of the algorithm, it's simplest to look at these examples: ... 1.1-3 < 1.1-4 1.1-5 < 1.1.6 ...


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.