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

Re: Wrong handling of empty strings in version numbers



On Tue, Aug 26, 2003 at 09:14:03PM +0200, Jens Seidel wrote:
> I think the handling of empty strings in version numbers is wrong
> (tested with dpkg 1.10.10).  I experienced with two packages
> pkg_1.1beta3-1_i386.deb and pkg_1.1-1_i386.deb. It seems that 1.1beta3-1
> is newer than version 1.1-1. Is this true?

% dpkg --compare-versions 1.1beta3-1 gt 1.1-1 && echo true || echo false
true

>  * now "" is compared with "beta3"
>    (is this correct, or is "-" compared with "beta3-"?)

No, it's 1.1 vs 1.1beta3. The Debian revision is compared separately.

>    "an empty string" ... "counts as zero", so "0" is compared with
>    "beta3", because of "letters sort earlier than all the non-letters"
>    we obtain 1.1beta3-1 < 1.1-1 !

No, empty string counts as zero in the digit comparison paragraph, not the
non-digit comparison paragraph.

The way I see it, it's 1 vs 1, . vs ., 1 vs 1, nothing vs beta3.
$2 wins, people who use "beta" in versions lose. ;)

-- 
     2. That which causes joy or happiness.



Reply to: