Debian Bug report logs - #458910
Policy and dpkg disagree on sorting of a -0 Debian revision

version graph

Package: debian-policy; Maintainer for debian-policy is Debian Policy List <debian-policy@lists.debian.org>; Source for debian-policy is src:debian-policy.

Reported by: Matthew Johnson <mjj29@debian.org>

Date: Thu, 3 Jan 2008 15:42:01 UTC

Severity: minor

Merged with 186700

Found in version 3.5.9.0

Fixed in version debian-policy/3.8.0.0

Done: Russ Allbery <rra@debian.org>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Debian Policy List <debian-policy@lists.debian.org>:
Bug#458910; Package debian-policy. Full text and rfc822 format available.

Acknowledgement sent to Matthew Johnson <mjj29@debian.org>:
New Bug report received and forwarded. Copy sent to Debian Policy List <debian-policy@lists.debian.org>. Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: Matthew Johnson <mjj29@debian.org>
To: submit@bugs.debian.org
Subject: debian-policy: Policy and dpkg disagree on debian revision tests.
Date: Thu, 3 Jan 2008 15:37:53 +0000
[Message part 1 (text/plain, inline)]
Subject: debian-policy: Policy and dpkg disagree on debian revision tests.
Package: debian-policy
Severity: normal

*** Please type your report below this line ***

Policy 5.6.12 states:

   The absence of a debian_revision compares earlier than the presence
   of one

However, dpkg tests return:

   dpkg --compare-versions 1 eq 1-0 && echo equal
   equal

This is similar to #186700 (but not the same, although feel free to
merge them)

The actual behaviour (including things like 1.2.3-0~0) is consistent
with an empty debian_revision being set to 0, as with the epoch and I
think policy should be updated to match.

Matt

[signature.asc (application/pgp-signature, inline)]

Severity set to `minor' from `normal' Request was from Russ Allbery <rra@debian.org> to control@bugs.debian.org. (Mon, 17 Mar 2008 06:15:04 GMT) Full text and rfc822 format available.

Changed Bug title to `Policy and dpkg disagree on sorting of a -0 Debian revision' from `debian-policy: Policy and dpkg disagree on debian revision tests.'. Request was from Russ Allbery <rra@debian.org> to control@bugs.debian.org. (Mon, 17 Mar 2008 06:15:04 GMT) Full text and rfc822 format available.

Merged 186700 458910. Request was from Russ Allbery <rra@debian.org> to control@bugs.debian.org. (Mon, 17 Mar 2008 06:15:05 GMT) Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Debian Policy List <debian-policy@lists.debian.org>:
Bug#458910; Package debian-policy. Full text and rfc822 format available.

Acknowledgement sent to Raphael Hertzog <hertzog@debian.org>:
Extra info received and forwarded to list. Copy sent to Debian Policy List <debian-policy@lists.debian.org>. Full text and rfc822 format available.

Message #16 received at 458910@bugs.debian.org (full text, mbox):

From: Raphael Hertzog <hertzog@debian.org>
To: Matthew Johnson <mjj29@debian.org>, 458910@bugs.debian.org
Subject: Re: Bug#458910: debian-policy: Policy and dpkg disagree on debian revision tests.
Date: Tue, 18 Mar 2008 09:06:26 +0100
Hi,

On Thu, 03 Jan 2008, Matthew Johnson wrote:
> Policy 5.6.12 states:
> 
>    The absence of a debian_revision compares earlier than the presence
>    of one
> 
> However, dpkg tests return:
> 
>    dpkg --compare-versions 1 eq 1-0 && echo equal
>    equal

I confirm that the implementation in dpkg is done in such a way that the
lack of revision is the same than a revision set to "0".
Exactly like the lack of epoch is equal to an epoch of 0.

Maybe we should say "the absence of a debian_revision compares earlier
than the presence of a non-empty non-null one".


