Bug 3278 - --provides and --whatprovides not adequate
Summary: --provides and --whatprovides not adequate
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: rpm
Version: 6.0
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Jeff Johnson
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 1999-06-05 00:29 UTC by Joshua Jensen
Modified: 2008-05-01 15:37 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 1999-12-15 18:29:04 UTC

Attachments (Terms of Use)

Description Joshua Jensen 1999-06-05 00:29:26 UTC
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 18:29:59 UTC
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 19:24:59 UTC
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 20:02:59 UTC
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 23:27:59 UTC
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.