Best described as an example: "equery belongs /lib/modules" prints (snipping a lot of the output) media-sound/alsa-driver-0.9.8 (/lib/modules/2.4.22-gentoo-r3/kernel/sound/acore/oss) x11-base/xfree-4.3.0-r3 (/usr/X11R6/lib/modules/codeconv/libTCVN.a) x11-base/xfree-drm-4.3.0-r6 (/lib/modules/2.4.22-gentoo-r3/kernel) This is a side-effect of using regular expressions to match the filename. This is confusing as the usage message states that it prints the packages owning the file. In this case xfree doesn't claim ownership of /lib/modules. This is easily gotten around by using "^/lib/modules$", but I'm not sure that the normal user using the query command is going to understand regular expressions. My opinion is that the command should default to anchoring the filename passed so that it will only match the exact filename passed, and a local option added that would use the current behavior of searching by regular expression. Another good example is to run equery belongs /etc vs. equery belongs "^/etc$" The first command lists 86 packages while the second lists 85 packages. The difference being app-portage/gentoolkit which places no files in /etc but installs the command /usr/bin/etcat Finally, even though I feel like I'm picking equery completely apart, It appears to be well written and I really appreciate the work involved. Reproducible: Always Steps to Reproduce: 1. run equery belongs /etc 2. 3. Actual Results: Printed all packages that match as a reqular expression Expected Results: Print all packages that match the filename exactly Portage 2.0.50_pre10 (default-x86-1.4, gcc-3.2.3, glibc-2.3.2-r3, 2.4.22-gentoo-r3) ================================================================= System uname: 2.4.22-gentoo-r3 i686 Pentium III (Coppermine) Gentoo Base System version 1.4.3.10 Autoconf: sys-devel/autoconf-2.57-r1 Automake: sys-devel/automake-1.7.5-r2 ACCEPT_KEYWORDS="x86" AUTOCLEAN="yes" CFLAGS="-O3 -march=pentium3 -fprefetch-loop-arrays -funroll-loops -pipe" CHOST="i686-pc-linux-gnu" COMPILER="gcc3" CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3.1/share/config /usr/kde/3/share/config /usr/share/config /var/bind /var/qmail/control" CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d" CXXFLAGS="-O3 -march=pentium3 -fprefetch-loop-arrays -funroll-loops -pipe" DISTDIR="/usr/portage/distfiles" FEATURES="autoaddcvs ccache fixpackages sandbox" GENTOO_MIRRORS="http://gentoo.oregonstate.edu http://distro.ibiblio.org/pub/Linux/distributions/gentoo" MAKEOPTS="" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/usr/local/portage" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="X acpi alsa apm arts avi berkdb crypt cups encode esd foomaticdb gdbm gif gtk gtk2 i8x0 imlib java jpeg kde libg++ libwww mad mbox mikmod mmx motif mozilla mpeg ncurses nls oggvorbis opengl oss pam pda pdflib perl png ppds python qt readline samba sdl slang spell sse ssl svga tcltk tcpd tiff truetype usb x86 xml2 xmms xv zlib"
I think a global option to switch between the two makes sense, I'll look at this when I'm done with the whitespace conversion ;)
Added an option -f to belongs that signifies that the query is a full regex. If that option is not given, belongs /foo will internally be converted to belongs -f "^/foo$". belongs foo will be converted to belongs "/foo$". The rationale is as follows: belongs /some/path <- is probably a complete path, if not, just use -f belongs foo <- is probably for a command, if not, use -f "foo.*" If you have objections, speak now, or hold your forever hold your peace;P Will become available on next release of gentoolkit.
It makes sense to me, so as far as I'm concerned it looks good.