In the perl code we use:
sub parseversion ($)
{
    my $ver = shift;
    my %verhash;
    if ($ver =~ /:/)
    {
        $ver =~ /^(\d+):(.+)/ or die "bad version number '$ver'";
        $verhash{epoch} = $1;
        $ver = $2;
    }
    else
    {
        $verhash{epoch} = 0;
    }
    if ($ver =~ /(.+)-(.+)$/)
    {
        $verhash{version} = $1;
        $verhash{revision} = $2;
    }
    else
    {
        $verhash{version} = $ver;
        $verhash{revision} = 0;
    }
    return %verhash;
}


The C code handles this differently and uses an empty string for the
lack of revision... however when it compares revision between them, it
skips any leading "0" and thus considers "0" as equal to the empty string.

Cheers,
-- 
Raphaël Hertzog

Le best-seller français mis à jour pour Debian Etch :
http://www.ouaza.com/livre/admin-debian/




Information forwarded to debian-bugs-dist@lists.debian.org, Debian Policy List <debian-policy@lists.debian.org>:
Bug#458910; Package debian-policy. Full text and rfc822 format available.

Acknowledgement sent to Russ Allbery <rra@debian.org>:
Extra info received and forwarded to list. Copy sent to Debian Policy List <debian-policy@lists.debian.org>. Full text and rfc822 format available.

Message #21 received at 458910@bugs.debian.org (full text, mbox):

From: Russ Allbery <rra@debian.org>
To: Raphael Hertzog <hertzog@debian.org>
Cc: Matthew Johnson <mjj29@debian.org>, 458910@bugs.debian.org
Subject: Re: Bug#458910: debian-policy: Policy and dpkg disagree on debian revision tests.
Date: Sun, 27 Apr 2008 19:04:44 -0700
Raphael Hertzog <hertzog@debian.org> writes:

> I confirm that the implementation in dpkg is done in such a way that the
> lack of revision is the same than a revision set to "0".  Exactly like
> the lack of epoch is equal to an epoch of 0.
>
> Maybe we should say "the absence of a debian_revision compares earlier
> than the presence of a non-empty non-null one".

Here is a proposed patch that also clarifies the comparison of version
numbers a bit.  Seconds?

diff --git a/policy.sgml b/policy.sgml
index 1c9a339..b7ac92e 100644
--- a/policy.sgml
+++ b/policy.sgml
@@ -2877,19 +2877,22 @@ Package: libc6
 	          number apart at the last hyphen in the string (if there
 	          is one) to determine the <var>upstream_version</var> and
 	          <var>debian_revision</var>.  The absence of a
-	          <var>debian_revision</var> compares earlier than the
-	          presence of one (but note that the
-	          <var>debian_revision</var> is the least significant part
-	          of the version number).
+	          <var>debian_revision</var> is equivalent to a
+	          <var>debian_revision</var> of <tt>0</tt>.
 	        </p>
 	      </item>
 	    </taglist>
 	  </p>
 
 	  <p>
-	    The <var>upstream_version</var> and <var>debian_revision</var>
+	    When comparing two version numbers, first the <var>epoch</var>
+	    of each are compared, then the <var>upstream_version</var> if
+	    <var>epoch</var> is equal, and then <var>debian_revision</var>
+	    if <var>upstream_version</var> is also equal.
+	    <var>epoch</var> is compared numerically.  The
+	    <var>upstream_version</var> and <var>debian_revision</var>
 	    parts are compared by the package management system using the
-	    same algorithm:
+	    following algorithm:
 	  </p>
 
 	  <p>

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




Tags added: patch Request was from Russ Allbery <rra@debian.org> to control@bugs.debian.org. (Mon, 28 Apr 2008 02:06:03 GMT) Full text and rfc822 format available.

Tags added: patch Request was from Russ Allbery <rra@debian.org> to control@bugs.debian.org. (Mon, 28 Apr 2008 02:06:04 GMT) Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Debian Policy List <debian-policy@lists.debian.org>:
Bug#458910; Package debian-policy. Full text and rfc822 format available.

