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

Re: dpkg doing wrong math (0.09 = 0.9) ?-



Michael Biebl <biebl@teco.edu> writes:

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

Which is correct. Version strings can consist of (among other things)
any number of '.'-separated integers in sequence. Leading zeros on
the individual integers are not significant.

The full description of how values of the Version field are compared
is in Policy:

    5.6.12 Version
    [...]

    The strings are compared from left to right.

    First the initial part of each string consisting entirely of
    non-digit characters is determined. These two parts (one of which
    may be empty) are compared lexically. If a difference is found it
    is returned. The lexical comparison is a comparison of ASCII
    values modified so that all the letters sort earlier than all the
    non-letters.

    Then the initial part of the remainder of each string which
    consists entirely of digit characters is determined. The numerical
    values of these two parts are compared, and any difference found
    is returned as the result of the comparison. For these purposes an
    empty string (which can only occur at the end of one or both
    version strings being compared) counts as zero.

    These two steps (comparing and removing initial non-digit strings
    and initial digit strings) are repeated until a difference is
    found or both strings are exhausted.

    <URL:http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version>

-- 
 \       "I love to go down to the schoolyard and watch all the little |
  `\   children jump up and down and run around yelling and screaming. |
_o__)          They don't know I'm only using blanks."  -- Emo Philips |
Ben Finney



Reply to: