clone 336343 -1 retitle -1 jack's argv passing gets stuck in while loop, uses 100% CPU tags -1 + patch thanks
* Michael Banck <[EMAIL PROTECTED]> [2005-10-29 17:51]: > Worse, if you use --unusable-chars "foo" --replacement-chars="bar", > the system hangs here, consuming 100% CPU. > Maybe a bug in python? No, it's a bug in jack. Basically what happens is that jack gets stuck looking for the next argument. It sees --unusuable-chars, requests the next and gets "foo"; then it's at "foo", requests the next and gets '--replacement-chars="bar"' back; then it is at '--replacement-chars="bar"', sees that it contains a =, and therefor splits the argument and returns bar (without going further); it is still at '--replacement-chars="bar"' and if it was a normal value, it would now return the next one, but again it notices that it contains a = and therefor splits the argument and returns bar... and there we are, stuck in a for while. Splitting arguments with = absolutely makes no sense in this case; however, get_next() is called from other functions and it might make sense to allow this under some circumstances. Therefore, I've added an option to get_next() saying whether = should be split or not, and not to split it in our case. Maybe there's a better solution but this one'll will definitely do for now. Arne, do you have a better one? Some debugging info: 984:[EMAIL PROTECTED]: ~] jack --unusable-chars "foo" --replacement-chars="bar" d This is jack 3.1.1 (C)2004 Arne Zellentin <[EMAIL PROTECTED]> 2 foo 3 --replacementxz-chars=bar 3 bar 3 bar And the patch: --- jack_argv.py~ 2005-11-01 19:22:23.000000000 +0000 +++ jack_argv.py 2005-11-01 19:25:27.000000000 +0000 @@ -61,10 +61,10 @@ else: print "These are the most commom options. For a complete list, run jack --longhelp" -def get_next(argv, i, extra_arg = None): +def get_next(argv, i, extra_arg = None, allow_equal = 1): if extra_arg != None: return i, extra_arg - elif argv[i].find("=") > 0: + elif allow_equal and argv[i].find("=") > 0: return i, argv[i].split("=", 1)[1] else: i = i + 1 @@ -118,7 +118,7 @@ l = [] if origin == "argv": while 1: - i, data = get_next(argv, i, alt_arg) + i, data = get_next(argv, i, alt_arg, 0) if data != None: if data == ";": break -- Martin Michlmayr http://www.cyrius.com/ -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]