Acknowledgement sent to Raphael Hertzog <hertzog@debian.org>:
Extra info received and forwarded to list. Copy sent to Debian Policy List <debian-policy@lists.debian.org>. Full text and rfc822 format available.

Message #30 received at 458910@bugs.debian.org (full text, mbox):

From: Raphael Hertzog <hertzog@debian.org>
To: Russ Allbery <rra@debian.org>
Cc: Matthew Johnson <mjj29@debian.org>, 458910@bugs.debian.org
Subject: Re: Bug#458910: debian-policy: Policy and dpkg disagree on debian revision tests.
Date: Tue, 29 Apr 2008 20:13:40 +0200
[Message part 1 (text/plain, inline)]
On Sun, 27 Apr 2008, Russ Allbery wrote:
> Here is a proposed patch that also clarifies the comparison of version
> numbers a bit.  Seconds?

Seconded. Looks fine.

-- 
Raphaël Hertzog

Le best-seller français mis à jour pour Debian Etch :
http://www.ouaza.com/livre/admin-debian/
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian Policy List <debian-policy@lists.debian.org>:
Bug#458910; Package debian-policy. Full text and rfc822 format available.

Acknowledgement sent to Guillem Jover <guillem@debian.org>:
Extra info received and forwarded to list. Copy sent to Debian Policy List <debian-policy@lists.debian.org>. Full text and rfc822 format available.

Message #35 received at 458910@bugs.debian.org (full text, mbox):

From: Guillem Jover <guillem@debian.org>
To: Russ Allbery <rra@debian.org>, 458910@bugs.debian.org
Cc: Raphael Hertzog <hertzog@debian.org>, Matthew Johnson <mjj29@debian.org>
Subject: Re: Bug#458910: debian-policy: Policy and dpkg disagree on debian revision tests.
Date: Wed, 30 Apr 2008 19:07:39 +0300
[Message part 1 (text/plain, inline)]
Hi,

On Sun, 2008-04-27 at 19:04:44 -0700, Russ Allbery wrote:
> Here is a proposed patch that also clarifies the comparison of version
> numbers a bit.  Seconds?
> 
> diff --git a/policy.sgml b/policy.sgml
> index 1c9a339..b7ac92e 100644
> --- a/policy.sgml
> +++ b/policy.sgml
> @@ -2877,19 +2877,22 @@ Package: libc6
>  	          number apart at the last hyphen in the string (if there
>  	          is one) to determine the <var>upstream_version</var> and
>  	          <var>debian_revision</var>.  The absence of a
> -	          <var>debian_revision</var> compares earlier than the
> -	          presence of one (but note that the
> -	          <var>debian_revision</var> is the least significant part
> -	          of the version number).
> +	          <var>debian_revision</var> is equivalent to a
> +	          <var>debian_revision</var> of <tt>0</tt>.
>  	        </p>
>  	      </item>
>  	    </taglist>
>  	  </p>
>  
>  	  <p>
> -	    The <var>upstream_version</var> and <var>debian_revision</var>
> +	    When comparing two version numbers, first the <var>epoch</var>
> +	    of each are compared, then the <var>upstream_version</var> if
> +	    <var>epoch</var> is equal, and then <var>debian_revision</var>
> +	    if <var>upstream_version</var> is also equal.
> +	    <var>epoch</var> is compared numerically.  The
> +	    <var>upstream_version</var> and <var>debian_revision</var>
>  	    parts are compared by the package management system using the
> -	    same algorithm:
> +	    following algorithm:
>  	  </p>
>  
>  	  <p>

Seconded.

regards,
guillem
[signature.asc (application/pgp-signature, inline)]

Tags set to: pending Request was from Russ Allbery <rra@debian.org> to control@bugs.debian.org. (Mon, 02 Jun 2008 19:39:02 GMT) Full text and rfc822 format available.

