[Bug 1616953] Re: dpkg --compare-versions comparison incorrect for some package versions
Adam Conrad
adconrad at 0c3.net
Mon Apr 10 09:49:35 UTC 2017
Debian Policy says that the "Debian revision" follows the *last* minus
sign, not the first. So, you think your Debian revisions are
-0ubuntu1-0 and -0ubuntu1-0, when in reality they're both -0.
As such, you're comparing upstream parts of: 1.3.1+16-0ubuntu1 and
1.3.1-0ubuntu1, without breaking on the dash, and it turns out those
sort in an order you didn't expect. A relevant shorter test case is:
(base)adconrad at nosferatu:~$ dpkg --compare-versions 1.2.3+4 gt 1.2.3-4
(base)adconrad at nosferatu:~$ echo $?
0
(base)adconrad at nosferatu:~$ dpkg --compare-versions 1.2.3+4-0 gt 1.2.3-4-0
(base)adconrad at nosferatu:~$ echo $?
1
Basically, + sorts lower than -, when it's not a special separator
between upstream and Debian revisions. This isn't a bug, just a poor
understanding of policy.
** Changed in: dpkg (Ubuntu)
Status: New => Invalid
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to dpkg in Ubuntu.
https://bugs.launchpad.net/bugs/1616953
Title:
dpkg --compare-versions comparison incorrect for some package versions
Status in dpkg package in Ubuntu:
Invalid
Bug description:
I have a situation where dpkg --compare-versions is reporting the
wrong status for certain package versions.
A simple example:
$ dpkg --compare-versions 1.3.1+16-0ubuntu1-0 gt 1.3.1-0ubuntu1-0
$ echo $?
1
It is the second '-' in the second version that is triggering this.
The first version should be greater than the second.
I spoke w/ Ken VanDine about this and he agreed that this looks like a
bug.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/dpkg/+bug/1616953/+subscriptions
More information about the foundations-bugs
mailing list