Skip to contentSkip to conversation

pygrub: extlinux parsing correctness

PATCH In review Roger Pau Monne 2 participants 2 messages Feb 6, 2012 – Feb 7, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pygrub: extlinux parsing correctness

# HG changeset patch
# User Roger Pau Monne <[email protected]> # Date 1328539206 -3600
# Node ID 67d41a95b5a77b91b16acfe6f4540aa487b57f5d # Parent 9e2f11af4f13e24b1bc4daab2067417d1874f4a9
pygrub: extlinux parsing correctness

The "in" operator should be used instead of the find method, since we are only interested in knowing whether the line contains "initrd=", but we don't care about it's position. Also fixes an error that happens when initrd= it's at the start of the line, since find returns 0 and is evaluated as False.

tools/pygrub/src/ExtLinuxConf.py +1 -1
diff -r 9e2f11af4f13 -r 67d41a95b5a7 tools/pygrub/src/ExtLinuxConf.py
@@ -60,7 +60,7 @@ class ExtLinuxImage(object):
 
                 # Bypass regular self.commands handling
                 com = None
-            elif arg.find("initrd="):
+            elif "initrd=" in arg:
                 # find initrd image in append line
                 args = arg.strip().split(" ")
                 for a in args:
Acked-by on v1 1/1
#1 lore raw

Roger Pau Monne writes ("[Xen-devel] [PATCH] pygrub: extlinux parsing correctness"):

Quoted 9 lines

pygrub: extlinux parsing correctness

The "in" operator should be used instead of the find method, since we are only interested in knowing whether the line contains "initrd=", but we don't care about it's position. Also fixes an error that happens when initrd= it's at the start of the line, since find returns 0 and is evaluated as False.