XPost: linux.debian.maint.dpkg
On 2024-07-11 12:32:44 -0400, js wrote:
dpkg-query does not use a partial pathname as a pattern to search.
Example:
=> which exiftool
/bin/exiftool
=> dpkg-query --search `which exiftool`
dpkg-query: no path found matching pattern /bin/exiftool
=> dlocate `which exiftool`
libimage-exiftool-perl: /usr/bin/exiftool
=> dpkg-query --search /usr/bin/exiftool
libimage-exiftool-perl: /usr/bin/exiftool
=> /bin/ls -lt /usr/bin/exiftool /bin/exiftool
-rwxr-xr-x 1 root root 320936 Feb 2 19:43 /bin/exiftool
-rwxr-xr-x 1 root root 320936 Feb 2 19:43 /usr/bin/exiftool
This seems to be the intended behavior. In the dpkg-query(1) man page:
-S, --search filename-search-pattern...
[...]
If the first character in the filename-search-pattern is
none of ‘*[?/’ then it will be considered a substring match
and will be implicitly surrounded by ‘*’ (as in
*filename-search-pattern*).
Since your searches start with "/", you are requesting an exact match.
Using realpath solves the issue:
$ dpkg-query --search $(realpath /bin/exiftool)
libimage-exiftool-perl: /usr/bin/exiftool
You could write a small script that does what you want.
--
Vincent Lefèvre <
vincent@vinc17.net> - Web: <
https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <
https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Pascaline project (LIP, ENS-Lyon)
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)