Package: libdpkg-perl Version: 1.17.24 Severity: minor Tags: patch Dear Maintainer,
I'm creating a little tool around Dpkg::Index and I'm trying to list all
packages build from one source package.
I was trying to get all binary packages with “Source: <package>”, but it
does not work if the binary package has the same name as the Source one,
like “dpkg” for example.
This results in the following warning:
Use of uninitialized value in string eq at /usr/share/perl5/Dpkg/Index.pm
line 229.
I attach a little script to reproduce and a patch to check criteria
existence.
Regards.
-- System Information:
Debian Release: 8.0
APT prefers unstable
APT policy: (500, 'unstable'), (500, 'testing'), (90, 'experimental')
Architecture: amd64 (x86_64)
Kernel: Linux 3.16.0-4-amd64 (SMP w/2 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages libdpkg-perl depends on:
ii dpkg 1.17.24
ii libtimedate-perl 2.3000-2
ii perl 5.20.2-2
Versions of packages libdpkg-perl recommends:
ii bzip2 1.0.6-7+b2
ii libfile-fcntllock-perl 0.22-1+b1
ii xz-utils 5.1.1alpha+20120614-2+b3
Versions of packages libdpkg-perl suggests:
ii binutils 2.25-5
ii debian-keyring 2015.03.04
ii gcc [c-compiler] 4:4.9.2-2
ii gcc-4.8 [c-compiler] 4.8.4-1
ii gcc-4.9 [c-compiler] 4.9.2-10
ii gnupg 1.4.18-7
ii gnupg2 2.0.26-6
ii gpgv 1.4.18-7
ii patch 2.7.5-1
-- no debconf information
#!/usr/bin/perl
use v5.14.0;
use utf8;
use Dpkg;
use Dpkg::Index;
use Dpkg::Control qw< CTRL_FILE_STATUS >;
my $index = Dpkg::Index->new(type => CTRL_FILE_STATUS);
$index->load($Dpkg::ADMINDIR . '/status');
my @pkgs = $index->get(Source => 'dpkg');
say "dpkg source build the following binary packages:";
for my $pkg (@pkgs) {
say "- " . $pkg->{'Package'};
}
From b5c16ebc5a5da8a37e41f50b1098b0b7da3ae2fa Mon Sep 17 00:00:00 2001 From: Daniel Dehennin <[email protected]> Date: Sat, 21 Mar 2015 14:38:04 +0100 Subject: [PATCH] Dpkg::Index: Check existence of search criteria --- scripts/Dpkg/Index.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/Dpkg/Index.pm b/scripts/Dpkg/Index.pm index 13551b5..ffcedb7 100644 --- a/scripts/Dpkg/Index.pm +++ b/scripts/Dpkg/Index.pm @@ -227,7 +227,8 @@ sub get_keys { } @selected; } else { @selected = grep { - $self->{items}{$_}{$s_crit} eq $crit{$s_crit} + exists ($self->{items}{$_}{$s_crit}) + && $self->{items}{$_}{$s_crit} eq $crit{$s_crit} } @selected; } } -- 2.1.4
signature.asc
Description: PGP signature

