Bug 50524

Summary: rpmdepCheck() doesn't satisfy dependencies correctly
Product: [Retired] Red Hat Linux Reporter: wadim
Component: rpmAssignee: Jeff Johnson <jbj>
Status: CLOSED NOTABUG QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2001-07-31 21:05:26 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description wadim 2001-07-31 21:05:23 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.75 [en] (X11; U; Linux 2.2.14-14 i686)

Description of problem:
Description of a situation(just for example): package first-1.0-1.i386.rpm
requires lib.so.1, package second-1.0-1.i386.rpm provides lib.so.1. 
When I retreive tag RPMTAG_REQUIREVERSION or RPMTAG_PROVIDEVERSION from the
headers of those packages the result I get is equal to "".  When the
function rpmdepCheck() is called which must find out that package
second-1.0-1.i386.rpm is needed for package first-1.0-1.i386.rpm, it
finally gets into function rangeMatchesDepFlags(). This function has
condition:
 if (!(reqFlags & RPMSENSE_SENSEMASK) || !reqEVR || !strlen(reqEVR))
	return 1;
As require version is equal to "",  strlen(reqEVR) == 0, function returns
1, what means that dependency for package is satisfied by rpm-database what
is not true.

How reproducible:
Always

Steps to Reproduce:
1.Create two packages, one of which requires that, what another provides 
2.Generate hdlist
3.Write a program which uses rpmdepCheck()

	

Additional info:

Comment 1 Jeff Johnson 2001-08-01 00:59:55 UTC
Yup, this is exactly the way it's supposed to work.

Originally, rpm had not versions on Provides: and versions were
optional on Requires:. This is reflected in the code by the tests
for both a NULL pointer (i.e. tag is missing), as well as for the empty
string "" (i.e. no value for this element).

The semantics in that case is to interpret as Provides" all versions,
and or Requires: any version. The return of 1 is exactly correct, since
rangeMatchesDepFlags() is never called unless the name was in the database,
and the existince of the name is exactly the same as Provides: all versions or
Requires: any version.