Odd version comparison

Matthias Clasen mclasen at redhat.com
Thu Sep 11 09:58:12 PDT 2008

On Thu, 2008-09-11 at 17:24 +0200, Tollef Fog Heen wrote:
> ]] Alpár Jüttner 
> | I've just noticed that pkg-config (in fact the function rpmvercmp() in
> | pkg.c) compares the version numbers in a quite strange (and sometimes
> | dangerous) way.
> [...]
> | Is this behavior intentional?
> Not really; I believe it's from RPM's version comparison function.  I'd
> be fine with us just using ASCII ordering on each version number
> component (which are separated by «.») or something similar to that.
> Thoughts?

No version comparison function can work perfectly for all the ways
people come up with for labeling their software. If you really want to
make changes here, I'd recommend enforcing a strict <number>(.<number>)*
format for versions. That will piss people off, too. But once that is
done, it will be possible to write a correct version comparison

More information about the pkg-config mailing list