[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen stable-4.4] pygrub: Fix regression from c/s d1b93ea, attempt 2



commit bc0ce24c8f1ba7a80a575d2f6593cc12aaa31e0f
Author:     Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
AuthorDate: Tue Nov 25 11:11:50 2014 -0500
Commit:     Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
CommitDate: Fri Feb 27 15:16:32 2015 +0000

    pygrub: Fix regression from c/s d1b93ea, attempt 2
    
    c/s d1b93ea causes substantial functional regressions in pygrub's ability to
    parse bootloader configuration files.
    
    c/s d1b93ea itself changed an an interface which previously used exclusively
    integers, to using strings in the case of a grub configuration with explicit
    default set, along with changing the code calling the interface to require a
    string.  The default value for "default" remained as an integer.
    
    As a result, any Extlinux or Lilo configuration (which drives this interface
    exclusively with integers), or Grub configuration which doesn't explicitly
    declare a default will die with an AttributeError when attempting to call
    "self.cf.default.isdigit()" where "default" is an integer.
    
    Sadly, this AttributeError gets swallowed by the blanket ignore in the loop
    which searches partitions for valid bootloader configurations, causing the
    issue to be reported as "Unable to find partition containing kernel"
    
    We should explicitly check type of "default" in image_index() and process it
    appropriately.
    
    Reported-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Signed-off-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
    Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
    (cherry picked from commit 3b279811707dab4bab95c2e952e94ebf4d6badd9)
---
 tools/pygrub/src/pygrub |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/tools/pygrub/src/pygrub b/tools/pygrub/src/pygrub
old mode 100644
new mode 100755
index 8239499..c7b6aa7
--- a/tools/pygrub/src/pygrub
+++ b/tools/pygrub/src/pygrub
@@ -461,7 +461,9 @@ class Grub:
         self.cf.parse(buf)
 
     def image_index(self):
-        if self.cf.default.isdigit():
+        if isinstance(self.cf.default, int):
+            sel = self.cf.default
+        elif self.cf.default.isdigit():
             sel = int(self.cf.default)
         else:
             # We don't fully support submenus. Look for the leaf value in
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.4

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.