Closed Bug 304191 Opened 19 years ago Closed 19 years ago

nsIVersionComparator can return 0 when versions are different

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.8beta4

People

(Reporter: mossop, Assigned: mossop)

Details

Attachments

(1 file)

In certain situations the version comparator returns that the versions are equal
when they actually aren't. The following are the current results:

compare("1.2","1.2.2") returns 0
compare("1.2","1.2.0.2") returns 0
compare("1.2","1.2.1.2") returns -1
compare("1.2","1.2.1") returns 0

I have what I think is a working patch to attach in a moment.
OnlyZeros currently ignores the last version part since ParseVP returns false
when it parses the last version part. Changing from a while to a do - while
solves this.
Attachment #192248 - Flags: review?(benjamin)
Comment on attachment 192248 [details] [diff] [review]
Check all remaining version parts

Wow, good catch. I will add this to the unit test as well.
Attachment #192248 - Flags: superreview?(shaver)
Attachment #192248 - Flags: review?(benjamin)
Attachment #192248 - Flags: review+
Comment on attachment 192248 [details] [diff] [review]
Check all remaining version parts

sr=shaver
Attachment #192248 - Flags: superreview?(shaver) → superreview+
Comment on attachment 192248 [details] [diff] [review]
Check all remaining version parts

Could hopefully get this in before the branch. It's a quick fix and I can't see
any way it could break anything.
Attachment #192248 - Flags: approval1.8b4?
Status: NEW → ASSIGNED
OS: Windows XP → All
Should have assigned to myself, apologies for the spam
Assignee: dougt → mossop
Status: ASSIGNED → NEW
Status: NEW → ASSIGNED
Fixed on trunk for 1.8b4, with extra comparisons in the unit test.
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.8beta4
Comment on attachment 192248 [details] [diff] [review]
Check all remaining version parts

oh yeah, a=me
Attachment #192248 - Flags: approval1.8b4? → approval1.8b4+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: