Bug 572314

Summary: yum dependency resolver picks older version of package
Product: Red Hat Enterprise Linux 5 Reporter: Trevin Beattie <tbeattie>
Component: yumAssignee: James Antill <james.antill>
Status: CLOSED NOTABUG QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: medium Docs Contact:
Priority: low    
Version: 5.3   
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-03-10 20:38:24 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 Trevin Beattie 2010-03-10 20:17:53 UTC
Description of problem:
I've created a package which requires jakarta-commons-codec.  I have also built a newer version of the jakarta-commons-codec package based on version 1.4.  Both of these packages are placed in a separate repository from the Red Hat distribution.

If I ask yum to install my package, it will want to install the older 1.3 version of jakarta-commons-codec from the Red Hat repository for dependencies.  However if I ask yum to install jakarta-commons-codec explicitly, it will install the newer 1.4 version from our own repository.

Version-Release number of selected component (if applicable):
yum-3.2.19-18.el5

How reproducible:
Every time, but I'm not sure whether it depends on the ordering of files in the respective repositories, or whether it depends on the arch of the packages.

Steps to Reproduce:
0. jakarta-commons-codec must not already be installed
1. Build jakarta-commons-codec-1.4-1.noarch.rpm
2. Build a package that requires jakarta-commons-codec (call it test-package)
3. Place both packages in a yum repository separate from the Red Hat distribution
4. Run "yum -v install test-package"
  
Actual results:
This appears in the debug output:

test-package-1.0-1.noarch requires: jakarta-commons-codec
--> Processing Dependency: jakarta-commons-codec for package: test-package
Searching pkgSack for dep: jakarta-commons-codec
Potential match for jakarta-commons-codec from jakarta-commons-codec-1.3-7jpp.2.i386
Matched jakarta-commons-codec-1.3-7jpp.2.i386 to require for jakarta-commons-codec
Potential match for jakarta-commons-codec from jakarta-commons-codec-1.4-1.noarch
Matched jakarta-commons-codec-1.4-1.noarch to require for jakarta-commons-codec
TSINFO: Marking jakarta-commons-codec-1.3-7jpp.2.i386 as install for test-package-1.0-1.noarch


Expected results:
test-package-1.0-1.noarch requires: jakarta-commons-codec
--> Processing Dependency: jakarta-commons-codec for package: test-package
Searching pkgSack for dep: jakarta-commons-codec
Potential match for jakarta-commons-codec from jakarta-commons-codec-1.3-7jpp.2.i386
Matched jakarta-commons-codec-1.3-7jpp.2.i386 to require for jakarta-commons-codec
Potential match for jakarta-commons-codec from jakarta-commons-codec-1.4-1.noarch
Matched jakarta-commons-codec-1.4-1.noarch to require for jakarta-commons-codec
TSINFO: Marking jakarta-commons-codec-1.4-1.noarch as install for test-package-1.0-1.noarch


Additional info:
This sounds like another use case of bug #452739 which was missed.

The bug was reported last year on rpmforge.net:
http://lists.rpmforge.net/pipermail/users/2009-April/002288.html

Comment 1 James Antill 2010-03-10 20:38:24 UTC
this is due to the i386 => noarch change. yum prefers native packages.

The recommended way to work around this is to have:

Obsoletes: jakarta-commons-codec < 1.4

...in the newer noarch package.

Comment 2 Trevin Beattie 2010-03-10 20:44:14 UTC
Is there a way to configure yum to prefer newer packages over native packages?

Comment 3 Trevin Beattie 2010-03-10 20:47:59 UTC
and did you notice this entry in RHBA-2009:0176-3?

* Given a choice between an arch-specific package and a newer, "noarch"
version, yum will now install the newer version. In previous releases, yum
preferred arch-specific packages over newer, "noarch" versions when
choosing which one to install.

Comment 4 James Antill 2010-03-10 22:10:24 UTC
The wording is slightly off, what was changed was the behaviour of "yum install jakarta-commons-codec".

The behaviour for packages pulled in by requires is more complicated, and I don't believe operates the way you want in even the candidate for RHEL-6. Feel free to open an RFE for RHEL-6 though ... but, again, the easiest thing to do is probably add the obsoletes.