[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Debian version numbers and strcmp()



Adeodato Simó <dato@net.com.org.es> writes:

> I'd like to hear from members of this list what they think about the
> following issue: I just noticed that to determine whether two Debian
> versions are equal, one can't use strcmp() or similar, and must
> implement the full comparison algorithm. For example, 0.9 and 0.09 are
> the same version according to Policy.
>
> I'm tempted to say this is rather unfortunate: I always believed our
> version numbers to be comparable for *equality* using standard tools,
> and that the Policy algorithm was there just to sort different version
> strings. I think this is a reasonable expectation, too. (I realize
> Policy talks about "comparison".)
>
> Is there a reason for it to be this way? Is there a reason that would
> advise against changing it?

Well, the reason to advise against changing it is that the version
algorithm has been unchanged for years and is implemented separately in
multiple places, so any change at all is a fairly big deal.

I agree that 0.9 == 0.09 is a little surprising, but it does fall out
fairly naturally from the Policy-mandated version comparison algorithm.

Off the top of my head, the only fix that comes to mind would be to do
something like requiring zero-padding the right-hand-side of both version
numbers to be the same length.  I don't see any pair-wise version number
comparisons this would intuitively break (although it does seriously break
comparisons between more than two version numbers if you normalize all of
them), but I've only thought about it for a couple of minutes.  It would,
however, change the current sort order by making 0.1 > 0.02, whereas
currently 0.1 < 0.02.  I haven't checked to see if that would break
anything in the archive.

My personal inclination is to leave it alone on the grounds that it's too
fundamental to change without an extremely compelling reason.

-- 
Russ Allbery (rra@debian.org)               <http://www.eyrie.org/~eagle/>


Reply to: