[wpkg-users] [Bug 75] New: File version check does not work properly [SEC=UNCLASSIFIED]

Michael Chinn m.chinn at gbrmpa.gov.au
Thu Oct 25 00:37:47 CEST 2007


parseInt(as);parseInt(bs)? 

would fix leading 0's I think?
This, i believe is the offending function...



/**
 *   VersionCompare - compare two executable versions
 */
function VersionCompare(a,b) {
    // Return 0 if equal
    // Return -1 if a < b
    // Return +1 if a > b
    var as = a.split(".");
    var bs = b.split(".");
    var length=as.length;
    var ret=0;
    for (var i = 0; i < length; i++) {
        var av = as[i]*1;
        var bv = bs[i]*1;
        if (av<bv) {
            ret=-1;
            i=length; // Hack to exit loop
        } else if (av>bv) {
            ret=1;
            i=length;
        }
    }
    return ret;
}

-- 
Michael Chinn
User Support Officer - Information Technology

Great Barrier Reef Marine Park Authority
PO Box 1379
TOWNSVILLE, QLD 4810

Ph 07 47500874 Fax 07 4772 6093
michaelc at gbrmpa.gov.au 

================================================================================
If you have received this transmission in error please notify us immediately
by return email and delete all copies. Any unauthorised use, disclosure or
distribution of this email is prohibited.
================================================================================



éric le hénaff wrote, On 22/10/2007 22:37:
> same problem with revision like in
> <package id="pdfcreator" name="PDFCreator" revision="9031" 
> reboot="false" priority="0">
> i had to change revision="09031"  to revision="9031" .
> Some parameters seem to be compared as strings , others as numbers.
> ELH
>
> bugzilla-daemon at bugzilla.wpkg.org a écrit :
>   
>> http://bugzilla.wpkg.org/show_bug.cgi?id=75
>>
>>            Summary: File version check does not work properly
>>            Product: WPKG
>>            Version: 0.9.10
>>           Platform: PC
>>         OS/Version: Windows XP
>>             Status: NEW
>>           Severity: enhancement
>>           Priority: P2
>>          Component: wpkg.js
>>         AssignedTo: mangoo at wpkg.org
>>         ReportedBy: leon.hedding at ict.om.org
>>          QAContact: wpkg-users at lists.wpkg.org
>>
>>
>> When checking for a file version such as 0.60.0.0 for PuTTY.exe it fails the
>> check for the file version because of the leading 0. It always thinks the
>> software is installed.  When I have this exact text as follows it says
>> "Bypassing installation of package PuTTY". I can change "blah" to "PuTTY" and
>> get the same result.
>>
>> <check type="file" condition="versiongreaterorequal"
>> path="%programfiles%\blah\blah.exe" value="0.60.0.0" />
>>
>> Failed install check using:
>> versiongreaterorequal
>> versionlessorequal 
>> versionequalto 
>>
>> Correctly worked with:
>> versionsmallerthan 
>> versiongreaterthan
>>
>>
>>   
>>     
>
>   

wpkg-users mailing list
wpkg-users at lists.wpkg.org
http://lists.wpkg.org/mailman/listinfo/wpkg-users



More information about the wpkg-users mailing list