Re: dpkg doing wrong math (0.09 = 0.9) ?- [was: dak now supports ~ in version numbers]
* Michael Biebl [Fri, 11 Aug 2006 01:12:59 +0200]:
> that "dpkg --compare-versions '0.09' '=' '0.9'" yields true, which I
> think is rather odd, because it means that now all version numbers up to
> 0.9 will be considered < 0.09+0.1.
0.09 = 0.9 means:
0 == 0
and
. == .
and
09 == 9
Which is pretty standard math. ;-)
> If it's not a bug in dpkg, could someone please elaborate on the
> reasoning of this behaviour. I'd be grateful for any comments and replies.
Well, don't know about the reasoning, but it's definitely not a dpkg
bug, since it follows the comparison algorithm as described in Policy
5.6.12.
The bottom line is: whenver dealing with version, never ever say "X is
obviously greater than Y", and always run dpkg --compare-versions in
advance.
> 2.) Use an epoch.
1:0.1 is obviously (heh) >> 0.09.
On other news, 1E0.1 is _also_ >> 0.9, but << 1.0.
(Yes, this is called abuse.)
Cheers,
--
Adeodato Simó dato at net.com.org.es
Debian Developer adeodato at debian.org
One of my most productive days was throwing away 1000 lines of code.
-- Ken Thompson
Reply to: