apt-file search prints all results twice

Bug #174134 reported by Detlef Lechner
6
Affects Status Importance Assigned to Milestone
apt-file (Ubuntu)
Fix Released
Medium
Daniel Hahler

Bug Description

Binary package hint: apt-file

detlef@MD97600:~$ sudo apt-file update && apt-file search <filename string> prints all results in a Gnome terminal twice. Not long ago on the same computer it printed all results thrice.
"uname -a; Linux MD97600 2.6.22-14-generic #1 SMP Sun Oct 14 23:05:12 GMT 2007 i686 GNU/Linux"
Gnome Terminal revision "Terminal 2.18.2"
apt-file revision "2.0.8.2ubuntu2"

Revision history for this message
Detlef Lechner (detlef-lechner) wrote :

An example listing.

Revision history for this message
Heinrich Kruger (heindsight-deactivatedaccount) wrote :

Same thing here, except that everything gets printed three times, not just twice.
This happens with "apt-file list" as well as "apt-file search"

Same version of apt-file, on gutsy amd64.

A simple workaround is to pipe apt-file's output through uniq:
apt-file [list|search] <package or file name> | uniq

Revision history for this message
Daniel Hahler (blueyed) wrote :

My guess is that it's related to having multiple *.Contents-ARCH.gz files around.

Please post the output of
apt-file -v search foobar | grep "^D: Search in"

The "-v" should display debugging info, which I'm interested in.

On my hardy system it looks like:
D: Search in \/var\/cache\/apt\/apt\-file\/archive\.ubuntu\.com_ubuntu_dists_hardy_Contents\-i386\.gz
D: Search in \/var\/cache\/apt\/apt\-file\/de\.packages\.medibuntu\.org_dists_gutsy_Contents\-i386\.gz

Changed in apt-file:
assignee: nobody → blueyed
importance: Undecided → Medium
status: New → Incomplete
Revision history for this message
era (era) wrote :
Download full text (3.9 KiB)

Actually, you'll need to redirect stderr in order for the grep to do anything useful.

vnix$ apt-file -v search foobar 2>&1 >/dev/null | grep '^D: Search in'
D: Search in \/var\/cache\/apt\/apt\-file\/fi\.archive\.ubuntu\.com_ubuntu_dists_gutsy_Contents\-amd64\.gz
D: Search in \/var\/cache\/apt\/apt\-file\/fi\.archive\.ubuntu\.com_ubuntu_dists_gutsy\-updates_Contents\-amd64\.gz
D: Search in \/var\/cache\/apt\/apt\-file\/fi\.archive\.ubuntu\.com_ubuntu_dists_gutsy_Contents\-amd64\.gz
D: Search in \/var\/cache\/apt\/apt\-file\/fi\.archive\.ubuntu\.com_ubuntu_dists_gutsy\-backports_Contents\-amd64\.gz

vnix$ apt-file -v search foobar 2>&1 >/dev/null | sed -e '/^D: Search in /!d' -e 's///' -e 's/\\//g' | xargs ls -l
-rw-r--r-- 1 root root 6170 2006-04-07 16:04 /var/cache/apt/apt-file/fi.archive.ubuntu.com_ubuntu_dists_gutsy-backports_Contents-amd64.gz
-rw-r--r-- 1 root root 13723633 2007-10-17 06:02 /var/cache/apt/apt-file/fi.archive.ubuntu.com_ubuntu_dists_gutsy_Contents-amd64.gz
-rw-r--r-- 1 root root 13723633 2007-10-17 06:02 /var/cache/apt/apt-file/fi.archive.ubuntu.com_ubuntu_dists_gutsy_Contents-amd64.gz
-rw-r--r-- 1 root root 6170 2006-04-07 16:04 /var/cache/apt/apt-file/fi.archive.ubuntu.com_ubuntu_dists_gutsy-updates_Contents-amd64.gz

vnix$ apt-file -v search foobar 2>&1 >/dev/null | sed -e '/^D: Search in /!d' -e 's///' -e 's/\\//g' | xargs file
/var/cache/apt/apt-file/fi.archive.ubuntu.com_ubuntu_dists_gutsy_Contents-amd64.gz: gzip compressed data, from Unix, max compression
/var/cache/apt/apt-file/fi.archive.ubuntu.com_ubuntu_dists_gutsy-updates_Contents-amd64.gz: HTML document text
/var/cache/apt/apt-file/fi.archive.ubuntu.com_ubuntu_dists_gutsy_Contents-amd64.gz: gzip compressed data, from Unix, max compression
/var/cache/apt/apt-file/fi.archive.ubuntu.com_ubuntu_dists_gutsy-backports_Contents-amd64.gz: HTML document text

vnix$ apt-file search foobar

gzip: /var/cache/apt/apt-file/fi.archive.ubuntu.com_ubuntu_dists_gutsy-updates_Contents-amd64.gz: not in gzip format

