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

Re: Is 1-0 equal to 1 as a version?



Florian Weimer <fw@deneb.enyo.de> writes:

> $ python -c 'import apt_pkg; apt_pkg.init(); print apt_pkg.VersionCompare("1", "1-0")'
> -1
> $ dpkg --compare-versions '1' = '1-0'; echo $?
> 0
>
> I think dpkg is right because policy says:
>
> | The absence of a <debian_revision> is equivalent to a
> | <debian_revision> of `0'.

Policy was changed to match dpkg in April of 2007:

  * Policy: better document version ranking and empty Debian revisions
    Wording: Russ Allbery <rra@debian.org>
    Seconded: Raphaël Hertzog <hertzog@debian.org>
    Seconded: Manoj Srivastava <srivasta@debian.org>
    Seconded: Guillem Jover <guillem@debian.org>
    Closes: #186700, #458910

> So this looks like a bug in APT.  But I think that in practice, the
> APT algorithm is the dominant one, so it might make sense to update
> policy and dpkg instead.

Debian revisions of -0 are quite rare in practice, which is probably why
no one has noticed the discrepancy.  We had a discussion of this in:

    http://bugs.debian.org/458910

although I don't think anyone realized at the time that apt didn't do the
same thing as dpkg.  My feeling is that dpkg should probably win here, but
I guess I don't feel strongly about it.

-- 
Russ Allbery (rra@debian.org)               <http://www.eyrie.org/~eagle/>


Reply to: