WINAMP.COM | Forums : Powered by vBulletin version 2.3.9 WINAMP.COM | Forums > Developer Center > NSIS Discussion > VersionCheckNew testing
  Last Thread   Next Thread
Author
Thread Post New Thread    Post A Reply
Afrow UK
Moderator

Registered: Nov 2002
From: Shropshire, England

VersionCheckNew testing

I've tried and tested the function so many times, but there's always one version string comparison kind that gets through with false results.

The last update to the function was to compare each digit of the numbers between the dots one by one. However, recently Daijoubu reported that it would fail on 7 & 10. This is because it would compare 7 with 1 and immediately think the 1st one was larger! I've fixed the problem now (which has made the function even bigger!)

I was wondering if anyone could test the function more for me, which is here:
http://nsis.sourceforge.net/archive...instances=0,757

If you find one that fails, post it here so I can see it.

Cheers

-Stu

__________________
afrowuk.co.uk

Quick Link | Report this post to a moderator | IP: Logged

Afrow UK is offline Old Post 03-22-2005 07:28 PM
Click Here to See the Profile for Afrow UK Click here to Send Afrow UK a Private Message Click Here to Email Afrow UK Visit Afrow UK's homepage! Find more posts by Afrow UK Add Afrow UK to your buddy list Edit/Delete Message Reply w/Quote
Instructor
Major Dude

Registered: Jul 2004
From:

Probably Afrow UK mean:
http://nsis.sourceforge.net/archive...es=0,11,122,754

__________________
my functions

Last edited by Instructor on 03-23-2005 at 09:32 AM

Quick Link | Report this post to a moderator | IP: Logged

Instructor is offline Old Post 03-23-2005 09:10 AM
Click Here to See the Profile for Instructor Click here to Send Instructor a Private Message Click Here to Email Instructor Visit Instructor's homepage! Find more posts by Instructor Add Instructor to your buddy list Edit/Delete Message Reply w/Quote
Instructor
Major Dude

Registered: Jul 2004
From:

quote:
(which has made the function even bigger!)

It's because there is check per digit per number and many exceptions. I choose other way - digits capacity in VersionCompare. I don't found any false results in VersionCheckNew (v4).

__________________
my functions

Quick Link | Report this post to a moderator | IP: Logged

Instructor is offline Old Post 03-23-2005 09:58 AM
Click Here to See the Profile for Instructor Click here to Send Instructor a Private Message Click Here to Email Instructor Visit Instructor's homepage! Find more posts by Instructor Add Instructor to your buddy list Edit/Delete Message Reply w/Quote
Afrow UK
Moderator

Registered: Nov 2002
From: Shropshire, England

Ah yeh, sorry I posted link to edit

-Stu

__________________
afrowuk.co.uk

Quick Link | Report this post to a moderator | IP: Logged

Afrow UK is offline Old Post 03-23-2005 12:55 PM
Click Here to See the Profile for Afrow UK Click here to Send Afrow UK a Private Message Click Here to Email Afrow UK Visit Afrow UK's homepage! Find more posts by Afrow UK Add Afrow UK to your buddy list Edit/Delete Message Reply w/Quote
Instructor
Major Dude

Registered: Jul 2004
From:

code:
${VersionCheckNew} "91.1.1.1" "101.1.1.1" $R0
$R0="1"

__________________
my functions

Quick Link | Report this post to a moderator | IP: Logged

Instructor is offline Old Post 03-28-2005 10:10 AM
Click Here to See the Profile for Instructor Click here to Send Instructor a Private Message Click Here to Email Instructor Visit Instructor's homepage! Find more posts by Instructor Add Instructor to your buddy list Edit/Delete Message Reply w/Quote
Afrow UK
Moderator

Registered: Nov 2002
From: Shropshire, England

Thanks Instructor. I found that problem a few days ago too and I think it's fixed now. It took me a few hours, but I thought of a new solution which should fix all the problems.
Uploaded as v5

-Stu

__________________
afrowuk.co.uk

Quick Link | Report this post to a moderator | IP: Logged

Afrow UK is offline Old Post 03-28-2005 08:02 PM
Click Here to See the Profile for Afrow UK Click here to Send Afrow UK a Private Message Click Here to Email Afrow UK Visit Afrow UK's homepage! Find more posts by Afrow UK Add Afrow UK to your buddy list Edit/Delete Message Reply w/Quote
Instructor
Major Dude

Registered: Jul 2004
From:

Very bad that you don't trying to see what do others


P.S.

code:
${VersionCheckV5} "1.001" "1.0" $R0
$R0="2"

__________________
my functions

Quick Link | Report this post to a moderator | IP: Logged

Instructor is offline Old Post 03-29-2005 09:22 AM
Click Here to See the Profile for Instructor Click here to Send Instructor a Private Message Click Here to Email Instructor Visit Instructor's homepage! Find more posts by Instructor Add Instructor to your buddy list Edit/Delete Message Reply w/Quote
Afrow UK
Moderator

Registered: Nov 2002
From: Shropshire, England

Thanks fixed.

-Stu

__________________
afrowuk.co.uk

Quick Link | Report this post to a moderator | IP: Logged

Afrow UK is offline Old Post 03-29-2005 11:15 AM
Click Here to See the Profile for Afrow UK Click here to Send Afrow UK a Private Message Click Here to Email Afrow UK Visit Afrow UK's homepage! Find more posts by Afrow UK Add Afrow UK to your buddy list Edit/Delete Message Reply w/Quote
glory_man
Senior Member

Registered: Sep 2004
From: Mogilev (Belarus)

Version "1.00" is newer than "1.0". Is it supposed to be?

Quick Link | Report this post to a moderator | IP: Logged

glory_man is offline Old Post 06-07-2005 12:08 PM
Click Here to See the Profile for glory_man Click here to Send glory_man a Private Message Click Here to Email glory_man Find more posts by glory_man Add glory_man to your buddy list Edit/Delete Message Reply w/Quote
Afrow UK
Moderator

Registered: Nov 2002
From: Shropshire, England

I'd just use Instructors VersionCompare

-Stu

__________________
afrowuk.co.uk

Quick Link | Report this post to a moderator | IP: Logged

Afrow UK is offline Old Post 06-07-2005 12:11 PM
Click Here to See the Profile for Afrow UK Click here to Send Afrow UK a Private Message Click Here to Email Afrow UK Visit Afrow UK's homepage! Find more posts by Afrow UK Add Afrow UK to your buddy list Edit/Delete Message Reply w/Quote
glory_man
Senior Member

Registered: Sep 2004
From: Mogilev (Belarus)

Another question (general).
Why "1.1.1.1" not equal to "1.1.1.01"?

Quick Link | Report this post to a moderator | IP: Logged

glory_man is offline Old Post 06-07-2005 12:33 PM
Click Here to See the Profile for glory_man Click here to Send glory_man a Private Message Click Here to Email glory_man Find more posts by glory_man Add glory_man to your buddy list Edit/Delete Message Reply w/Quote
Afrow UK
Moderator

Registered: Nov 2002
From: Shropshire, England

Because 01 is older than 1, as we go up in 01, 02, 03, to 1. 1 would be counted as "10".

-Stu

__________________
afrowuk.co.uk

Quick Link | Report this post to a moderator | IP: Logged

Afrow UK is offline Old Post 06-07-2005 12:57 PM
Click Here to See the Profile for Afrow UK Click here to Send Afrow UK a Private Message Click Here to Email Afrow UK Visit Afrow UK's homepage! Find more posts by Afrow UK Add Afrow UK to your buddy list Edit/Delete Message Reply w/Quote
glory_man
Senior Member

Registered: Sep 2004
From: Mogilev (Belarus)

Than, if I include in script

code:
VIProductVersion "1.1.0.001" VIAddVersionKey "LegalCopyright" 'Ltd.' VIAddVersionKey "FileDescription" "Test file" VIAddVersionKey "FileVersion" "1.1.0.001"

And use GetDllVersion - version will be 1.1.0.1. Why?

Quick Link | Report this post to a moderator | IP: Logged

glory_man is offline Old Post 06-07-2005 01:12 PM
Click Here to See the Profile for glory_man Click here to Send glory_man a Private Message Click Here to Email glory_man Find more posts by glory_man Add glory_man to your buddy list Edit/Delete Message Reply w/Quote
Afrow UK
Moderator

Registered: Nov 2002
From: Shropshire, England

NSIS treats 001 in a variable as 1 (when using IntOp)

-Stu

__________________
afrowuk.co.uk

Quick Link | Report this post to a moderator | IP: Logged

Afrow UK is offline Old Post 06-07-2005 01:17 PM
Click Here to See the Profile for Afrow UK Click here to Send Afrow UK a Private Message Click Here to Email Afrow UK Visit Afrow UK's homepage! Find more posts by Afrow UK Add Afrow UK to your buddy list Edit/Delete Message Reply w/Quote
deguix
Major Dude

