pygrub: Fix regression from c/s d1b93ea, attempt 2
PATCH 1/1 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.
---
Commit message is Andrew's with exception of the last sentense.
I only tested this with grub2.
-boris
tools/pygrub/src/pygrub | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) mode change 100644 => 100755 tools/pygrub/src/pygrub
tools/pygrub/src/pygrub +3 -1
@@ -457,7 +457,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
Signature · 1 line
1.7.1
Quoted 17 lines · Boris Ostrovsky
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"
Quoted 5 lines
We should explicitly check type of "default" in
image_index()and process it appropriately.Reported-by Andrew Cooper <[email protected]>Signed-off-by Boris Ostrovsky <[email protected]>
In general I would prefer the first line of the commit message to be a short description of the actual functional change and not a reference to fixing some other commit, which is basically meaningless to anyone reading the log even now, nevermind in six months. I think I'm going to start picking up on this more frequently from now on.
CCing Konrad for RM input. I'm much less worried about corner cases etc wrt the freeze etc than I was with the larger fix proposed earlier.
Quoted 29 lines
---
Commit message is Andrew's with exception of the last sentense.
I only tested this with grub2.
(quoted diff) +0
-1-boris tools/pygrub/src/pygrub | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) mode change 100644 => 100755 tools/pygrub/src/pygrubtools/pygrub/src/pygrub +3
-1@@ -457,7 +457,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
Quoted 26 lines · Ian Campbell
Quoted 17 lines · Boris Ostrovsky
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"
Quoted 5 lines
We should explicitly check type of "default" in
image_index()and process it appropriately.Reported-by Andrew Cooper <[email protected]>Signed-off-by Boris Ostrovsky <[email protected]>Acked-by Ian Campbell <[email protected]>
Quoted 8 lines
In general I would prefer the first line of the commit message to be a short description of the actual functional change and not a reference to fixing some other commit, which is basically meaningless to anyone reading the log even now, nevermind in six months. I think I'm going to start picking up on this more frequently from now on.
CCing Konrad for RM input. I'm much less worried about corner cases etc wrt the freeze etc than I was with the larger fix proposed earlier.
I am bit lost. I thought Andrew NACKed this?
Quoted 32 lines
Quoted 30 lines
---
Commit message is Andrew's with exception of the last sentense.
I only tested this with grub2.
(quoted diff) +0
-1-boris tools/pygrub/src/pygrub | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) mode change 100644 => 100755 tools/pygrub/src/pygrubtools/pygrub/src/pygrub +3
-1@@ -457,7 +457,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
Quoted 32 lines · Konrad Rzeszutek Wilk
Quoted 31 lines · Ian Campbell
Quoted 17 lines · Boris Ostrovsky
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"
Quoted 5 lines
We should explicitly check type of "default" in
image_index()and process it appropriately.Reported-by Andrew Cooper <[email protected]>Signed-off-by Boris Ostrovsky <[email protected]>Acked-by Ian Campbell <[email protected]>In general I would prefer the first line of the commit message to be a short description of the actual functional change and not a reference to fixing some other commit, which is basically meaningless to anyone reading the log even now, nevermind in six months. I think I'm going to start picking up on this more frequently from now on.
Quoted 3 lines
Quoted 2 lines
CCing Konrad for RM input. I'm much less worried about corner cases etc wrt the freeze etc than I was with the larger fix proposed earlier.
I am bit lost. I thought Andrew NACKed this?
I didn't, as I am not in a position to. I have not tested the result, but believe it is sufficient to fix the exact error at hand. If the maintainers think it is the best solution then so be it, but I am still of the opinion that it is is still a hack upon a hack.
~Andrew
Quoted 33 lines · Andrew Cooper
Quoted 32 lines · Konrad Rzeszutek Wilk
Quoted 31 lines · Ian Campbell
Quoted 17 lines · Boris Ostrovsky
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"
Quoted 5 lines
We should explicitly check type of "default" in
image_index()and process it appropriately.Reported-by Andrew Cooper <[email protected]>Signed-off-by Boris Ostrovsky <[email protected]>Acked-by Ian Campbell <[email protected]>In general I would prefer the first line of the commit message to be a short description of the actual functional change and not a reference to fixing some other commit, which is basically meaningless to anyone reading the log even now, nevermind in six months. I think I'm going to start picking up on this more frequently from now on.
Quoted 8 lines
Quoted 3 lines
Quoted 2 lines
CCing Konrad for RM input. I'm much less worried about corner cases etc wrt the freeze etc than I was with the larger fix proposed earlier.
I am bit lost. I thought Andrew NACKed this?
I didn't, as I am not in a position to. I have not tested the result, but believe it is sufficient to fix the exact error at hand. If the maintainers think it is the best solution then so be it, but I am still of the opinion that it is is still a hack upon a hack.
At this point in a freeze I'm much happier with:
tools/pygrub/src/pygrub | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
than
tools/pygrub/src/ExtLinuxConf.py | 6 +++--- tools/pygrub/src/GrubConf.py | 7 ++----- tools/pygrub/src/LiloConf.py | 6 +++--- 3 files changed, 8 insertions(+), 11 deletions(-)
Plus Boris' patch is far easier to reason about in isolation in a dynamically/duck typed language.
Ian.
Quoted 43 lines · Ian Campbell
Quoted 33 lines · Andrew Cooper
Quoted 32 lines · Konrad Rzeszutek Wilk
Quoted 31 lines · Ian Campbell
Quoted 17 lines · Boris Ostrovsky
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"
Quoted 5 lines
We should explicitly check type of "default" in
image_index()and process it appropriately.Reported-by Andrew Cooper <[email protected]>Signed-off-by Boris Ostrovsky <[email protected]>Acked-by Ian Campbell <[email protected]>In general I would prefer the first line of the commit message to be a short description of the actual functional change and not a reference to fixing some other commit, which is basically meaningless to anyone reading the log even now, nevermind in six months. I think I'm going to start picking up on this more frequently from now on.
Quoted 8 lines
Quoted 3 lines
Quoted 2 lines
CCing Konrad for RM input. I'm much less worried about corner cases etc wrt the freeze etc than I was with the larger fix proposed earlier.
I am bit lost. I thought Andrew NACKed this?
I didn't, as I am not in a position to. I have not tested the result, but believe it is sufficient to fix the exact error at hand. If the maintainers think it is the best solution then so be it, but I am still of the opinion that it is is still a hack upon a hack.
Quoted 4 lines
At this point in a freeze I'm much happier with:
tools/pygrub/src/pygrub | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
The same here. This is now the season of handing out band-aids.
As such Release-Acked-by: Konrad Rzeszutek Wilk <[email protected]>
Quoted 12 lines
than
tools/pygrub/src/ExtLinuxConf.py | 6 +++--- tools/pygrub/src/GrubConf.py | 7 ++----- tools/pygrub/src/LiloConf.py | 6 +++--- 3 files changed, 8 insertions(+), 11 deletions(-)Plus Boris' patch is far easier to reason about in isolation in a dynamically/duck typed language.
Ian.
Ian Campbell
AppliedQuoted 8 lines · Konrad Rzeszutek Wilk
Quoted 4 lines
At this point in a freeze I'm much happier with:
tools/pygrub/src/pygrub | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)The same here. This is now the season of handing out band-aids.
As such Release-Acked-by: Konrad Rzeszutek Wilk <[email protected]>
Applied.
Quoted 17 lines
Quoted 7 lines
than
tools/pygrub/src/ExtLinuxConf.py | 6 +++--- tools/pygrub/src/GrubConf.py | 7 ++----- tools/pygrub/src/LiloConf.py | 6 +++--- 3 files changed, 8 insertions(+), 11 deletions(-)Quoted 5 lines
Plus Boris' patch is far easier to reason about in isolation in a dynamically/duck typed language.
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel