From: Roger Pau Monne Subject: [PATCH] pygrub: extlinux parsing correctness Date: Mon, 06 Feb 2012 15:40:09 +0100 Message-ID: <67d41a95b5a77b91b16a.1328539209@debian.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org # HG changeset patch # User Roger Pau Monne # 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. Signed-off-by: Roger Pau Monne diff -r 9e2f11af4f13 -r 67d41a95b5a7 tools/pygrub/src/ExtLinuxConf.py --- a/tools/pygrub/src/ExtLinuxConf.py Mon Feb 06 12:29:59 2012 +0100 +++ b/tools/pygrub/src/ExtLinuxConf.py Mon Feb 06 15:40:06 2012 +0100 @@ -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: