Bug 507885 - package-cleanup crashes with infinite recursion
Summary: package-cleanup crashes with infinite recursion
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: yum
Version: 5.4
Hardware: All
OS: Linux
low
medium
Target Milestone: rc
: ---
Assignee: James Antill
QA Contact: BaseOS QE Security Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-06-24 15:58 UTC by James Antill
Modified: 2014-01-21 23:10 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Under certain, unusual circumstances, yum could encounter an infinite recursion while executing the package-cleanup --dupes command. Yum would crash and the recursion would eventually terminate with the error maximum recursion depth exceeded while calling a Python object. The code that populates the package sacks is now modified so that this recursion cannot take place, therefore avoiding the crash.
Clone Of: 507220
Environment:
Last Closed: 2009-09-02 07:34:30 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2009:1419 0 normal SHIPPED_LIVE yum bug fix update 2009-09-02 07:32:56 UTC

Description James Antill 2009-06-24 15:58:50 UTC
+++ This bug was initially created as a clone of Bug #507220 +++

Description of problem:
package-cleanup --dupes crashes 

Version-Release number of selected component (if applicable):
yum-3.2.23-6.fc12.noarch
yum-utils-1.1.22-1.fc12.noarch

How reproducible:
always

Steps to Reproduce:
1. Run: package-cleanup --dupes
  
Actual results:
Setting up yum
Traceback (most recent call last):
  File "/usr/bin/package-cleanup", line 498, in <module>
    main()
  File "/usr/bin/package-cleanup", line 459, in main
    my = initYum(opts)
  File "/usr/bin/package-cleanup", line 60, in initYum
    my.doTsSetup()
  File "/usr/lib/python2.6/site-packages/yum/depsolve.py", line 85, in doTsSetup
    return self._getTs()
  File "/usr/lib/python2.6/site-packages/yum/depsolve.py", line 100, in _getTs
    self._getTsInfo(remove_only)
  File "/usr/lib/python2.6/site-packages/yum/depsolve.py", line 111, in _getTsInfo
    pkgSack = self.pkgSack
  File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 666, in <lambda>
    pkgSack = property(fget=lambda self: self._getSacks(),
  File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 507, in _getSacks
    self.excludePackages()
  File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 1148, in excludePackages
    self.pkgSack.addPackageExcluder(repoid, 'exclude.match', match)
  File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 666, in <lambda>
    pkgSack = property(fget=lambda self: self._getSacks(),
  File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 507, in _getSacks
    self.excludePackages()
  File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 1148, in excludePackages

...this trio is repeated many times, until it ends with...:

  File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 1148, in excludePackages
    self.pkgSack.addPackageExcluder(repoid, 'exclude.match', match)
  File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 666, in <lambda>
    pkgSack = property(fget=lambda self: self._getSacks(),
  File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 486, in _getSacks
    if self._pkgSack and thisrepo is None:
  File "/usr/lib/python2.6/site-packages/yum/packageSack.py", line 336, in __len__
    for sack in sorted(self.sacks.values()):
RuntimeError: maximum recursion depth exceeded while calling a Python object


Expected results:
No traceback.

Additional info:
This bug is similar to bug 485578, but it happens without having the versionlock plugin installed and even with no plugins at all.

--- Additional comment from james.antill on 2009-06-22 01:26:48 EDT ---

This is fixed by:

http://yum.baseurl.org/gitweb?p=yum.git;a=commitdiff;h=5216a27d35d60e46f028b1fbba58acae5b9e79d2

--- Additional comment from mschmidt on 2009-06-22 02:46:53 EDT ---

I tested the patch. It fixes the bug. Thanks.

Comment 1 James Antill 2009-06-24 15:59:50 UTC
This is a somewhat minor bug, only happening in some weird edge cases ... but the fix is a trivial one liner. So it's ready to go for snap1 if I can get the flags.

Comment 8 Ruediger Landmann 2009-09-01 20:57:38 UTC
Release note added. If any revisions are required, please set the 
"requires_release_notes" flag to "?" and edit the "Release Notes" field accordingly.
All revisions will be proofread by the Engineering Content Services team.

New Contents:
Under certain, unusual circumstances, yum could encounter an infinite recursion while executing the package-cleanup --dupes command. Yum would crash and the recursion would eventually terminate with the error maximum recursion depth exceeded while calling a Python object. The code that populates the package sacks is now modified so that this recursion cannot take place, therefore avoiding the crash.

Comment 9 errata-xmlrpc 2009-09-02 07:34:30 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2009-1419.html


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