gzip: /var/cache/apt/apt-file/fi.archive.ubuntu.com_ubuntu_dists_gutsy-backports_Contents-amd64.gz: not in gzip format
doc-iana: usr/share/doc/doc-iana/html/assignments/foobar-af-numbers
doc-iana: usr/share/doc/doc-iana/html/assignments/foobar-af-numbers
ecos: usr/src/ecos/packages/fs/rom/v2_0/tests/testromfs/var/foobar
ecos: usr/src/ecos/packages/fs/rom/v2_0/tests/testromfs/var/foobar
picon-usenix: usr/share/picons/usenix/edu/umd/eng/foobar/face.gif
picon-usenix: usr/share/picons/usenix/edu/umd/eng/foobar/face.gif
picon-usenix: usr/share/picons/usenix/edu/umd/eng/foobar/face.xbm
picon-usenix: usr/share/picons/usenix/edu/umd/eng/foobar/face.xbm
picon-usenix: usr/share/picons/usenix/edu/umd/eng/foobar/face.xpm
picon-usenix: usr/share/picons/usenix/edu/umd/eng/foobar/face.xpm
texlive-latex-extra: usr/share/doc/texlive-doc/latex/examdesign/foobar.tex
texlive-latex-extra: usr/share/doc/texlive-doc/latex/examdesign/foobar.tex
texlive-latex-extra: usr/share/doc/texlive-latex-extra/latex/examdesign/foobar.tex
texlive-latex-extra: usr/share/doc/texlive-latex-extra/latex/examdesign/foobar.tex
xpilot-extra: us...

Read more...

Changed in apt-file:
status: Incomplete → New
Revision history for this message
era (era) wrote :

> I think this confirms your hypothesis.

Actually, it doesn't, because the same file is listed twice. However, it's quite possible that the root cause for this is the existence of multiple Contents files.

vnix$ apt-file -v search foobar 2>&1 >/dev/null | sed -e '/^D: Search in /!d' -e 's///' -e 's/\\//g' | sort | uniq -c
      1 /var/cache/apt/apt-file/fi.archive.ubuntu.com_ubuntu_dists_gutsy-backports_Contents-amd64.gz
      2 /var/cache/apt/apt-file/fi.archive.ubuntu.com_ubuntu_dists_gutsy_Contents-amd64.gz
      1 /var/cache/apt/apt-file/fi.archive.ubuntu.com_ubuntu_dists_gutsy-updates_Contents-amd64.gz

Revision history for this message
era (era) wrote :

And here's why. You have one stanza for "main restricted multiverse" and another for "universe". This is how it's configured (commented-out) when you install, so it's likely that most people who have universe and/or multiverse enabled will see this.

vnix$ apt-file -v search foobar 2>&1 | grep "^D: kept "
D: kept 'deb http://fi.archive.ubuntu.com/ubuntu/ gutsy main restricted multiverse'
D: kept 'deb http://fi.archive.ubuntu.com/ubuntu/ gutsy-updates restricted main multiverse universe'
D: kept 'deb http://fi.archive.ubuntu.com/ubuntu/ gutsy universe'
D: kept 'deb http://fi.archive.ubuntu.com/ubuntu/ gutsy-backports main restricted universe multiverse'
D: kept 'deb http://security.ubuntu.com/ubuntu gutsy-security main restricted multiverse'
D: kept 'deb http://security.ubuntu.com/ubuntu gutsy-security universe'

Daniel Hahler (blueyed)
Changed in apt-file:
status: New → In Progress
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package apt-file - 2.0.8.2ubuntu3

---------------
apt-file (2.0.8.2ubuntu3) hardy; urgency=low

  * Improved "need to run apt-file update" experience (LP: #154180)
    - debian/apt-file.postinst:
      - Do not call apt-file update anymore directly
      - install update-notifier hook
    - debian/control: Depend on "menu" for su-to-root
    - apt-file: test if the cache directory is empty for actions
      search/find and show/list.
  * apt-file: reverted removal of leading slash in pattern and implement
    logic to match both without slash at the beginning and with slash
    inside (LP: #181600). Apply the same logic to regexp patterns (-x).
  * debian/rules:
    - moved DH_COMPAT=3 to debian/compat (increased to 5)
    - Fixed debian-rules-ignores-make-clean-error
    - Dropped binary-arch target
  * Fix typos/wording in README
  * apt-file.conf: Add integrity check for fetched files (LP: #176753)
  * apt-file: find_command: remove leading spaces and open parentheses
    before looking for the command, so that the new defaults in
    apt-file.conf work
  * apt-file: print output from command after executing it, so that
    errors and notes from there get to the user
  * debian/apt-file.postrm: added DEBHELPER marker
  * debian/control:
    - Dropped Build-Depends-Indep: debhelper (>> 3.0.0)
    - Build-Depends: debhelper (>= 5), cdbs
    - Standards-Version: 3.7.3
    - Recommend "file", which gets used optionally for the integrity check
  * apt-file.bash_completion: filename/directory completion for "search",
    patch taken from Debian bug #448358
  * apt-file/do_grep: only search in all cache files once (LP: #174134)
  * apt-file: fix display of warning in purge_cache, if the file cannot be
    deleted
  * Applied patches from Kevin Glynn in a lot of places, see Debian bug
    #382312). Thanks!
  * Support files in /etc/apt/sources.list.d/ (LP: #190602) (Closes: #353275)
    Patches from Amos Shapira and Andrew Schulman.

 -- Daniel Hahler <email address hidden> Fri, 15 Feb 2008 00:18:52 +0100

Changed in apt-file:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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