Registered: Dec 2002
From: Everett - MA, USA

quote:
Because 01 is older than 1, as we go up in 01, 02, 03, to 1. 1 would be counted as "10".
My opinion is that, the extra zeros in versions are just to show how the author organizes his versions. I think, zeros should be ignored if they are on the left of the number. Example: 1.01 = 1.00001. By this reasoning, I think Afrow UK is wrong in saying that 1.01 is older than 1.1, because it's like giving the extra digit a separation mark, like the ".". With Afrow's idea, what would be newer: 1.00, 1.0 or 1?

To make a version comparasion with only numbers, it's a matter of comparing the numbers inside the four groups w/ IntCmp, nothing more (and logically converting those numbers to be supported as decimal by NSIS, because 001 is considered as an octal number).

__________________
My Wiki Pages

Working now on:
New projects. (language: any)

Quick Link | Report this post to a moderator | IP: Logged

deguix is offline Old Post 06-07-2005 07:15 PM
Click Here to See the Profile for deguix Click here to Send deguix a Private Message Click Here to Email deguix Find more posts by deguix Add deguix to your buddy list Edit/Delete Message Reply w/Quote
Instructor
Major Dude

Registered: Jul 2004
From:

quote:
I think, zeros should be ignored if they are on the left of the number. Example: 1.01 = 1.00001. By this reasoning, I think Afrow UK is wrong in saying that 1.01 is older than 1.1, because it's like giving the extra digit a separation mark, like the ".".
Afrow UK isn't wrong:
1.01 != 1.00001, because 1.01 != 1.10
In your words NSIS 2.01 = NSIS 2.1 (it will be I hope )

__________________
my functions

Quick Link | Report this post to a moderator | IP: Logged

Instructor is offline Old Post 06-08-2005 07:30 AM
Click Here to See the Profile for Instructor Click here to Send Instructor a Private Message Click Here to Email Instructor Visit Instructor's homepage! Find more posts by Instructor Add Instructor to your buddy list Edit/Delete Message Reply w/Quote
glory_man
Senior Member

Registered: Sep 2004
From: Mogilev (Belarus)

quote:
My opinion is that, the extra zeros in versions are just to show how the author organizes his versions. I think, zeros should be ignored if they are on the left of the number. Example: 1.01 = 1.00001. By this reasoning, I think Afrow UK is wrong in saying that 1.01 is older than 1.1, because it's like giving the extra digit a separation mark, like the ".".

I am subscribe to this opinion.

2Instructor
quote:
Afrow UK isn't wrong:
1.01 != 1.00001, because 1.01 != 1.10
In your words NSIS 2.01 = NSIS 2.1 (it will be I hope )

I don't agree. NSIS 2.01 has full version number 2.0.1, NSIS 2.1 wil be - 2.1.0.
In your words 1 kg 1000 times greater than 0001 kg.

Quick Link | Report this post to a moderator | IP: Logged

glory_man is offline Old Post 06-08-2005 10:43 AM
Click Here to See the Profile for glory_man Click here to Send glory_man a Private Message Click Here to Email glory_man Find more posts by glory_man Add glory_man to your buddy list Edit/Delete Message Reply w/Quote
Instructor
Major Dude

Registered: Jul 2004
From:

What sense give to the program version 1.01, if the same is 1.1? I saw only one reason: if number 1.01 compared with 1.1 it will be older

__________________
my functions

Quick Link | Report this post to a moderator | IP: Logged

Instructor is offline Old Post 06-08-2005 11:23 AM
Click Here to See the Profile for Instructor Click here to Send Instructor a Private Message Click Here to Email Instructor Visit Instructor's homepage! Find more posts by Instructor Add Instructor to your buddy list Edit/Delete Message Reply w/Quote
onad
Senior Member

Registered: Dec 2004
From: Turkey

TIP: Versioning scheme as I see it...

I agree there is IMHO no sense in versioning 1.02
This is for me v1.0.2.x
Versioning scheme as I see it...

A.B.C.D

A = Product Major Version
B = Product Feature Release
C = Product Release incrementeal ID
D = Fix/Test/Debug/ for short the Build number

Example for a e.g. wordprocessor:

0.x = Initial development
1.0.0.0 = Initial Debug Release
1.0.0.57 = 57th testing build
1.0.1.1 = Initial "official" build
1.0.1.33 = 33rd fix for the official build
1.0.2.1 = Second "official" build including all bug fixes
1.1.1.278 = Now we have a spell checker
1.2.1.45 = And a thesaurus.
2.0.1.352 = And we introduced Linux compatibility because we built it with Kylix

