Bug 189612

Summary: Run-time failure in packageSack.py
Product: [Fedora] Fedora Reporter: Michael Schwendt <bugs.michael>
Component: yumAssignee: Jeremy Katz <katzj>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 6CC: katzj, ville.skytta
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 3.0.6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-04-25 17:29:48 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:
Attachments:
Description Flags
patch against yum-2.6.0-1 packageSack.py
none
patch returnNewestByName to make it return a list none

Description Michael Schwendt 2006-04-21 16:28:33 UTC
Exchanging packageSack.returnNewestByNameArch() and
packageSack.returnNewestByName() does not work and raises
an uncaught exception.

The former returns a list, the latter a list of lists, which
leads to a run-time error inside the packageSack module:

  AttributeError: 'list' object has no attribute 'returnSimple'

The documentation doesn't say anything about that difference.
Full traceback below.

I believe the implementation of returnNewestByName() is wrong.
Patch attached, too. At least FC5 and FC4 are affected.

Traceback (most recent call last):
  File "./rc-modified", line 201, in ?
    main()
  File "./rc-modified", line 169, in main
    baddeps = my.getBrokenDeps(opts.newest)
  File "./rc-modified", line 96, in getBrokenDeps
    mypkgSack = ListPackageSack(pkgs)
  File "/usr/lib/python2.4/site-packages/repomd/packageSack.py", line 521, in __
init__
    self.addList(Objlist)
  File "/usr/lib/python2.4/site-packages/repomd/packageSack.py", line 525, in ad
dList
    self.addPackage(pkgobj)
  File "/usr/lib/python2.4/site-packages/repomd/packageSack.py", line 163, in ad
dPackage
    repoid = obj.returnSimple('repoid')
AttributeError: 'list' object has no attribute 'returnSimple'

Comment 1 Michael Schwendt 2006-04-21 16:28:33 UTC
Created attachment 128092 [details]
patch against yum-2.6.0-1 packageSack.py

Comment 2 Michael Schwendt 2006-04-21 16:35:11 UTC
At a second thought, probably returnNewestByName() is correct, so
it can return a list of multiple package with the same EVR but
different archs. In that case, the API documentation is incomplete,
and

     pkgs = pkgSack.returnNewestByName()
     mypkgSack = ListPackageSack(pkgs)

still gives a traceback.


Comment 3 Michael Schwendt 2006-04-21 17:56:51 UTC
Created attachment 128093 [details]
patch returnNewestByName to make it return a list

Comment 4 Jeremy Katz 2006-09-18 20:28:44 UTC
This has all been cleaned up and made consistent in yum 2.9.x

Comment 5 Michael Schwendt 2006-10-10 11:05:16 UTC
Still reproducible with yum-3.0-3.
Just call yumBase.pkgSack.returnNewestByName() with default argument,
and it creates a "list of lists of package objects" rather than a
"list of package objects":

  File "/usr/lib/python2.4/site-packages/yum/packageSack.py", line 298, in
returnNewestByName
    bestofeach.addList(self._computeAggregateListResult("returnNewestByName", name))
  File "/usr/lib/python2.4/site-packages/yum/packageSack.py", line 651, in addList
    self.addPackage(pkgobj)
  File "/usr/lib/python2.4/site-packages/yum/packageSack.py", line 475, in
addPackage
    repoid = obj.returnSimple('repoid')
AttributeError: 'list' object has no attribute 'returnSimple'


Comment 6 Seth Vidal 2006-10-11 13:22:52 UTC
grrr. This is the combination happening.

okay I know what's going on here. Thanks Michael.


Comment 7 Ville Skyttä 2006-12-27 22:51:23 UTC
*** Bug 220841 has been marked as a duplicate of this bug. ***

Comment 8 Jeremy Katz 2007-04-25 17:29:48 UTC
This looks fixed in 3.0.6/3.1.6 to me