Bug 3278 - --provides and --whatprovides not adequate
--provides and --whatprovides not adequate
Product: Red Hat Linux
Classification: Retired
Component: rpm (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jeff Johnson
Depends On:
  Show dependency treegraph
Reported: 1999-06-04 20:29 EDT by Joshua Jensen
Modified: 2008-05-01 11:37 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 1999-12-15 13:29:04 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Joshua Jensen 1999-06-04 20:29:26 EDT
Very, very, very classic problem.  An rpm can't be installed
because it needs file xyz to be present on the system.
Intuitively, "rpm -qp --whatprovides xyz *" should be able
to find this file, but it can't.  Yes, rpmfind does exist,
but I don't want to know the Caldera rpm from 2 years ago
that contains the file I need on my Red Hat system.  I would
like to suggest the addition of a --whatcontains switch to
rpm.  This should be almost trivial to implement.   It would
be very nice for the simple user to issue something similar
to the following command:
rpm -qp --whatcontains filexyz /mnt/cdrom/RedHat/RPMS/*
and get the name of the local package file that needs to be
installed. This has many advantages to rpmfind, in that the
user would not require a network connection or a locally
built rpmfind database.
Comment 1 Jeff Johnson 1999-12-15 13:29:59 EST
rpm-3.0.4 does the Right Thing when invoked as
	rpm --whatprovides /path/to/file
(There's still the "database doesn't know about what's not installed" problem,
but that's a different issue).
Comment 2 Riley H Williams 1999-12-15 14:24:59 EST
I wrote a bash script to do this a while back. I'm not at home at the moment, so
this isn't the original script, but it was similar. I'll post the original
script on Saturday (next time I'll have the chance):

if [ $# -eq 0 ]; then
    echo "Usage: `basename $0` file..." >&2
    exit 255
for RPM in *.rpm ; do
    for WORD do
        if rpm -qlp $RPM 2> /dev/null | fgrep "$WORD" > /dev/null ; then
            printf '%38s => %s\n' "$RPM" "$WORD"
exit 0

Note that the above script will return ALL matches to EACH of the search strings
provided that occur in any of the filenames listed therein.
Comment 3 Jeff Johnson 1999-12-15 15:02:59 EST
That'll work :-)

Meanwhile, the original issue (AFAICT) was that --whatprovides looked only
at provides and not at files. In rpm-3.0.4, depending on whether the arg
begins with '/', rpm will look at either provides or file lists, thus
suimplifying the user interface.
Comment 4 Riley H Williams 1999-12-16 18:27:59 EST
If you wish to add the above script to the RPM package, go ahead. I checked it
against my script at home, and there was no functional difference (the only
actual difference was the use of FILE instead of WORD and that is definately

Note You need to log in before you can comment on or make changes to this bug.