Closed Bug 315242 Opened 19 years ago Closed 19 years ago

Nightly builds' version number 0.3a1+ sorts BEFORE 0.3a1, which sorts BEFORE 0.2+

Categories

(Toolkit :: Add-ons Manager, defect)

x86
Windows 2000
defect
Not set
major

Tracking

()

RESOLVED WONTFIX

People

(Reporter: gekacheka, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8) Gecko/20051025 Firefox/1.5
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9a1) Gecko/20051105 Mozilla Sunbird/0.3a1+

In the current version numbering scheme, 0.3a1+ sorts BEFORE 0.3a1.
This is bad because current nightlies are AFTER 0.3a1.
This is a problem for giving accurate maxVersion in Sunbird extensions.

(Also note that "0.2+" is converted to "0.3pre" for sorting,
so "0.2+" sorts AFTER "0.3a1" because "p" > "a".  But no one should be using 0.2+ builds anymore.)  

Think of the version number as consisting of 'phrases' separated by '.'s, 
and each phrase consists of <number-a> [<string-b> [<number-c> [<string-d>]]]
http://developer.mozilla.org/en/docs/Toolkit_version_format#Version_format

The version number comparator only treats "+" specially when it comes after the first number (number-a) in the word, not the second number (number-c) (presumably because '+' only appeared after the first number in the old version numbering scheme).
http://developer.mozilla.org/en/docs/Toolkit_version_format#Version_format
["if string-b is a plus sign, number-a is incremented to be compatible with the Firefox 1.0.x version format: 1.0+ is the same as 1.1pre"]
var vc = Components.classes["@mozilla.org/xpcom/version-comparator;1"].getService(Components.interfaces.nsIVersionComparator); vc.compare("0.2+","0.3pre")
returns 0, they are equal.

Since it is not treating '+' specially in "0.3a1+" it is sorting by the rule that an non-empty string always sorts BEFORE an empty string, 
so "0.3a" is before "0.3", and "0.3a1+" is before "0.3a1".
http://developer.mozilla.org/en/docs/Toolkit_version_format#Comparing_version_parts

var vc = Components.classes["@mozilla.org/xpcom/version-comparator;1"].getService(Components.interfaces.nsIVersionComparator); 
vc.compare("0.3a1","0.3a1+")
returns 1, so "0.3a1" is AFTER "0.3a1+"

So instead, I suggest nightly builds be numbered as "0.3a2-", which sorts before "0.3a2"
(It still sorts before "0.2+"="0.3pre", but no one should be using 0.2+ nightly builds any more.)


Reproducible: Always

Steps to Reproduce:
Create an extension 
a. with minVersion "0.2+" and maxVersion "0.3a1+"
b. with minVersion "0.3a1" and maxVersion "0.3a1+".
Try to install the extension in sunbird.
Actual Results:  
a. Error dialog from extension manager:
"Incompatible Extension:
<extension> could not be installed because it is not compatible with Sunbird 0.3a1+ (<extension> will only work with Sunbird versions from 0.2+ to 0.3a1+).

b. Error dialog from extension manager:
"Incompatible Extension:
<extension> could not be installed because it is not compatible with Sunbird 0.3a1+ (<extension> will only work with Sunbird versions from 0.3a1 to 0.3a1+).

The problem is "0.3a1+" < "0.3a1" < "0.2+"="0.3pre", so the maxVersion < minVersion in these examples, so the extension cannot install in any version.

Expected Results:  
Expected sunbird builds to have version numbers that the versionComparator sorts in chronological order.

Suggest using "0.3a2-" for nightlies after release "0.3a1".
the x.ya1 scheme and the + for nightlies have been used for ages for mozilla apps. If toolkit doesn't understand that, then toolkit is broken.
So, over to toolkit. (actually, to firefox, because toolkit doesn't have an extension manager component for some reason)
Assignee: mostafah → nobody
Product: Calendar → Firefox
QA Contact: general → general
Component: General → Extension/Theme Manager
QA Contact: general → extension.manager
Toolkit's not going to fix this, use 0.3a1 and 0.3a1.+ if you must
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → WONTFIX
Product: Firefox → Toolkit
You need to log in before you can comment on or make changes to this bug.