Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 131190 - catalyst-2.0_rc44 dies with RuntimeError with malformed spec file
Summary: catalyst-2.0_rc44 dies with RuntimeError with malformed spec file
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: Catalyst (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Catalyst Developers
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks:
 
Reported: 2006-04-24 23:52 UTC by Alvin Lee
Modified: 2006-05-01 12:57 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
slight change to parse_spec (cat2.patch,736 bytes, patch)
2006-04-25 07:12 UTC, Andrew Gaffney (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alvin Lee 2006-04-24 23:52:29 UTC
/usr/lib/catalyst2/modules/catalyst_support.py
588,589d587
<               elif len(cur_array) != 1:
<                       myspec[cur_array[0]] = cur_array[1:]
591,592c589,595
<                       print "\n\tWARNING: No value set for key: "+cur_array[0]
<                       print "\tdeleting key: "+cur_array[0]+"\n"
---
>                       myspec[cur_array[0]] = cur_array[1:]
>       for x in myspec:
>               # Delete empty key pair
>               if not myspec[x]:
>                       print "\n\tWARNING: No value set for key: "+x
>                       print "\tdeleting key: "+x+"\n"
>                       del myspec[x]

I did not find any erro in these codes,but I really can not build my target by these codes with no erro message. It's very strange that an exception occured in del myspec[x] phase. I do not know why , but after having changed these codes like above my catalyst can work well again. So I think it may be a bug only in some special environment and unfortunately I got it.
Comment 1 Andrew Gaffney (RETIRED) gentoo-dev 2006-04-25 05:15:01 UTC
Please use 'diff -au' to generate a patch.
Comment 2 Alvin Lee 2006-04-25 05:41:38 UTC
--- catalyst_support.py 2006-04-25 14:53:06.000000000 +0800
+++ catalyst_support.py.change  2006-04-25 14:55:33.000000000 +0800
@@ -585,14 +585,11 @@

                if len(cur_array) == 2:
                        myspec[cur_array[0]] = cur_array[1]
+               elif len(cur_array) != 1:
+                       myspec[cur_array[0]] = cur_array[1:]
                else:
-                       myspec[cur_array[0]] = cur_array[1:]
-       for x in myspec:
-               # Delete empty key pair
-               if not myspec[x]:
-                       print "\n\tWARNING: No value set for key: "+x
-                       print "\tdeleting key: "+x+"\n"
-                       del myspec[x]
+                       print "\n\tWARNING: No value set for key: "+cur_array[0]
+                       print "\tdeleting key: "+cur_array[0]+"\n"
        #print myspec
        return myspec
Comment 3 Andrew Gaffney (RETIRED) gentoo-dev 2006-04-25 07:10:26 UTC
Let me guess. You were getting a traceback with "RuntimeError: dictionary changed size during iteration". The only time this code should have caused a problem is if you have a malformed spec file, for example:

livecd/foo:
livecd/bar: a b c

I'm attaching a patch that should fix this properly.
Comment 4 Andrew Gaffney (RETIRED) gentoo-dev 2006-04-25 07:12:29 UTC
Created attachment 85459 [details, diff]
slight change to parse_spec

The original version used 'for x in myspec.keys()' but I changed it to 'for x in myspec', but it apparently used .keys() for a good reason. The former returns a list of keys. The latter creates an interator and goes over the keys. The iterator gets very unhappy when one of the keys it's currently dealing with disappears.
Comment 5 Alvin Lee 2006-04-25 08:05:36 UTC
yeah!Thank you for your comment which make me know what's wrong with these codes, I have just learned python for a shot time and I did not know the difference between "for x in myspec.keys()" and "for x in myspec". In fact these days I devote to using catalyst to produce my own livecd , so I have changed some codes of catalys and defined some new variables in spec file. These actions cause some problems which do not appear in common sense.
^^
Comment 6 Chris Gianelloni (RETIRED) gentoo-dev 2006-04-25 08:21:53 UTC
This patch has been added now.  Thanks, Andrew!
Comment 7 Chris Gianelloni (RETIRED) gentoo-dev 2006-05-01 12:57:52 UTC
Fixed in 2.0_rc45