Use this structure internally, it works very well. A customer needs to know A.B for features, A.B.C for fixes to features, and we use D internally for testing/debugging and emergency fixes for when taxes don't add up.

Success to everyone to streamline the versioning of your releases.

Emin

__________________
"Just do it"

Quick Link | Report this post to a moderator | IP: Logged

onad is offline Old Post 06-08-2005 11:37 AM
Click Here to See the Profile for onad Click here to Send onad a Private Message Find more posts by onad Add onad to your buddy list Edit/Delete Message Reply w/Quote
Comm@nder21
Major Dude

Registered: Jul 2003
From: germany, b-w

normally its used this way:
major.minor.release.build

for most open source projects:
1.0.0.xxx - first public release
1.1.0.1 - first beta for 1.2 release
1.2.0.xxx - second public release
1.9.xx.xxx - beta releases for 2.0 RC
2.0.0.xxx - second major version, means bigger changes.

and so on ...
the last number ("build") is increased everytime a new beta/release is build and reset everytime the releasenumber changes.

__________________
hand by comm@nder21
----------
WiKi pages:CreateInternetShortcut|Enhanced FindWindow|Parse CSV-Data|Open/Close CD-Drive|Installer without Icon|Vista application compatibility

Quick Link | Report this post to a moderator | IP: Logged

Comm@nder21 is offline Old Post 06-10-2005 03:06 PM
Click Here to See the Profile for Comm@nder21 Click here to Send Comm@nder21 a Private Message Click Here to Email Comm@nder21 Visit Comm@nder21's homepage! Find more posts by Comm@nder21 Add Comm@nder21 to your buddy list Edit/Delete Message Reply w/Quote
NHOCSUNG
Guest

Registered: Not Yet
From:

you try this ... i didn't find any problem

!insertmacro STRFUNC_DEFFUNC VersionCheck
!define VersionCheck_List `ResultVar|CurVersion|CmpVersion`
!define VersionCheck_TypeList `Output 0 1 2|Text|Text`
!macro `FUNCTION_STRING_UnVersionCheck`
!undef UnVersionCheck
!insertmacro FUNCTION_STRING_VersionCheck
!macroend

!macro FUNCTION_STRING_VersionCheck
!insertmacro STRFUNC_FUNC `VersionCheck` `2004 - 2005 Tu Tong - Based on functions by Tu Tong`

Exch $R0
Exch
Exch $R1
Exch
Push $R2
Push $R3
Push $R4
Push $R5
Push $R6
Push $R7

StrCmp $R0 "" error 0
StrCmp $R1 "" error 0

StrCmp $R0 $R1 sameversion 0

ClearErrors
loop:
IfErrors sameversion
StrCmp $R0 "" sameversion
StrCmp $R1 "" sameversion

StrCpy $R4 $R0
GetLabelAddress $R7 return
Goto parse
return:
StrCpy $R6 $R3
StrCpy $R0 $R4

StrCpy $R4 $R1
GetLabelAddress $R7 return1
Goto parse
return1:
StrCpy $R5 $R3
StrCpy $R1 $R4

IntCmp $R6 $R5 0 olderversion newerversion
Goto loop

parse:
StrCpy $R2 0
StrLen $R5 $R4
parseloop:
StrCpy $R3 $R4 1 $R2
StrCmp $R3 "." parsecpy 0
IntCmp $R5 $R2 parsecpy parsecpy 0
IntOp $R2 $R2 + 1
Goto parseloop

parsecpy:
StrCpy $R3 $R4 $R2

IntOp $R5 $R5 - $R2
IntOp $R2 $R2 + 1
StrCpy $R4 $R4 $R5 $R2
Goto $R7

newerversion:
StrCpy $R0 "2"
Goto checkdone

sameversion:
StrCpy $R0 "0"
Goto checkdone

olderversion:
StrCpy $R0 "1"
Goto checkdone

error:
StrCpy $R0 ""

checkdone:
ClearErrors


Pop $R7
Pop $R6
Pop $R5
Pop $R4
Pop $R3
Pop $R2
Pop $R1
Exch $R0

;------------------------
;End

FunctionEnd

!macro FUNCTION_STRING_VersionCheck_Call ResultVar CurVersion CmpVersion
!verbose push
!verbose 4
!echo `$ {VersionCheck} "${ResultVar}" "${CurVersion}" "${CmpVersion}"`
!verbose pop

