The following commit has been merged in the master branch:
commit 3fe3521d247a524a41018486aa2496c7803abed2
Author: Raphael Hertzog <hert...@debian.org>
Date:   Tue Jul 21 10:14:00 2009 +0200

    Dpkg::Changelog: fix heuristic to identify correct start entry
    
    The heuristic to identify the version number that is most approaching
    was not working properly for the case where the version number was smaller
    than the oldest version (for example "0"). Add a non-regression test for
    this case.
    
    Also add supplementary warnings message so that people notice when
    the parameters are discarded.

diff --git a/debian/changelog b/debian/changelog
index 881fdcf..e10794d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -37,6 +37,8 @@ dpkg (1.15.4) UNRELEASED; urgency=low
   * Upgrade Standards-Version to 3.8.2 (no changes).
   * Update deb-substvars(5) to list fields that do not support substvars.
     Closes: #535353
+  * Fix dpkg-parsechangelog to include all entries with -v0 parameter.
+    Closes: #537800
 
   [ Modestas Vainius ]
   * Provide a meaningful label for dpkg-gensymbols diff.
diff --git a/scripts/Dpkg/Changelog.pm b/scripts/Dpkg/Changelog.pm
index 7c4b1ca..8c37f13 100644
--- a/scripts/Dpkg/Changelog.pm
+++ b/scripts/Dpkg/Changelog.pm
@@ -262,7 +262,12 @@ sub __sanity_check_range {
                 last;
             }
         }
-        $$since = '' if not exists $versions{$$since}; # No version was smaller
+        if (not exists $versions{$$since}) {
+            # No version was smaller, include all
+            warning(_g("none found, starting from the oldest entry"));
+            $$since = '';
+            $$from = $versions[-1];
+        }
     }
     if ((length($$from) and not exists $versions{$$from})) {
         warning(_g("'%s' option specifies non-existing version"), "from");
@@ -276,6 +281,7 @@ sub __sanity_check_range {
         if (defined($oldest)) {
             $$from = $oldest;
         } else {
+            warning(_g("no such entry found, ignoring '%s' parameter"), 
"from");
             $$from = ''; # No version was bigger
         }
     }
@@ -291,6 +297,7 @@ sub __sanity_check_range {
         if (defined($oldest)) {
             $$until = $oldest;
         } else {
+            warning(_g("no such entry found, ignoring '%s' parameter"), 
"until");
             $$until = ''; # No version was bigger
         }
     }
@@ -303,7 +310,11 @@ sub __sanity_check_range {
                 last;
             }
         }
-        $$to = '' if not exists $versions{$$to}; # No version was smaller
+        if (not exists $versions{$$to}) {
+            # No version was smaller
+            warning(_g("no such entry found, ignoring '%s' parameter"), "to");
+            $$to = '';
+        }
     }
 
     if (length($$since) && ($data->[0]{Version} eq $$since)) {
diff --git a/scripts/t/600_Dpkg_Changelog.t b/scripts/t/600_Dpkg_Changelog.t
index 7182718..eed9fc5 100644
--- a/scripts/t/600_Dpkg_Changelog.t
+++ b/scripts/t/600_Dpkg_Changelog.t
@@ -10,7 +10,7 @@ BEGIN {
     my $no_err_examples = 1;
     my $no_tests = $no_examples * 4
        + $no_err_examples * 2
-       + 24 # countme
+       + 26 # countme
        +  2 # fields
        + 24;
 
@@ -150,6 +150,11 @@ foreach my $file ("$srcdir/countme", "$srcdir/shadow", 
"$srcdir/fields",
                       { since => '1:2.0~rc2-1sarge3' }, 3,
                       '2:2.0-1/1:2.0~rc2-3/1:2.0~rc2-2',
                       'since => "1:2.0~rc2-1sarge3"' );
+        $SIG{'__WARN__'} = sub {};
+        check_options( $changes, \...@data,
+                       { since => 0 }, 7, '',
+                       'since => 0 returns all');
+        delete $SIG{'__WARN__'};
        check_options( $changes, \...@data,
                       { to => '1:2.0~rc2-1sarge2' }, 3,
                       '1:2.0~rc2-1sarge2/1:2.0~rc2-1sarge1/1.5-1',

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to