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

Re: dpkg doing wrong math (0.09 = 0.9) ?- [was: dak now supports ~ in version numbers]

On Fri, Aug 11, 2006 at 01:12:59AM +0200, Michael Biebl wrote:
> I have to admit that when choosing 0.09+0.1 as version number I didn't
> check with dpkg --compare-versions because then I would have discovered
> 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.
> So, what should I do now:
> 1.) Wait for a 0.10 release. I think my users wouldn't be happy ;-)
> 2.) Use an epoch.
> 3.) File a bug report against dpkg.
> 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.

Oooh, oooh!  I know the answer to this!  <fx: waves hand in the air, squirms
in seat>

Having recently written a program to do quite detailed things with package
version numbers, I've gotten intimately familiar with Policy s5.6.12. 
Specifically, 09 == 9 because "The numerical values of these two parts are
compared" (3rd last paragraph), so leading zeroes are effectively stripped
before comparison.

I don't think it's a bug in dpkg or policy, realistically speaking -- the
old practice of "0.01" versioning is pretty weird in general (periods are
cheap, just make it 0.0.1 instead), and numeric sorting is much better in
the general case (would you want 9 gt 10 == true?) but it just happens to
have bitten you here.

I think you're up for an epoch.

- Matt

Reply to: