You are here: Foswiki>Tasks Web>Item12446 (19 Nov 2013, GeorgeClark)Edit Attach

Item12446: Dependency check is inconsistent with Perl version comparisons

Priority: Urgent
Current State: Closed
Released In: 1.1.9
Target Release: patch
Applies To: Engine
Component: Configure
Branches: Release01x01 trunk
Reported By: GeorgeClark
Waiting For:
Last Change By: GeorgeClark
Foswiki::Dependency appears to treat decimal version to the right of the decimal as a simple number. This showed up in a question on IRC:,Fri&sel=21#l17

hi, i am trying to install FullCalendarPlugin. But it shows missing dependencey Date::Calc version >= 6.13 required. I have already installed version 6.3 which is the latest in cpan

Confirmed with testing that 6.3 should compare as newer than 6.13.

$ perl -Mversion -e'print version->parse("1.13") < version->parse("1.3");'

1.13 < 1.3 evaluates as true. But Foswiki::Dependency evaluates that as false.

We can't use version for comparisons, as Foswiki::Dependency deals with versions that would fail Perl's comparson: dates, alpha strings, $Rev: 1234$ SVN revisions, etc. But the unit tests could test version against Dependency for supported version strings.

-- GeorgeClark - 25 Mar 2013

There's a function in Foswiki::Configure::Dependency::compare_cpan_versions - surely you can simply swap that out for use version?

3 is most definitely less than 13, despite what use version appears to say :-/

-- CrawfordCurrie - 25 Mar 2013

Since the $VERSION is external to core - coming from extensions, CPAN packages, etc. I think we need to be more robust than just using version. Things like $VERSION = "$Rev: 9845$" will cause version to throw an error. So we need to either carefully validate the string, and then pass it off to version, or just fix our own comparison.

I wish they called the module PerlVersion instead of just version. Sentences are so much harder to parse.

And last I checked, 1.3 is definitely larger than 1.13. stick out tongue

-- GeorgeClark - 25 Mar 2013

Hi Crawford,

I've changed to use CPAN:version if the version strings pass a regex. There are definitely a few differences from our older Dependency comparisons. Please give this a look. Thanks.

-- GeorgeClark - 19 Apr 2013

1.30 is larger than 1.13; and 1.03 is smaller. But there is no convention on how to interpret a decimal. IMHO it's stupid to use a decimal; it has absolutely no advantages over using a simple integer, so why bother?

Your changes make sense to me; though this is a minefield frown, sad smile

-- CrawfordCurrie - 19 Apr 2013

ItemTemplate edit

Summary Dependency check is inconsistent with Perl version comparisons
ReportedBy GeorgeClark
Codebase 1.1.8, trunk
SVN Range
AppliesTo Engine
Component Configure
Priority Urgent
CurrentState Closed
Checkins distro:a88a54c18a0c distro:ce63e9c69b9f distro:49e707c7e320 distro:eb91f1eeacc3
TargetRelease patch
ReleasedIn 1.1.9
CheckinsOnBranches Release01x01 trunk
trunkCheckins distro:ce63e9c69b9f distro:49e707c7e320
Release01x01Checkins distro:a88a54c18a0c distro:eb91f1eeacc3
Topic revision: r12 - 19 Nov 2013, GeorgeClark - This page was cached on 16 Oct 2020 - 21:55.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy