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

Re: Debian version numbers and strcmp()



Hi!

On Thu, 2009-01-22 at 15:19:40 +0100, Adeodato Simó wrote:
> 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 think that the correct solution to your problem is not to change the
comparison algorithm, but to have available implementations of it or
bindings in all needed programming languages, so that it does not need
to be reimplemented every time. AFAIK we have right now:

 * shell (dpkg --compare-versions)
 * C++ (libapt)
 * perl (libapt-pkg-perl, dpkg-dev [not public yet])
 * python (python-apt)
 * ruby ?

There's probably more I'm missing, but the most ovbious one is the C
implementation. But exposing a libdpkg with it is high on my TODO for
dpkg 1.15.x.

> 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".)

I've always thought it was a feature!

regards,
guillem


Reply to: