8 ms·
Yes, 3.11 > 3.10 > 3.9 > 3.8 > ... > 3.2 > 3.1 > 3.0 > 2.999999 in basically every versioning system I've seen. The algorithm is very simple -- you treat each
by cyphar 1y ago
Yes, 3.11 > 3.10 > 3.9 > 3.8 > ... > 3.2 > 3.1 > 3.0 > 2.999999 in basically every versioning system I've seen.
The algorithm is very simple -- you treat each component as a separate number and the newest version is the one which has the earliest left-most component with a numerically larger value. The rules are bit more complicated for suffixes (3.1-beta, 4.5~rc7, 14.2+devel) but stuff like SemVer has formal specs describing a similar algorithm for version comparisons (though SemVer has some subtle differences to the scheme used by most distro package mangers -- at least this is definitely the case for RPM).
I can see the argument for 3.05 == 3.5 > 3.1 (05 is a number that is equivalent to 5 and is larger than 1), and think that makes more sense than 3.05 < 3.1 (I guess that would mean 3.05 == 3.0.5 < 3.1? That's more than a bit fruity...) but I would personally prefer the packaging system reject such versions. Otherwise you need to make up rules for other nonsense like 3.-1 < 3.0 (??!). Of course, I suspect RPM would accept them all.
FWIW, I work at a Linux distribution company (SUSE) and have had to deal with these corners cases a lot.