Duplicate packages entries en AptPkg::Cache

Bug #994509 reported by Javier Amor Garcia
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
libapt-pkg-perl (Debian)
Fix Released
Unknown
libapt-pkg-perl (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Package version 0.1.25build2
Ubuntu version 12.04 Ubuntu precise (development branch)

I have only seen this problem in one machine out of tens.

The AptPkg::Cache has duplicate key entries for the packages. Normally perl has could not have duplicates keys but his is a tied hash .

I attached the cache.pl simple script to test it.:

====
use strict;
use warnings;
use AptPkg::Cache;

my $cache = AptPkg::Cache->new();
foreach my $key (keys %{$cache}) {
    print "$key\n";
}

print "Done";

1;
====

In the affected machine we get duplciate entries for all packages:
root@host:~# perl cache.pl | tail
libsdbm-ruby1.8
libsdbm-ruby1.8
libreoffice-l10n-ga
libindicate-doc
libungif4g
libungif4g
libreadline-dev
libreadline-dev
libpng12-dev
libpng12-dev

====

However if we use apt-cache all is normal:
root@zentyal23:~# apt-cache policy libpng12-dev
libpng12-dev:
  Installed: (none)
  Candidate: 1.2.46-3ubuntu4
  Version table:
     1.2.46-3ubuntu4 0
        500 http://fr.archive.ubuntu.com/ubuntu/ precise/main amd64 Packages
====

The sources.list used in this test (I only let one entry to simplify thing):

root@zentyal23:~# cat /etc/apt/sources.list

deb http://fr.archive.ubuntu.com/ubuntu/ precise main restricted
=====

Also I have tested to run apt-get update but this not fixed the problem, anyway apt-cache and apt-get works as expected so this should be a specific problem of libapt-pkg-perl

Revision history for this message
Javier Amor Garcia (javier-amor-garcia) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in libapt-pkg-perl (Ubuntu):
status: New → Confirmed
Revision history for this message
Andrew Ayer (agwa) wrote :

Are you seeing this behavior on a multi-arch system (i.e. a system where `dpkg --print-foreign-architectures` has non-empty output)? I discovered that the keys method of AptPkg::Cache returns one copy of each package name for every architecture (so if you have 3 architectures, you'll see each package name 3 times). See Debian bug #707142.

Changed in libapt-pkg-perl (Debian):
status: Unknown → New
Revision history for this message
Javier Amor Garcia (javier-amor-garcia) wrote :

Sorry, I don't remember and I have not longer access to the system

Changed in libapt-pkg-perl (Debian):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.