Package: apt-file
Version: 2.5.1
Severity: minor

It appears that the fix for #557719 has a flaw when multiple packages
contian the same file (can happen with diverts).  Take the perldoc
binary as an example:

"""
$ zgrep usr/bin/perldoc Contents-i386.gz
usr/bin/perldoc                                         perl/perl,doc/perl-doc
"""

... and apt-file gives:

"""
$ apt-file show -F perl | grep ^perl-doc:
perl-doc: /usr/bin/perldoc
"""

Attached is a test case for this bug.

~Niels
>From ebcb5ba4d1e65f56c601164646abfb2b2aa68dd9 Mon Sep 17 00:00:00 2001
From: Niels Thykier <ni...@thykier.net>
Date: Thu, 21 Mar 2013 11:19:05 +0100
Subject: [PATCH] tests: Add test case for fixed "show pkg" w. diverts

Signed-off-by: Niels Thykier <ni...@thykier.net>
---
 tests-apt-file/cache/site1_debian_dists_sid_main_Contents-fooarch |    1 +
 tests-apt-file/t/list_fixed_diverts.out                           |    1 +
 tests-apt-file/t/list_fixed_diverts.test                          |    2 ++
 tests-apt-file/t/regex_leading_slash.out                          |    2 ++
 4 files changed, 6 insertions(+)
 create mode 100644 tests-apt-file/t/list_fixed_diverts.out
 create mode 100644 tests-apt-file/t/list_fixed_diverts.test

diff --git a/tests-apt-file/cache/site1_debian_dists_sid_main_Contents-fooarch b/tests-apt-file/cache/site1_debian_dists_sid_main_Contents-fooarch
index a5cadbf..026c5d3 100644
--- a/tests-apt-file/cache/site1_debian_dists_sid_main_Contents-fooarch
+++ b/tests-apt-file/cache/site1_debian_dists_sid_main_Contents-fooarch
@@ -40,3 +40,4 @@ usr/lib/uml/modules/2.6.24/kernel/fs/fat/fat.ko		misc/user-mode-linux
 usr/lib/uml/modules/2.6.24/kernel/fs/vfat/vfat.ko	misc/user-mode-linux
 usr/lib/perl5/Template.pm				perl/libtemplate-perl
 usr/bin/mp3gain						audio/mp3gain
+usr/bin/perldoc						perl/perl,doc/perl-doc
diff --git a/tests-apt-file/t/list_fixed_diverts.out b/tests-apt-file/t/list_fixed_diverts.out
new file mode 100644
index 0000000..6702ae8
--- /dev/null
+++ b/tests-apt-file/t/list_fixed_diverts.out
@@ -0,0 +1 @@
+perl: /usr/bin/perldoc
diff --git a/tests-apt-file/t/list_fixed_diverts.test b/tests-apt-file/t/list_fixed_diverts.test
new file mode 100644
index 0000000..7613707
--- /dev/null
+++ b/tests-apt-file/t/list_fixed_diverts.test
@@ -0,0 +1,2 @@
+args=list -F perl
+bug=557719
diff --git a/tests-apt-file/t/regex_leading_slash.out b/tests-apt-file/t/regex_leading_slash.out
index db1a964..4a99102 100644
--- a/tests-apt-file/t/regex_leading_slash.out
+++ b/tests-apt-file/t/regex_leading_slash.out
@@ -5,3 +5,5 @@ bash-debug: /usr/debug/bin/bash
 bash-minimal: /bin/bash-minimal
 bash-static: /bin/bash-static
 mp3gain: /usr/bin/mp3gain
+perl: /usr/bin/perldoc
+perl-doc: /usr/bin/perldoc
-- 
1.7.10.4

Reply via email to