Tags set to: pending Request was from Russ Allbery <rra@debian.org> to control@bugs.debian.org. (Mon, 02 Jun 2008 19:39:02 GMT) Full text and rfc822 format available.

Reply sent to Russ Allbery <rra@debian.org>:
You have taken responsibility. Full text and rfc822 format available.

Notification sent to Matthew Johnson <mjj29@debian.org>:
Bug acknowledged by developer. Full text and rfc822 format available.

Message #44 received at 458910-close@bugs.debian.org (full text, mbox):

From: Russ Allbery <rra@debian.org>
To: 458910-close@bugs.debian.org
Subject: Bug#458910: fixed in debian-policy 3.8.0.0
Date: Wed, 04 Jun 2008 23:32:03 +0000
Source: debian-policy
Source-Version: 3.8.0.0

We believe that the bug you reported is fixed in the latest version of
debian-policy, which is due to be installed in the Debian FTP archive:

debian-policy_3.8.0.0.dsc
  to pool/main/d/debian-policy/debian-policy_3.8.0.0.dsc
debian-policy_3.8.0.0.tar.gz
  to pool/main/d/debian-policy/debian-policy_3.8.0.0.tar.gz
debian-policy_3.8.0.0_all.deb
  to pool/main/d/debian-policy/debian-policy_3.8.0.0_all.deb



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 458910@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Russ Allbery <rra@debian.org> (supplier of updated debian-policy package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.8
Date: Wed, 04 Jun 2008 15:53:27 -0700
Source: debian-policy
Binary: debian-policy
Architecture: source all
Version: 3.8.0.0
Distribution: unstable
Urgency: low
Maintainer: Debian Policy List <debian-policy@lists.debian.org>
Changed-By: Russ Allbery <rra@debian.org>
Description: 
 debian-policy - Debian Policy Manual and related documents
Closes: 65577 186700 209008 250202 291460 367984 379150 392362 403391 422552 430649 431813 440420 442070 452105 455602 458910 473761 475731 480551 481640 481954
Changes: 
 debian-policy (3.8.0.0) unstable; urgency=low
 .
   * Bug fix: "[PROPOSAL] "debian/README.source" file for packages with
     non-trivial source", thanks to Wouter Verhelst, Jörg Sommer, Colin Watson,
     and Junichi Uekawa                                       (Closes: #250202).
   * Bug fix: "[AMENDMENT 11/02/2008] Manual page encoding", thanks to
     Colin Watson                                             (Closes: #440420).
   * Bug fix: "[PROPOSAL] common interface for parallel building in
     DEB_BUILD_OPTIONS", thanks to Loïc Minier, Peter Samuelson, and Robert
     Millan                                                   (Closes: #209008).
   * Bug fix: "Please clarify splitting/syntax of DEB_BUILD_OPTIONS", thanks to
     Loïc Minier, Peter Samuelson, Robert Millan, and Guillem Jover
                                                              (Closes: #430649).
   * Bug fix: "Documentation for Breaks in dpkg", thanks to Ian Jackson
                                                              (Closes: #379150).
   * Bug fix: "support for wrapped Uploaders should now be mandatory"
                                                              (Closes: #431813).
   * Bug fix: "[PROPOSAL] Add should not embed code from other packages",
     thanks to Neil McGovern, Colin Watson, Bill Allombert, Steve Langasek,
     Kurt Roeckx, and others                                  (Closes: #392362).
   * Bug fix: "Homepage field in debian/control undocumented", thanks to
     Mario Iseli                                              (Closes: #452105).
   * Bug fix: "Policy inconsistent with reality: base subsection no longer
     used", thanks to Magnus Holmgren, Bernd Zeimetz, and Colin Watson
                                                              (Closes: #442070).
   * Bug fix: "Inclusion of Apache Software License versions in
     /usr/share/common-licenses", thanks to Barry Hawkins     (Closes: #291460).
   * Bug fix: "[Amended] copyright should include notice if a package is
     not a part of Debian distribution", thanks to Taketoshi Sano
                                                              (Closes: #65577).
   * Bug fix: "scripts as configuration files: should vs. must", thanks to Frank
     Küster                                                   (Closes: #403391).
   * Bug fix: "debconf specification should allow underscores in template
     names", thanks to Colin Watson                           (Closes: #473761).
   * Bug fix: "clarify handling of run-time and compile-time support programs",
     thanks to Goswin Brederlow and Raphael Hertzog           (Closes: #367984).
   * 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
   * Policy: remove obsolete app-defaults and Xresources provisions
     Wording: Julien Cristau <jcristau@debian.org>
     Seconded: Russ Allbery <rra@debian.org>
     Closes: #480551
   * Bug fix: "Examples of dpkg frontends should mention apt now", thanks
     to Josh Triplett                                         (Closes: #455602).
   * Bug fix: "Minor typos and wording suggestions", thanks to Michael
     Tautschnig                                               (Closes: #422552).
   * Bug fix: "substvar reference moved from dpkg-source(1) to
     deb-substvars(5)", thanks to Ian Beckwith                (Closes: #475731).
   * Policy: bugs fixed in NMUs are now closed rather than marked fixed
     Wording: Russ Allbery <rra@debian.org> (thanks, Sandro Tosi)
     Closes: #481640
   * Policy: C.1.4, C.1.8: minor typos
     Wording: Sandro Tosi <matrixhasu@gmail.com>
     Closes: #481954
   * Remove the now-obsolete policy-process document.
   * Add an md5sums control file.
   * Add Vcs-Browser and Vcs-Git control fields.
   * Remove build system support for FHS 2.1 and FSSTND, mostly commented out.
   * Remove more temporary files created by the build.
   * Remove the FSSTND license from debian/copyright; no FSSTND files are
     currently part of policy.
   * Update FHS copyright dates in debian/copyright.
   * Standardize the spacing around headings in upgrading-checklist.html.
   * Remove old ChangeLog files and metadata headers in maintainer scripts
     and debian/rules.
Checksums-Sha1: 
 f42b9921908670eb41c04940875084bc07750592 1095 debian-policy_3.8.0.0.dsc
 3eda45d7ca5563bab8bfda93286137071979385c 638655 debian-policy_3.8.0.0.tar.gz
 73680c98bc62507858aa055bcf1f1688a812f5ba 1588552 debian-policy_3.8.0.0_all.deb
Checksums-Sha256: 
 507a048bc7c84039910843e284d8e0e305778224346fd981c6f749176cc79220 1095 debian-policy_3.8.0.0.dsc
 8321b1dddd3ddd55a09539c842084ea05a731265c4c5847997957a552ba1aaa4 638655 debian-policy_3.8.0.0.tar.gz
 6c2083f50ccaa5a2f2d7a89febd320cf3a862b3204157324ffd9b363daac3e58 1588552 debian-policy_3.8.0.0_all.deb
Files: 
 37ff33fb3ccebc4f87e23fd7b91e7859 1095 doc optional debian-policy_3.8.0.0.dsc
 2565d6eaceac0aa2d093538048c1b8ed 638655 doc optional debian-policy_3.8.0.0.tar.gz
 3b153faeec899cdf1199d4d46c5d8859 1588552 doc optional debian-policy_3.8.0.0_all.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFIRyNB+YXjQAr8dHYRAt4NAKDbO1f3BlmKT5SgMVf4AHE2Z7bPTgCffcnI
Kwa3jEGgq+PV6dwiurjmSAc=
=wCDz
-----END PGP SIGNATURE-----





Reply sent to Russ Allbery <rra@debian.org>:
You have taken responsibility. Full text and rfc822 format available.

Notification sent to Anthony DeRobertis <asd@suespammers.org>:
Bug acknowledged by developer. Full text and rfc822 format available.

Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Fri, 04 Jul 2008 07:26:45 GMT) Full text and rfc822 format available.

Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Sat Apr 19 20:32:35 2014; Machine Name: beach.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.