The following commit has been merged in the master branch:
commit c9e24e8e95f2354053e4a73592eafee7da240e8c
Author: Raphaël Hertzog <[email protected]>
Date:   Tue Nov 3 12:19:39 2009 +0100

    Dpkg::Changelog::get_range(): fix return value when range is empty
    
    Also fix scripts/changelog/debian.pl to better deal with undef values
    returned when the requested range matches an empty set of changelog
    entries.

diff --git a/scripts/Dpkg/Changelog.pm b/scripts/Dpkg/Changelog.pm
index 3fdb87e..0cd2f3c 100644
--- a/scripts/Dpkg/Changelog.pm
+++ b/scripts/Dpkg/Changelog.pm
@@ -333,9 +333,13 @@ sub get_range {
     my ($self, $range) = @_;
     $range = {} unless defined $range;
     my $res = $self->_data_range($range);
-    return undef unless defined $res;
-    return @$res if wantarray;
-    return $res;
+    if (defined $res) {
+       return @$res if wantarray;
+       return $res;
+    } else {
+       return () if wantarray;
+       return undef;
+    }
 }
 
 sub _data_range {
diff --git a/scripts/changelog/debian.pl b/scripts/changelog/debian.pl
index c5ec4ae..905864c 100755
--- a/scripts/changelog/debian.pl
+++ b/scripts/changelog/debian.pl
@@ -124,8 +124,10 @@ if ($file eq '-') {
        or error(_g('fatal error occured while parsing %s'), $file);
 }
 
-
-eval("print \$changes->${format}(\$range)");
+eval qq{
+    my \$output = \$changes->$format(\$range);
+    print \$output if defined \$output;
+};
 if ($@) {
     error("%s", $@);
 }

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to