@@ -452,15 +452,13 @@ sub setupboot_grub2 ($$$$) {
my @offsets = (0);
my $entry;
my $chainentry;
- my $submenu;
while (<$f>) {
next if m/^\s*\#/ || !m/\S/;
if (m/^\s*\}\s*$/) {
- die unless $entry || $submenu;
- if (!$entry && $submenu) {
- logm("Met end of a submenu $submenu->{StartLine}..$.. ".
+ die unless $entry || $#offsets;
+ if (!$entry && $#offsets) {
+ logm("Met end of a submenu at $. (@offsets) ".
"Our want kern is $want_kernver");
- $submenu= undef;
pop @offsets;
$offsets[$#offsets]++;
next;
@@ -510,7 +508,6 @@ sub setupboot_grub2 ($$$$) {
$offsets[$#offsets]++;
}
if (m/^\s*submenu\s+[\'\"](.*)[\'\"].*\{\s*$/) {
- $submenu={ StartLine =>$., MenuEntryPath => join ">", @offsets };
push @offsets,(0);
}
if (m/^\s*chainloader\s*\/EFI\/osstest\/xen.efi/) {
We really only used this to check how many levels deep in { we are. That can be done by checking $#offsets, which is >0 if we are in a submenu and not otherwise. We lose the ability to report the start line of the submenu, but that's OK. But as a bonus, we no longer bomb out on nested submenus: previously the first } would cause $submenu to be undef. Now we pop from @offsets and all is fine. Nested submenus are present in Debian buster. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> --- Osstest/Debian.pm | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)