Bug 133051 - Yum dies at "yum update" with "TypeError: iteration over non-sequence"
Yum dies at "yum update" with "TypeError: iteration over non-sequence"
Status: CLOSED UPSTREAM
Product: Fedora
Classification: Fedora
Component: yum (Show other bugs)
rawhide
All Linux
medium Severity high
: ---
: ---
Assigned To: Jeremy Katz
:
Depends On:
Blocks: FC3Blocker
  Show dependency treegraph
 
Reported: 2004-09-21 02:26 EDT by Robert Scheck
Modified: 2014-01-21 17:49 EST (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-09-23 13:31:04 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Robert Scheck 2004-09-21 02:26:50 EDT
Description of problem:
--- snipp ---
[root@devel root]# yum update
Setting up Update Process
Setting up Repo:  base
repomd.xml                100% |=========================|  903 B    00:00
Reading repository metadata in from local files
primary.xml.gz            100% |=========================| 251 kB    00:00
base      : ################################################## 804/804
Excluding Packages
Excluding Incompatible Archs
Finished
Excluding Packages from Development (i386/base)
Resolving Dependencies
Traceback (most recent call last):
  File "/usr/share/yum-cli/yummain.py", line 139, in ?
    main(sys.argv[1:])
  File "/usr/share/yum-cli/yummain.py", line 94, in main
    (result, resultmsgs) = base.buildTransaction()
  File "__init__.py", line 131, in buildTransaction
  File "depsolve.py", line 151, in resolveDeps
  File "depsolve.py", line 97, in populateTs
TypeError: iteration over non-sequence
[root@devel root]# 
--- snapp ---

Version-Release number of selected component (if applicable):
yum-2.1.3-1

How reproducible:
Everytime, see below.

Steps to Reproduce:
1. "yum update"
2. Get the error.
  
Actual results:
Yum isn't working.

Expected results:
Yum should work.
Comment 1 Seth Vidal 2004-09-21 02:30:05 EDT
Yes, this is currently being addressed on the yum-devel mailing list.
We're all having a little trouble figuring out how this could occur
unless the ts is not being created at all, which seems a bit unlikely.

Comment 2 Seth Vidal 2004-09-21 02:32:04 EDT
if you can recreate it  - add:

print dir(self.ts)
as the first line of the populateTs function in
/usr/lib/python-2.3/site-packages/yum/depsolve.py

and send me the output.

thanks
Comment 3 Robert Scheck 2004-09-21 02:59:12 EDT
Okay, here's the new output - with this print:

--- snipp ---
[root@devel root]# yum update 
Setting up Update Process 
Setting up Repo:  base 
repomd.xml                100% |=========================|  903 B    00:00 
Reading repository metadata in from local files 
base      : ################################################## 804/804 
Excluding Packages 
Excluding Incompatible Archs 
Finished 
Excluding Packages from Development (i386/base) 
Resolving Dependencies 
['__doc__', '__getattr__', '__init__', '__module__', '_methods', 'getMethod', 'popVSFlags', 'pushVSFlags', 'returnLeafNodes', 'test', 'ts', 'tsflags'] 
Traceback (most recent call last): 
  File "/usr/share/yum-cli/yummain.py", line 139, in ? 
    main(sys.argv[1:]) 
  File "/usr/share/yum-cli/yummain.py", line 94, in main 
    (result, resultmsgs) = base.buildTransaction() 
  File "__init__.py", line 131, in buildTransaction 
  File "/usr/lib/python2.3/site-packages/yum/depsolve.py", line 152, in resolveDeps 
    self.populateTs(test=1) 
  File "/usr/lib/python2.3/site-packages/yum/depsolve.py", line 98, in populateTs 
    for te in self.ts: 
TypeError: iteration over non-sequence 
[root@devel root]#
--- snapp ---
Comment 4 Seth Vidal 2004-09-21 03:01:35 EDT
well ain't that just a pain in the arse.

okay.

Thanks
Comment 5 Paul Nasrat 2004-09-21 03:15:24 EDT
Can you modify the print statement to be:

print "self.ts: %s %s self.ts.ts: %s %s" % ( type(self.ts),
dir(self.ts), type(self.ts.ts), dir(self.ts.ts)"

And paste that output here please.

Thanks
Comment 6 Robert Scheck 2004-09-21 03:32:13 EDT
Yes, I did this, here is the result:

--- snipp ---
[root@devel root]# yum update 
Setting up Update Process 
Setting up Repo:  base 
repomd.xml                100% |=========================|  903 B    00:00 
Reading repository metadata in from local files 
base      : ################################################## 804/804 
Excluding Packages 
Excluding Incompatible Archs 
Finished 
Excluding Packages from Development (i386/base)
Resolving Dependencies 
self.ts: <type 'instance'> ['__doc__', '__getattr__', '__init__', 
'__module__', '_methods', 'getMethod', 'popVSFlags', 'pushVSFlags', 
'returnLeafNodes', 'test', 'ts', 'tsflags'] self.ts.ts: <type 
'rpm.ts'> ['Debug', 'IDTXglob', 'IDTXload', 'addErase', 'addInstall', 
'check', 'clean', 'closeDB', 'dbMatch', 'getKeys', 'hdrCheck', 
'hdrFromFdno', 'initDB', 'next', 'openDB', 'order', 
'pgpImportPubkey', 'pgpPrtPkts', 'rebuildDB', 'rollback', 'run', 
'setColor', 'setFlags', 'setProbFilter', 'setVSFlags', 'verifyDB'] 
Traceback (most recent call last): 
  File "/usr/share/yum-cli/yummain.py", line 139, in ? 
    main(sys.argv[1:]) 
  File "/usr/share/yum-cli/yummain.py", line 94, in main 
    (result, resultmsgs) = base.buildTransaction() 
  File "__init__.py", line 131, in buildTransaction 
  File "/usr/lib/python2.3/site-packages/yum/depsolve.py", line 152, in resolveDeps 
    self.populateTs(test=1) 
  File "/usr/lib/python2.3/site-packages/yum/depsolve.py", line 98, in populateTs 
    for te in self.ts: 
TypeError: iteration over non-sequence 
[root@devel root]# 
--- snapp ---

Prod me, if you need further information and tests.
Comment 7 Paul Nasrat 2004-09-21 08:45:04 EDT
looks like we should be iterating over self.ts.ts or maybe
TransactionWrapper should implement __iter__().
Comment 8 Robert Scheck 2004-09-21 08:52:30 EDT
Here's the result for your suggested change:

--- snipp ---
[root@devel root]# yum update 
Setting up Update Process 
Setting up Repo:  base 
repomd.xml                100% |=========================|  903 B    00:00 
Reading repository metadata in from local files 
base      : ################################################## 804/804 
Excluding Packages 
Excluding Incompatible Archs 
Finished 
Excluding Packages from Development (i386/base)
Resolving Dependencies 
self.ts: <type 'instance'> ['__doc__', '__getattr__', '__init__', 
'__module__', '_methods', 'getMethod', 'popVSFlags', 'pushVSFlags', 
'returnLeafNodes', 'test', 'ts', 'tsflags'] self.ts.ts: <type 
'rpm.ts'> ['Debug', 'IDTXglob', 'IDTXload', 'addErase', 'addInstall', 
'check', 'clean', 'closeDB', 'dbMatch', 'getKeys', 'hdrCheck', 
'hdrFromFdno', 'initDB', 'next', 'openDB', 'order', 
'pgpImportPubkey', 'pgpPrtPkts', 'rebuildDB', 'rollback', 'run', 
'setColor', 'setFlags', 'setProbFilter', 'setVSFlags', 'verifyDB'] 
ncurses-5.4-13.i386.rpm   100% |=========================| 273 kB    00:00 
modutils-2.4.27-2.i386.rp 100% |=========================|  19 kB    00:00 
libxslt-python-1.1.10-1.i 100% |=========================| 5.0 kB    00:00 
libxslt-devel-1.1.10-1.i3 100% |=========================| 7.6 kB    00:00 
procps-3.2.3-3.i386.rpm   100% |=========================|  15 kB    00:00 
Traceback (most recent call last): 
  File "/usr/share/yum-cli/yummain.py", line 139, in ? 
    main(sys.argv[1:]) 
  File "/usr/share/yum-cli/yummain.py", line 94, in main 
    (result, resultmsgs) = base.buildTransaction() 
  File "__init__.py", line 131, in buildTransaction 
  File "/usr/lib/python2.3/site-packages/yum/depsolve.py", line 152, in resolveDeps 
    self.populateTs(test=1) 
  File "/usr/lib/python2.3/site-packages/yum/depsolve.py", line 116, in populateTs 
    hdr = po.getHeader() 
  File "packages.py", line 272, in getHeader 
IndexError: list index out of range 
[root@devel root]#
--- snapp ---

Does this help you?
Comment 9 Seth Vidal 2004-09-21 09:23:19 EDT
the wrapper passes any methods it doesn't define on to the self.ts.ts
attribute.

so iterating over self.ts just like self.ts.ts should be quite safe.

I could add __iter__() that handed back self.ts as the iterable object
but it doesn't seem necessary
Comment 10 Seth Vidal 2004-09-22 16:55:54 EDT
I'll add in the __iter__() method to the self.ts instance handing back
self.ts.ts as the iterator. 

Robert, if you can check out cvs after I do that I'd be interested in
the result.

My main confusion is why this is only happening on 2 systems and not
on EVERY system.

afaict, either the ts object is an iterator or it's not.

one more question - there's no chance that  any other yum process or
rpmdb-locking process is existent, is there?
Comment 11 Michael Jennings (KainX) 2004-09-22 17:00:13 EDT
Not on my system, no.  It's running in a qemu instance with nothing
else running.  Very minimal install.
Comment 12 Robert Scheck 2004-09-23 02:50:50 EDT
Seth, I've got no further rpm and/or yum processes running:

[root@devel root]# ps aux | grep rpm 
root      7728  0.0  0.2  3972  696 pts/2    S+   08:46   0:00 grep rpm 
[root@devel root]# ps aux | grep yum 
root      7732  0.0  0.2  3976  688 pts/2    R+   08:47   0:00 grep yum 
[root@devel root]# 
Comment 13 Seth Vidal 2004-09-23 04:26:52 EDT
If you could check out yum-HEAD from cvs now and try it.

I defined an __iter__ method for the transaction wrapper class.
Comment 14 Robert Scheck 2004-09-23 05:21:43 EDT
I did the yum cvs checkout and it works for me now, but I'll keep open
this bug report until I get also an "OK" from Michael, who had also 
the same problem (I think).
Comment 15 Michael Jennings (KainX) 2004-09-23 13:29:47 EDT
This problem is definitely fixed.  Thanks for the quick turn-around Seth.
Comment 16 Seth Vidal 2004-09-23 13:31:04 EDT
fixed in upstream cvs

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