Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.

Bug 3278

Summary: --provides and --whatprovides not adequate
Product: [Retired] Red Hat Linux Reporter: Joshua Jensen <joshua>
Component: rpmAssignee: Jeff Johnson <jbj>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 6.0CC: rhw
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 1999-12-15 18:29:04 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

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