apt-file search /ext2 ignores leading slash

Bug #181600 reported by era
2
Affects Status Importance Assigned to Milestone
apt-file (Debian)
Fix Released
Unknown
apt-file (Ubuntu)
Fix Released
Undecided
Daniel Hahler

Bug Description

Binary package hint: apt-file

If you try to limit your search to just files and directories which begin with "ext2" (excluding, in theory, any "ext2" in the root directory, but there is no such directory in any regular package anyway), apt-file should not ignore this and display all matches which contain "ext2" anywhere in them.

This is on a pretty vanilla Gutsy system:

vnix$ apt-file search /ext2 | head
autofs: usr/lib/autofs/mount_ext2.so
autofs: usr/lib/autofs/mount_ext2.so
autofs: usr/lib/autofs/mount_ext2.so
awesfx: usr/bin/text2sf
awesfx: usr/bin/text2sf
awesfx: usr/bin/text2sf
cmucl-source: usr/share/common-lisp/source/cmucl-hemlock/htext2.lisp
cmucl-source: usr/share/common-lisp/source/cmucl-hemlock/htext2.lisp
cmucl-source: usr/share/common-lisp/source/cmucl-hemlock/htext2.lisp
cmucl-source: usr/share/common-lisp/source/cmucl/hemlock/htext2.lisp

(Obviously, bug #174134 is also at play here.)

Revision history for this message
In , Sebastien J. Gross (sjg) wrote : Bug#190122: fixed in apt-file 2.0.3-2

We believe that the bug you reported is fixed in the latest version of
apt-file, which is due to be installed in the Debian FTP archive:

apt-file_2.0.3-2.dsc
  to pool/main/a/apt-file/apt-file_2.0.3-2.dsc
apt-file_2.0.3-2.tar.gz
  to pool/main/a/apt-file/apt-file_2.0.3-2.tar.gz
apt-file_2.0.3-2_all.deb
  to pool/main/a/apt-file/apt-file_2.0.3-2_all.deb

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed. If you
have further comments please address them to <email address hidden>,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Sebastien J. Gross <email address hidden> (supplier of updated apt-file package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing <email address hidden>)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.7
Date: Fri, 16 May 2003 15:14:51 +0200
Source: apt-file
Binary: apt-file
Architecture: source all
Version: 2.0.3-2
Distribution: unstable
Urgency: low
Maintainer: Sebastien J. Gross <email address hidden>
Changed-By: Sebastien J. Gross <email address hidden>
Description:
 apt-file - APT package searching utility -- command-line interface
Closes: 190122
Changes:
 apt-file (2.0.3-2) unstable; urgency=low
 .
   * Remove leading slash in pattern (Closes: #190122)
Files:
 4c834fdc93e8f9d28dee9e57995fbad5 505 base optional apt-file_2.0.3-2.dsc
 05fb23af51b35958836403c5b2de6649 11927 base optional apt-file_2.0.3-2.tar.gz
 b73682501e53dc6071277cb5603439f0 10996 base optional apt-file_2.0.3-2_all.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+xOTLKiWEIVO7pJARAhZtAKCmJ04GeiWeT5Hh3SdrS96LAZLbKgCeOngn
v6/wJIzNh5gE/AUgOBTXlEI=
=/AoA
-----END PGP SIGNATURE-----

Revision history for this message
era (era) wrote :

Binary package hint: apt-file

If you try to limit your search to just files and directories which begin with "ext2" (excluding, in theory, any "ext2" in the root directory, but there is no such directory in any regular package anyway), apt-file should not ignore this and display all matches which contain "ext2" anywhere in them.

This is on a pretty vanilla Gutsy system:

vnix$ apt-file search /ext2 | head
autofs: usr/lib/autofs/mount_ext2.so
autofs: usr/lib/autofs/mount_ext2.so
autofs: usr/lib/autofs/mount_ext2.so
awesfx: usr/bin/text2sf
awesfx: usr/bin/text2sf
awesfx: usr/bin/text2sf
cmucl-source: usr/share/common-lisp/source/cmucl-hemlock/htext2.lisp
cmucl-source: usr/share/common-lisp/source/cmucl-hemlock/htext2.lisp
cmucl-source: usr/share/common-lisp/source/cmucl-hemlock/htext2.lisp
cmucl-source: usr/share/common-lisp/source/cmucl/hemlock/htext2.lisp

(Obviously, bug #174134 is also at play here.)

Revision history for this message
era (era) wrote :

This would be the expected output on this system:

vnix$ apt-file search /ext2 | uniq | fgrep /ext2 | head
comerr-dev: usr/share/doc/libcomerr2/examples/ext2_err.et.gz
cryptsetup: lib/cryptsetup/checks/ext2
doc-linux-html: usr/share/doc/HOWTO/en-html/Flash-Memory-HOWTO/ext2.html
doc-linux-html-pt: usr/share/doc/HOWTO/pt-html/mini/ext2fs-undeletions.pt_BR.html.gz
doc-linux-ja-text: usr/share/doc/HOWTO/ja-txt/kernel-docs-2.4/filesystems/ext2.txt.gz
doc-linux-ja-text: usr/share/doc/HOWTO/ja-txt/kernel-docs-2.6/filesystems/ext2.txt.gz
doc-linux-text-pt: usr/share/doc/HOWTO/pt-text/mini/ext2fs-undeletions.pt_BR.txt.gz
e2fslibs-dev: usr/include/ext2fs/bitops.h
e2fslibs-dev: usr/include/ext2fs/ext2_err.h
e2fslibs-dev: usr/include/ext2fs/ext2_ext_attr.h

I noticed this in the Changelog for version 2.0.3-2, back in 2003:

  * Remove leading slash in pattern (Closes: #190122)

and also for 2.0.5:

  * Remove tailling slash (Closes: #280690)

I seriously question the logic behind these changes. (These are Debian bug numbers, I believe.)

If I were to work on a different approach to these bugs, should I submit it directly to Debian, or could you consider it for Ubuntu? (I might also end up reverting the changes introduced in Launchpad bug #33483 and bug #33485 on the same principles; I'm somewhat skeptical of those patches.)

Revision history for this message
era (era) wrote :

Ping? Daniel Hahler, any comment?

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

It has been changed in Debian, because a search for "/var/cache" would fail, without the removed slash.

I will change it as follows:
1. Do not remove the slash from the pattern
2. If there's a slash at the beginning, match both with pattern and pattern-with-slash removed, but anchored at the beginning

For "apt-file search /sbin" the regexp should look like this then:
D: regexp: ^(sbin|.*\/sbin[^\s]*)\s+(\S+)\s*$

You can see the generated regexp/pattern yourself by using the "-v" option with apt-file.

The 2.0.5 change (trailing slash) is something different, see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=280690

I have it just fixed, but want to look at other bugs/wishes, too, before uploading it - hopefully tomorrow.

Changed in apt-file:
status: Unknown → Fix Released
Revision history for this message
era (era) wrote :

I would argue that the "fix" for http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=190122 is the cause of the problem I'm seeing, so perhaps that should be removed as upstream bug tracker.

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=382312 coincidentally has a patch which (based on a brief glimpse) appears to address this issue, as well as a host of others.

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.