Push `${CurVersion}`
Push `${CmpVersion}`
Call VersionCheck
Pop `${ResultVar}`
!macroend
!macro FUNCTION_STRING_UnVersionCheck_Call ResultVar CurVersion CmpVersion
!verbose push
!verbose 4
!echo `$ {UnVersionCheck} "${ResultVar}" "${CurVersion}" "${CmpVersion}"`
!verbose pop

Push `${CurVersion}`
Push `${CmpVersion}`
Call un.VersionCheck
Pop `${ResultVar}`
!macroend

!macroend

Quick Link | Report this post to a moderator | IP: Logged

Old Post 06-10-2005 10:46 PM
Edit/Delete Message Reply w/Quote
deguix
Major Dude

Registered: Dec 2002
From: Everett - MA, USA

It's better for you to post a normal function, because UseFunc (old StrFunc) is being developed, so this function would need to be changed to adapt to future newer versions.

__________________
My Wiki Pages

Working now on:
New projects. (language: any)

Quick Link | Report this post to a moderator | IP: Logged

deguix is offline Old Post 06-11-2005 03:10 AM
Click Here to See the Profile for deguix Click here to Send deguix a Private Message Click Here to Email deguix Find more posts by deguix Add deguix to your buddy list Edit/Delete Message Reply w/Quote
NHOCSUNG
Guest

Registered: Not Yet
From:

okay deguix i'll post normal function

here my update

Function VersionCheck
Exch $R1
Exch
Exch $R0
Exch
Push $R2
Push $R3
Push $R4
Push $R5
Push $R6

${If} $R0 == ""
${OrIf} $R1 == ""
Goto Error
${EndIf}

StrCmp $R0 $R1 sameversion

StrCpy $R4 $R0
Call :complete
StrCpy $R0 $R4

StrCpy $R4 $R1
Call :complete
StrCpy $R1 $R4

Goto compare

complete:
StrCpy $R6 0
StrCpy $R2 0
StrLen $R5 $R4
${Do}
StrCpy $R3 $R4 1 $R2
${If} $R3 == "."
IntOp $R6 $R6 + 1
${EndIf}
${IfThen} $R2 >= $R5 ${|} ${ExitDo} ${|}
IntOp $R2 $R2 + 1
${Loop}

${Select} $R6
${Case} 0
StrCpy $R4 "$R4.0.0.0"
${Case} 1
StrCpy $R4 "$R4.0.0"
${Case} 2
StrCpy $R4 "$R4.0"
${CaseElse}
StrCpy $R4 "$R4"
${EndSelect}
Return

compare:
ClearErrors
Loop:
IfErrors sameversion
StrCmp $R0 "" sameversion
StrCmp $R1 "" sameversion

StrCpy $R4 $R0
Call arse
StrCpy $R6 $R3
StrCpy $R0 $R4

StrCpy $R4 $R1
Call arse
StrCpy $R5 $R3
StrCpy $R1 $R4

IntCmp $R6 $R5 0 olderversion newerversion
Goto Loop

parse:
StrCpy $R2 0
StrLen $R5 $R4
${Do}
StrCpy $R3 $R4 1 $R2
${IfThen} $R3 == "." ${|} ${ExitDo} ${|}
${IfThen} $R2 >= $R5 ${|} ${ExitDo} ${|}
IntOp $R2 $R2 + 1
${Loop}

StrCpy $R3 $R4 $R2

IntOp $R5 $R5 - $R2
IntOp $R2 $R2 + 1
StrCpy $R4 $R4 $R5 $R2
Return

olderversion:
StrCpy $R0 "2"
Goto checkdone

newerversion:
StrCpy $R0 "1"
Goto checkdone

sameversion:
StrCpy $R0 "0"
Goto checkdone

error:
StrCpy $R0 ""

checkdone:
ClearErrors

Pop $R6
Pop $R5
Pop $R4
Pop $R3
Pop $R2
Pop $R1
Exch $R0

FunctionEnd

Quick Link | Report this post to a moderator | IP: Logged

Old Post 08-24-2005 08:50 PM
Edit/Delete Message Reply w/Quote
All times are GMT. The time now is 09:26 AM. Post New Thread    Post A Reply
  Last Thread   Next Thread
WINAMP.COM | Forums : Powered by vBulletin version 2.3.9 WINAMP.COM | Forums > Developer Center > NSIS Discussion > VersionCheckNew testing
Show Printable Version
 | 
Email this Page
 | 
Subscribe to this Thread

Forum Jump:
 

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is off
vB code is ON
Smilies are ON
[IMG] code is ON