Skip to contentSkip to conversation

56922: regressions - FAIL

osstest test Ian Campbell 2 participants 19 messages May 22, 2015 – May 25, 2015 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

Hi Robert and Longtao,

Quoted 4 lines · osstest service user

flight 56922 osstest real [real]
http://logs.test-lab.xenproject.org/osstest/logs/56922/

Regressions :-(

This flight was testing:

477a9aa grub: remove patch to disable submenu from 20_linux_xen overla cc0a60a Move the code for setting memory size into prep() 3d1ff6d Edit some APIs in TestSupport.pm for nested test 46bba78 Refactor installation of overlays
3cc3ef3 Changes to support '/boot' leading paths of kernel, xen, in gr 9419ffe Parsing grub which has 'submenu' primitive

Looking at
http://logs.test-lab.xenproject.org/osstest/logs/56922/test-amd64-amd64-xl-xsm/info.html
and the serial log at
http://logs.test-lab.xenproject.org/osstest/logs/56922/test-amd64-amd64-xl-xsm/serial-italia1.log

It seems it has picked the wrong entry to boot. It has picked entry 21 which seems to be 'Debian GNU/Linux, with Xen 4.6-unstable and Linux 3.14.43+' whereas I think it ought to have picked entry 22 which is 'Debian GNU/Linux, with Xen 4.6-unstable (XSM enabled) and Linux 3.14.43 +'

I think the problem is most likely in the new code which copes with the submenu primitive.

Ian.

Quoted 126 lines

Tests which did not succeed and are blocking,
including tests which could not be run:
test-amd64-amd64-xl-qemuu-debianhvm-amd64-xsm 6 xen-boot fail REGR. vs. 56857

 test-amd64-i386-xl-xsm        6 xen-boot                  fail REGR. vs. 56857
 test-amd64-i386-xl-qemuu-debianhvm-amd64-xsm  6 xen-boot  fail REGR. vs. 56857
 test-amd64-amd64-xl-xsm       6 xen-boot                  fail REGR. vs. 56857
 test-amd64-amd64-xl-qemut-debianhvm-amd64-xsm  6 xen-boot fail REGR. vs. 56857
 test-amd64-i386-xl-qemut-debianhvm-amd64-xsm  6 xen-boot  fail REGR. vs. 56857
 test-amd64-i386-freebsd10-amd64 14 guest-saverestore.2    fail REGR. vs. 56857
 test-armhf-armhf-xl-multivcpu  6 xen-boot                 fail REGR. vs. 56857

Regressions which are regarded as allowable (not blocking):

 test-amd64-i386-libvirt-xsm   6 xen-boot                  fail REGR. vs. 56857
 test-amd64-amd64-libvirt-xsm  6 xen-boot                  fail REGR. vs. 56857
 test-armhf-armhf-libvirt     11 guest-start               fail REGR. vs. 56857
 test-armhf-armhf-xl-xsm      11 guest-start              fail blocked in 56857
 test-amd64-amd64-rumpuserxen-amd64 15 rumpuserxen-demo-xenstorels/xenstorels.repeat fail like 56857
 test-amd64-i386-libvirt      11 guest-start                  fail   like 56857
 test-amd64-i386-xl-qemuu-win7-amd64 16 guest-stop              fail like 56857
 test-amd64-amd64-xl-qemut-win7-amd64 16 guest-stop             fail like 56857
 test-amd64-amd64-xl-qemuu-win7-amd64 16 guest-stop             fail like 56857
 test-amd64-i386-xl-qemut-win7-amd64 16 guest-stop              fail like 56857

test-amd64-amd64-libvirt 11 guest-start fail like 56857

Tests which did not succeed, but are not blocking:

 test-amd64-amd64-xl-pvh-amd  11 guest-start                  fail   never pass
 test-amd64-amd64-xl-pvh-intel 11 guest-start                  fail  never pass
 test-armhf-armhf-libvirt-xsm 11 guest-start                  fail   never pass
 test-armhf-armhf-xl-sedf     12 migrate-support-check        fail   never pass
 test-armhf-armhf-xl-cubietruck 12 migrate-support-check        fail never pass
 test-armhf-armhf-xl-sedf-pin 12 migrate-support-check        fail   never pass
 test-armhf-armhf-xl          12 migrate-support-check        fail   never pass
 test-armhf-armhf-xl-arndale  12 migrate-support-check        fail   never pass
 test-armhf-armhf-xl-credit2  12 migrate-support-check        fail   never pass

version targeted for testing:
osstest 477a9aa4fa8ff5eb3b0a2e286585665007bb9795
baseline version:
osstest ecf4cb76b15396c85fed5a2eb0a6a60e381225c5

jobs:

 build-amd64-xsm                                              pass    
 build-armhf-xsm                                              pass    
 build-i386-xsm                                               pass    
 build-amd64                                                  pass    
 build-armhf                                                  pass    
 build-i386                                                   pass    
 build-amd64-libvirt                                          pass    
 build-armhf-libvirt                                          pass    
 build-i386-libvirt                                           pass    
 build-amd64-pvops                                            pass    
 build-armhf-pvops                                            pass    
 build-i386-pvops                                             pass    
 build-amd64-rumpuserxen                                      pass    
 build-i386-rumpuserxen                                       pass    
 test-amd64-amd64-xl                                          pass    
 test-armhf-armhf-xl                                          pass    
 test-amd64-i386-xl                                           pass    
 test-amd64-amd64-xl-qemut-debianhvm-amd64-xsm                fail    
 test-amd64-i386-xl-qemut-debianhvm-amd64-xsm                 fail    
 test-amd64-amd64-xl-qemuu-debianhvm-amd64-xsm                fail    
 test-amd64-i386-xl-qemuu-debianhvm-amd64-xsm                 fail    
 test-amd64-amd64-libvirt-xsm                                 fail    
 test-armhf-armhf-libvirt-xsm                                 fail    
 test-amd64-i386-libvirt-xsm                                  fail    
 test-amd64-amd64-xl-xsm                                      fail    
 test-armhf-armhf-xl-xsm                                      fail    
 test-amd64-i386-xl-xsm                                       fail    
 test-amd64-amd64-xl-pvh-amd                                  fail    
 test-amd64-i386-qemut-rhel6hvm-amd                           pass    
 test-amd64-i386-qemuu-rhel6hvm-amd                           pass    
 test-amd64-amd64-xl-qemut-debianhvm-amd64                    pass    
 test-amd64-i386-xl-qemut-debianhvm-amd64                     pass    
 test-amd64-amd64-xl-qemuu-debianhvm-amd64                    pass    
 test-amd64-i386-xl-qemuu-debianhvm-amd64                     pass    
 test-amd64-i386-freebsd10-amd64                              fail    
 test-amd64-amd64-xl-qemuu-ovmf-amd64                         pass    
 test-amd64-i386-xl-qemuu-ovmf-amd64                          pass    
 test-amd64-amd64-rumpuserxen-amd64                           fail    
 test-amd64-amd64-xl-qemut-win7-amd64                         fail    
 test-amd64-i386-xl-qemut-win7-amd64                          fail    
 test-amd64-amd64-xl-qemuu-win7-amd64                         fail    
 test-amd64-i386-xl-qemuu-win7-amd64                          fail    
 test-armhf-armhf-xl-arndale                                  pass    
 test-amd64-amd64-xl-credit2                                  pass    
 test-armhf-armhf-xl-credit2                                  pass    
 test-armhf-armhf-xl-cubietruck                               pass    
 test-amd64-i386-freebsd10-i386                               pass    
 test-amd64-i386-rumpuserxen-i386                             pass    
 test-amd64-amd64-xl-pvh-intel                                fail    
 test-amd64-i386-qemut-rhel6hvm-intel                         pass    
 test-amd64-i386-qemuu-rhel6hvm-intel                         pass    
 test-amd64-amd64-libvirt                                     fail    
 test-armhf-armhf-libvirt                                     fail    
 test-amd64-i386-libvirt                                      fail    
 test-amd64-amd64-xl-multivcpu                                pass    
 test-armhf-armhf-xl-multivcpu                                fail    
 test-amd64-amd64-pair                                        pass    
 test-amd64-i386-pair                                         pass    
 test-amd64-amd64-xl-sedf-pin                                 pass    
 test-armhf-armhf-xl-sedf-pin                                 pass    
 test-amd64-amd64-xl-sedf                                     pass    
 test-armhf-armhf-xl-sedf                                     pass    
 test-amd64-i386-xl-qemut-winxpsp3-vcpus1                     pass    
 test-amd64-i386-xl-qemuu-winxpsp3-vcpus1                     pass    
 test-amd64-amd64-xl-qemut-winxpsp3                           pass    
 test-amd64-i386-xl-qemut-winxpsp3                            pass    
 test-amd64-amd64-xl-qemuu-winxpsp3                           pass    
 test-amd64-i386-xl-qemuu-winxpsp3                            pass    

------------------------------------------------------------
sg-report-flight on osstest.test-lab.xenproject.org
logs: /home/logs/logs
images: /home/logs/images

Logs, config files, etc. are available at
http://logs.test-lab.xenproject.org/osstest/logs

Test harness code can be found at
http://xenbits.xen.org/gitweb?p=osstest.git;a=summary

Not pushing.

#2 lore raw
Quoted 22 lines · Ian Campbell

Hi Robert and Longtao,

Quoted 4 lines · osstest service user

flight 56922 osstest real [real]
http://logs.test-lab.xenproject.org/osstest/logs/56922/

Regressions :-(

This flight was testing:

477a9aa grub: remove patch to disable submenu from 20_linux_xen overla cc0a60a Move the code for setting memory size into prep() 3d1ff6d Edit some APIs in TestSupport.pm for nested test 46bba78 Refactor installation of overlays
3cc3ef3 Changes to support '/boot' leading paths of kernel, xen, in gr 9419ffe Parsing grub which has 'submenu' primitive

Looking at
http://logs.test-lab.xenproject.org/osstest/logs/56922/test-amd64-amd64-xl-xsm/info.html
and the serial log at
http://logs.test-lab.xenproject.org/osstest/logs/56922/test-amd64-amd64-xl-xsm/serial-italia1.log

Quoted 8 lines

It seems it has picked the wrong entry to boot. It has picked entry 21 which seems to be 'Debian GNU/Linux, with Xen 4.6-unstable and Linux 3.14.43+' whereas I think it ought to have picked entry 22 which is 'Debian GNU/Linux, with Xen 4.6-unstable (XSM enabled) and Linux 3.14.43 +'

I think the problem is most likely in the new code which copes with the submenu primitive.

I think grub2 considers submenu entries to be entries, and therefore when determining which entry to use we should include those in the offset.

I think you didn't see this in your testing because without XSM the entry we want is the first item in the first submenu, so there is an off by one in the entry we ask for, which turns out to correspond to the first submenu itself, and then the grub timeout means that it then selects the first entry in that submenu, so it works.

I'm currently testing the patch below, if it works then I intend to fold it into "Parsing grub which has 'submenu' primitive" and will re-push the result.

Ian.

Osstest/Debian.pm +1 -0
index 282175b..0b731c3 100644
@@ -451,6 +451,7 @@ sub setupboot_grub2 ($$$$) {
             }
             if (m/^submenu\s+[\'\"](.*)[\'\"].*\{\s*$/) {
                 $submenu={ StartLine =>$.};
+                $count++;
             }
             if (m/^\s*multiboot\s*(?:\/boot)?\/(xen\S+)/) {
                 die unless $entry;
#3 lore raw
Quoted 3 lines · Ian Campbell

I'm currently testing the patch below, if it works then I intend to fold it into "Parsing grub which has 'submenu' primitive" and will re-push the result.

It didn't seem to work. I'm trying to repro on a machine I can recover more easily, but perhaps you could also take a look?

Quoted 21 lines

Ian.

Osstest/Debian.pm +1 -0
index 282175b..0b731c3 100644
@@ -451,6 +451,7 @@ sub setupboot_grub2 ($$$$) {
             }
             if (m/^submenu\s+[\'\"](.*)[\'\"].*\{\s*$/) {
                 $submenu={ StartLine =>$.};
+                $count++;
             }
             if (m/^\s*multiboot\s*(?:\/boot)?\/(xen\S+)/) {
                 die unless $entry;

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#4 lore raw
Quoted 7 lines · Ian Campbell
Quoted 3 lines · Ian Campbell

I'm currently testing the patch below, if it works then I intend to fold it into "Parsing grub which has 'submenu' primitive" and will re-push the result.

It didn't seem to work. I'm trying to repro on a machine I can recover more easily, but perhaps you could also take a look?

Yeah. Thanks Ian.
I'm to look into it this weekend.

Quoted 24 lines
Quoted 22 lines

Ian.

Osstest/Debian.pm +1 -0
index 282175b..0b731c3 100644
@@ -451,6 +451,7 @@ sub setupboot_grub2 ($$$$) {
             }
             if (m/^submenu\s+[\'\"](.*)[\'\"].*\{\s*$/) {
                 $submenu={ StartLine =>$.};
+                $count++;
             }
             if (m/^\s*multiboot\s*(?:\/boot)?\/(xen\S+)/) {
                 die unless $entry;

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#5 lore raw
Quoted 6 lines · Robert Hu
Quoted 5 lines · Ian Campbell
Quoted 3 lines · Ian Campbell

I'm currently testing the patch below, if it works then I intend to fold it into "Parsing grub which has 'submenu' primitive" and will re-push the result.

Quoted 6 lines
Quoted 2 lines

It didn't seem to work. I'm trying to repro on a machine I can recover more easily, but perhaps you could also take a look?

Yeah. Thanks Ian.
I'm to look into it this weekend.

From https://help.ubuntu.com/community/Grub2/Submenus it seems like

perhaps the syntax is "N>M" where N is the submenu and M is the offset within that submenu.

I've not confirmed this though.

Ian.

#6 lore raw
Quoted 9 lines · Ian Campbell
Quoted 8 lines · Robert Hu
Quoted 7 lines · Ian Campbell
Quoted 3 lines · Ian Campbell

I'm currently testing the patch below, if it works then I intend to fold it into "Parsing grub which has 'submenu' primitive" and will re-push the result.

It didn't seem to work. I'm trying to repro on a machine I can recover more easily, but perhaps you could also take a look?

Quoted 8 lines
Quoted 2 lines

Yeah. Thanks Ian.
I'm to look into it this weekend.

From https://help.ubuntu.com/community/Grub2/Submenus it seems like perhaps the syntax is "N>M" where N is the submenu and M is the offset within that submenu.

I've not confirmed this though.

I have now, 8>1 correctly booted: submenu "Xen 4.6-unstable" {
menuentry 'Debian GNU/Linux, with Xen 4.6-unstable and Linux 3.14.36+' --class debian --class gnu-linux --class gnu --class os --class xen {

Quoted 1 line

From my particular grub.cfg. For real usage setupboot_grub2 will

obviously need to become cleverer to count things correctly.

BTW, I just noticed that the comment about setupboot_grub2 is still in place:
# Note on running OSSTest on Squeeze with old Xen kernel: check out # Debian bug #633127 "/etc/grub/20_linux does not recognise some old # Xen kernels"
# Currently setupboot_grub2 relies on Grub menu not having submenu. # Check Debian bug #690538.
sub setupboot_grub2 ($$$$) {

The last bit is no longer true with the patch, so it should be removed...

I've dropped the following from pretest for now:

Parsing grub which has 'submenu' primitive
Changes to support '/boot' leading paths of kernel, xen, in grub
grub: remove patch to disable submenu from 20_linux_xen overlay

(the /boot one had contextual dependencies on the prior patch).

In pretest now is just:

Refactor installation of overlays
Edit some APIs in TestSupport.pm for nested test Move the code for setting memory size into prep()

I've pushed that to a new branch nestedhvm-v10-pretest-reduced in my xenbits repo too so you can base future resends on that.

Ian.

#7 lore raw
Quoted 2 lines · Ian Campbell

From my particular grub.cfg. For real usage setupboot_grub2 will obviously need to become cleverer to count things correctly.

I've not tested extensively but the following incremental patch seems to do the right thing, at least by inspection of the resulting grub.cfg.

Needs more testing (e.g. I haven't tried non-XSM yet) and review from Ian I think, since there may be a more idiomatically Perl way to manipulate the @offsets array (in particular shrinking it).

Ian.

Osstest/Debian.pm +8 -7
index 282175b..b5148fd 100644
@@ -393,8 +393,6 @@ sub setupboot_grub1 ($$$$) {
 # Note on running OSSTest on Squeeze with old Xen kernel: check out
 # Debian bug #633127 "/etc/grub/20_linux does not recognise some old
 # Xen kernels"
-# Currently setupboot_grub2 relies on Grub menu not having submenu.
-# Check Debian bug #690538.
 sub setupboot_grub2 ($$$$) {
     my ($ho,$want_kernver,$want_xsm,$xenhopt,$xenkopt) = @_;
     my $bl= { };
@@ -405,7 +403,7 @@ sub setupboot_grub2 ($$$$) {
     my $parsemenu= sub {
         my $f= bl_getmenu_open($ho, $rmenu, "$stash/$ho->{Name}--grub.cfg.1");
     
-        my $count= 0;
+        my @offsets = (0);
         my $entry;
         my $submenu;
         while (<$f>) {
@@ -417,6 +415,8 @@ sub setupboot_grub2 ($$$$) {
                         "$submenu->{StartLine}. ".
                         "Our want kern is $want_kernver");
                     $submenu=undef;
+                    $#offsets = $#offsets-1;
+                    $offsets[$#offsets]++;
                     next;
                 }
                 my (@missing) =
@@ -446,11 +446,12 @@ sub setupboot_grub2 ($$$$) {
             }
             if (m/^menuentry\s+[\'\"](.*)[\'\"].*\{\s*$/) {
                 die $entry->{StartLine} if $entry;
-                $entry= { Title => $1, StartLine => $., Number => $count };
-                $count++;
+                $entry= { Title => $1, StartLine => $., MenuEntryPath => join ">", @offsets };
+                $offsets[$#offsets]++;
             }
             if (m/^submenu\s+[\'\"](.*)[\'\"].*\{\s*$/) {
-                $submenu={ StartLine =>$.};
+                $submenu={ StartLine =>$., MenuEntryPath => join ">", @offsets };
+                $offsets[$#offsets+1] = 0;
             }
             if (m/^\s*multiboot\s*(?:\/boot)?\/(xen\S+)/) {
                 die unless $entry;
@@ -511,7 +512,7 @@ sub setupboot_grub2 ($$$$) {
             }
             print ::EO <<END or die $!;
 
-GRUB_DEFAULT=$entry->{Number}
+GRUB_DEFAULT="$entry->{MenuEntryPath}"
 END
 
             print ::EO <<END or die $! if defined $xenhopt;
#8 lore raw
Quoted 10 lines · Ian Campbell
Quoted 2 lines · Ian Campbell

From my particular grub.cfg. For real usage setupboot_grub2 will obviously need to become cleverer to count things correctly.

I've not tested extensively but the following incremental patch seems to do the right thing, at least by inspection of the resulting grub.cfg.

Needs more testing (e.g. I haven't tried non-XSM yet) and review from Ian I think, since there may be a more idiomatically Perl way to manipulate the @offsets array (in particular shrinking it).

Thanks Ian. You are so quick. I wrote that piece of code almost a year ago; was just about to warm up.
We're to test your fix in our environment as well on non-XSM.

Quoted 60 lines

Ian.

Osstest/Debian.pm +8 -7
index 282175b..b5148fd 100644
@@ -393,8 +393,6 @@ sub setupboot_grub1 ($$$$) {
 # Note on running OSSTest on Squeeze with old Xen kernel: check out
 # Debian bug #633127 "/etc/grub/20_linux does not recognise some old
 # Xen kernels"
-# Currently setupboot_grub2 relies on Grub menu not having submenu.
-# Check Debian bug #690538.
 sub setupboot_grub2 ($$$$) {
     my ($ho,$want_kernver,$want_xsm,$xenhopt,$xenkopt) = @_;
     my $bl= { };
@@ -405,7 +403,7 @@ sub setupboot_grub2 ($$$$) {
     my $parsemenu= sub {
         my $f= bl_getmenu_open($ho, $rmenu, "$stash/$ho->{Name}--grub.cfg.1");
 
-        my $count= 0;
+        my @offsets = (0);
         my $entry;
         my $submenu;
         while (<$f>) {
@@ -417,6 +415,8 @@ sub setupboot_grub2 ($$$$) {
                         "$submenu->{StartLine}. ".
                         "Our want kern is $want_kernver");
                     $submenu=undef;
+                    $#offsets = $#offsets-1;
+                    $offsets[$#offsets]++;
                     next;
                 }
                 my (@missing) =
@@ -446,11 +446,12 @@ sub setupboot_grub2 ($$$$) {
             }
             if (m/^menuentry\s+[\'\"](.*)[\'\"].*\{\s*$/) {
                 die $entry->{StartLine} if $entry;
-                $entry= { Title => $1, StartLine => $., Number => $count };
-                $count++;
+                $entry= { Title => $1, StartLine => $., MenuEntryPath => join ">", @offsets };
+                $offsets[$#offsets]++;
             }
             if (m/^submenu\s+[\'\"](.*)[\'\"].*\{\s*$/) {
-                $submenu={ StartLine =>$.};
+                $submenu={ StartLine =>$., MenuEntryPath => join ">", @offsets };
+                $offsets[$#offsets+1] = 0;
             }
             if (m/^\s*multiboot\s*(?:\/boot)?\/(xen\S+)/) {
                 die unless $entry;
@@ -511,7 +512,7 @@ sub setupboot_grub2 ($$$$) {
             }
             print ::EO <<END or die $!;
 
-GRUB_DEFAULT=$entry->{Number}
+GRUB_DEFAULT="$entry->{MenuEntryPath}"
 END
 
             print ::EO <<END or die $! if defined $xenhopt;
#9 lore raw
Quoted 8 lines · Robert Hu
Quoted 7 lines · Ian Campbell
Quoted 2 lines · Ian Campbell

From my particular grub.cfg. For real usage setupboot_grub2 will obviously need to become cleverer to count things correctly.

I've not tested extensively but the following incremental patch seems to do the right thing, at least by inspection of the resulting grub.cfg.

Quoted 6 lines
Quoted 3 lines

Needs more testing (e.g. I haven't tried non-XSM yet) and review from Ian I think, since there may be a more idiomatically Perl way to manipulate the @offsets array (in particular shrinking it).

Thanks Ian. You are so quick. I wrote that piece of code almost a year ago; was just about to warm up.
We're to test your fix in our environment as well on non-XSM.

Just furbished up that piece of code. Now I recall the memory. This piece of code was developed before 'XSM' things introduced; though now after XSM things merged. May I know what is 'xsm' stuff?
Can you send me the 'grub.cfg' of those 'xsm' cases? so that I can take a look.

Quoted 62 lines
Quoted 60 lines

Ian.

Osstest/Debian.pm +8 -7
index 282175b..b5148fd 100644
@@ -393,8 +393,6 @@ sub setupboot_grub1 ($$$$) {
 # Note on running OSSTest on Squeeze with old Xen kernel: check out
 # Debian bug #633127 "/etc/grub/20_linux does not recognise some old
 # Xen kernels"
-# Currently setupboot_grub2 relies on Grub menu not having submenu.
-# Check Debian bug #690538.
 sub setupboot_grub2 ($$$$) {
     my ($ho,$want_kernver,$want_xsm,$xenhopt,$xenkopt) = @_;
     my $bl= { };
@@ -405,7 +403,7 @@ sub setupboot_grub2 ($$$$) {
     my $parsemenu= sub {
         my $f= bl_getmenu_open($ho, $rmenu, "$stash/$ho->{Name}--grub.cfg.1");
 
-        my $count= 0;
+        my @offsets = (0);
         my $entry;
         my $submenu;
         while (<$f>) {
@@ -417,6 +415,8 @@ sub setupboot_grub2 ($$$$) {
                         "$submenu->{StartLine}. ".
                         "Our want kern is $want_kernver");
                     $submenu=undef;
+                    $#offsets = $#offsets-1;
+                    $offsets[$#offsets]++;
                     next;
                 }
                 my (@missing) =
@@ -446,11 +446,12 @@ sub setupboot_grub2 ($$$$) {
             }
             if (m/^menuentry\s+[\'\"](.*)[\'\"].*\{\s*$/) {
                 die $entry->{StartLine} if $entry;
-                $entry= { Title => $1, StartLine => $., Number => $count };
-                $count++;
+                $entry= { Title => $1, StartLine => $., MenuEntryPath => join ">", @offsets };
+                $offsets[$#offsets]++;
             }
             if (m/^submenu\s+[\'\"](.*)[\'\"].*\{\s*$/) {
-                $submenu={ StartLine =>$.};
+                $submenu={ StartLine =>$., MenuEntryPath => join ">", @offsets };
+                $offsets[$#offsets+1] = 0;
             }
             if (m/^\s*multiboot\s*(?:\/boot)?\/(xen\S+)/) {
                 die unless $entry;
@@ -511,7 +512,7 @@ sub setupboot_grub2 ($$$$) {
             }
             print ::EO <<END or die $!;
 
-GRUB_DEFAULT=$entry->{Number}
+GRUB_DEFAULT="$entry->{MenuEntryPath}"
 END
 
             print ::EO <<END or die $! if defined $xenhopt;
#10 lore raw
Quoted 12 lines · Robert Hu
Quoted 11 lines · Robert Hu
Quoted 10 lines · Ian Campbell
Quoted 2 lines · Ian Campbell

From my particular grub.cfg. For real usage setupboot_grub2 will obviously need to become cleverer to count things correctly.

I've not tested extensively but the following incremental patch seems to do the right thing, at least by inspection of the resulting grub.cfg.

Needs more testing (e.g. I haven't tried non-XSM yet) and review from Ian I think, since there may be a more idiomatically Perl way to manipulate the @offsets array (in particular shrinking it).

Quoted 7 lines
Quoted 3 lines

Thanks Ian. You are so quick. I wrote that piece of code almost a year ago; was just about to warm up.
We're to test your fix in our environment as well on non-XSM.

Just furbished up that piece of code. Now I recall the memory. This piece of code was developed before 'XSM' things introduced; though now after XSM things merged. May I know what is 'xsm' stuff?

XSM is Xen Security Modules (sort of selinux for Xen). It involves some special additional entries in grub to provide the policy.

Quoted 2 lines

Can you send me the 'grub.cfg' of those 'xsm' cases? so that I can take a look.

All of the logs for the flight can be found at:

http://logs.test-lab.xenproject.org/osstest/logs/56922/

Clicking the heading of one of the failing tests would take you to e.g.:

http://logs.test-lab.xenproject.org/osstest/logs/56922/test-amd64-amd64-xl-xsm/info.html

and in there is:

http://logs.test-lab.xenproject.org/osstest/logs/56922/test-amd64-amd64-xl-xsm/italia1--grub.cfg.1

Ian.

#11 lore raw
Quoted 27 lines · Ian Campbell
Quoted 12 lines · Robert Hu
Quoted 11 lines · Robert Hu
Quoted 10 lines · Ian Campbell
Quoted 2 lines · Ian Campbell

From my particular grub.cfg. For real usage setupboot_grub2 will obviously need to become cleverer to count things correctly.

I've not tested extensively but the following incremental patch seems to do the right thing, at least by inspection of the resulting grub.cfg.

Needs more testing (e.g. I haven't tried non-XSM yet) and review from Ian I think, since there may be a more idiomatically Perl way to manipulate the @offsets array (in particular shrinking it).

Quoted 7 lines
Quoted 3 lines

Thanks Ian. You are so quick. I wrote that piece of code almost a year ago; was just about to warm up.
We're to test your fix in our environment as well on non-XSM.

Just furbished up that piece of code. Now I recall the memory. This piece of code was developed before 'XSM' things introduced; though now after XSM things merged. May I know what is 'xsm' stuff?

XSM is Xen Security Modules (sort of selinux for Xen). It involves some special additional entries in grub to provide the policy.

Quoted 2 lines

Can you send me the 'grub.cfg' of those 'xsm' cases? so that I can take a look.

Quoted 8 lines

All of the logs for the flight can be found at:

http://logs.test-lab.xenproject.org/osstest/logs/56922/

Clicking the heading of one of the failing tests would take you to e.g.:

http://logs.test-lab.xenproject.org/osstest/logs/56922/test-amd64-amd64-xl-xsm/info.html
From the log I see

'boot check: grub2, found Debian GNU/Linux, with Xen 4.6-unstable (XSM enabled) and Linux 3.14.43+'
Seems it finds what ought to be.

Quoted 7 lines

and in there is:

http://logs.test-lab.xenproject.org/osstest/logs/56922/test-amd64-amd64-xl-xsm/italia1--grub.cfg.1

Ian.

#12 lore raw
Quoted 32 lines · Robert Hu
Quoted 31 lines · Ian Campbell
Quoted 12 lines · Robert Hu
Quoted 11 lines · Robert Hu
Quoted 10 lines · Ian Campbell
Quoted 2 lines · Ian Campbell

From my particular grub.cfg. For real usage setupboot_grub2 will obviously need to become cleverer to count things correctly.

I've not tested extensively but the following incremental patch seems to do the right thing, at least by inspection of the resulting grub.cfg.

Needs more testing (e.g. I haven't tried non-XSM yet) and review from Ian I think, since there may be a more idiomatically Perl way to manipulate the @offsets array (in particular shrinking it).

Quoted 7 lines
Quoted 3 lines

Thanks Ian. You are so quick. I wrote that piece of code almost a year ago; was just about to warm up.
We're to test your fix in our environment as well on non-XSM.

Just furbished up that piece of code. Now I recall the memory. This piece of code was developed before 'XSM' things introduced; though now after XSM things merged. May I know what is 'xsm' stuff?

XSM is Xen Security Modules (sort of selinux for Xen). It involves some special additional entries in grub to provide the policy.

Quoted 2 lines

Can you send me the 'grub.cfg' of those 'xsm' cases? so that I can take a look.

All of the logs for the flight can be found at:

http://logs.test-lab.xenproject.org/osstest/logs/56922/

Quoted 7 lines
Quoted 3 lines

Clicking the heading of one of the failing tests would take you to e.g.:

http://logs.test-lab.xenproject.org/osstest/logs/56922/test-amd64-amd64-xl-xsm/info.html

From the log I see
'boot check: grub2, found Debian GNU/Linux, with Xen 4.6-unstable (XSM enabled) and Linux 3.14.43+'
Seems it finds what ought to be.

Yes, but the corresponding thing which it puts into GRUB_DEFAULT (which becomes "default" in grub.cfg) is "21" which is not correct, it needs to be something like "8>1" to correctly refer to that entry.

Ian.

#13 lore raw
Quoted 36 lines · Ian Campbell
Quoted 35 lines · Robert Hu
Quoted 34 lines · Ian Campbell
Quoted 12 lines · Robert Hu
Quoted 11 lines · Robert Hu
Quoted 10 lines · Ian Campbell
Quoted 2 lines · Ian Campbell

From my particular grub.cfg. For real usage setupboot_grub2 will obviously need to become cleverer to count things correctly.

I've not tested extensively but the following incremental patch seems to do the right thing, at least by inspection of the resulting grub.cfg.

Needs more testing (e.g. I haven't tried non-XSM yet) and review from Ian I think, since there may be a more idiomatically Perl way to manipulate the @offsets array (in particular shrinking it).

Quoted 7 lines
Quoted 3 lines

Thanks Ian. You are so quick. I wrote that piece of code almost a year ago; was just about to warm up.
We're to test your fix in our environment as well on non-XSM.

Just furbished up that piece of code. Now I recall the memory. This piece of code was developed before 'XSM' things introduced; though now after XSM things merged. May I know what is 'xsm' stuff?

XSM is Xen Security Modules (sort of selinux for Xen). It involves some special additional entries in grub to provide the policy.

Quoted 2 lines

Can you send me the 'grub.cfg' of those 'xsm' cases? so that I can take a look.

All of the logs for the flight can be found at:

http://logs.test-lab.xenproject.org/osstest/logs/56922/

Clicking the heading of one of the failing tests would take you to e.g.:

http://logs.test-lab.xenproject.org/osstest/logs/56922/test-amd64-amd64-xl-xsm/info.html

Quoted 8 lines
Quoted 4 lines

From the log I see
'boot check: grub2, found Debian GNU/Linux, with Xen 4.6-unstable (XSM enabled) and Linux 3.14.43+'
Seems it finds what ought to be.

Yes, but the corresponding thing which it puts into GRUB_DEFAULT (which becomes "default" in grub.cfg) is "21" which is not correct, it needs to be something like "8>1" to correctly refer to that entry.

Ah, I see.

Quoted 3 lines

Ian.

#14 lore raw
In reply to Ian Campbell
Quoted 47 lines · Ian Campbell
Quoted 2 lines · Ian Campbell

From my particular grub.cfg. For real usage setupboot_grub2 will obviously need to become cleverer to count things correctly.

I've not tested extensively but the following incremental patch seems to do the right thing, at least by inspection of the resulting grub.cfg.

Needs more testing (e.g. I haven't tried non-XSM yet) and review from Ian I think, since there may be a more idiomatically Perl way to manipulate the @offsets array (in particular shrinking it).

Ian.

Osstest/Debian.pm +3 -3
index 282175b..b5148fd 100644
@@ -393,8 +393,6 @@ sub setupboot_grub1 ($$$$) {
 # Note on running OSSTest on Squeeze with old Xen kernel: check out
 # Debian bug #633127 "/etc/grub/20_linux does not recognise some old
 # Xen kernels"
-# Currently setupboot_grub2 relies on Grub menu not having submenu.
-# Check Debian bug #690538.
 sub setupboot_grub2 ($$$$) {
     my ($ho,$want_kernver,$want_xsm,$xenhopt,$xenkopt) = @_;
     my $bl= { };
@@ -405,7 +403,7 @@ sub setupboot_grub2 ($$$$) {
     my $parsemenu= sub {
         my $f= bl_getmenu_open($ho, $rmenu, "$stash/$ho->{Name}--grub.cfg.1");
 
-        my $count= 0;
+        my @offsets = (0);
         my $entry;
         my $submenu;
         while (<$f>) {
@@ -417,6 +415,8 @@ sub setupboot_grub2 ($$$$) {
                         "$submenu->{StartLine}. ".
                         "Our want kern is $want_kernver");
                     $submenu=undef;
+                    $#offsets = $#offsets-1;
+                    $offsets[$#offsets]++;
                     next;
                 }
                 my (@missing) =
@@ -446,11 +446,12 @@ sub setupboot_grub2 ($$$$) {
             }
             if (m/^menuentry\s+[\'\"](.*)[\'\"].*\{\s*$/) {

Osstest/Debian.pm sub setupboot_grub2 ($$$$) { · line 454

Quoted 10 lines
Osstest/Debian.pm +4 -3
                 die $entry->{StartLine} if $entry;
-                $entry= { Title => $1, StartLine => $., Number => $count };
-                $count++;
+                $entry= { Title => $1, StartLine => $., MenuEntryPath => join ">", @offsets };
+                $offsets[$#offsets]++;
             }
             if (m/^submenu\s+[\'\"](.*)[\'\"].*\{\s*$/) {
-                $submenu={ StartLine =>$.};
+                $submenu={ StartLine =>$., MenuEntryPath => join ">", @offsets };
+                $offsets[$#offsets+1] = 0;

I see your points now.
Seems you even considers nested submenu in the future.:) Just 1 question (I'm not a Perl expert): after "$offsets[$#offsets+1] = 0;", $#offsets increases automatically/implicitly, right?

Quoted 14 lines
Osstest/Debian.pm +1 -1
             }
             if (m/^\s*multiboot\s*(?:\/boot)?\/(xen\S+)/) {
                 die unless $entry;
@@ -511,7 +512,7 @@ sub setupboot_grub2 ($$$$) {
             }
             print ::EO <<END or die $!;
 
-GRUB_DEFAULT=$entry->{Number}
+GRUB_DEFAULT="$entry->{MenuEntryPath}"
 END
 
             print ::EO <<END or die $! if defined $xenhopt;
#15 lore raw
Quoted 11 lines · Robert Hu
Quoted 10 lines · Ian Campbell
Quoted 2 lines · Ian Campbell

From my particular grub.cfg. For real usage setupboot_grub2 will obviously need to become cleverer to count things correctly.

I've not tested extensively but the following incremental patch seems to do the right thing, at least by inspection of the resulting grub.cfg.

Needs more testing (e.g. I haven't tried non-XSM yet) and review from Ian I think, since there may be a more idiomatically Perl way to manipulate the @offsets array (in particular shrinking it).

Carefully read your code and I think they can handle submenu (even submenu in a submenu) correctly. Thanks for correcting my previous implementation.
Just my 2 cents below inline.

Quoted 20 lines
Quoted 20 lines

Ian.

Osstest/Debian.pm +0 -2
index 282175b..b5148fd 100644
@@ -393,8 +393,6 @@ sub setupboot_grub1 ($$$$) {
 # Note on running OSSTest on Squeeze with old Xen kernel: check out
 # Debian bug #633127 "/etc/grub/20_linux does not recognise some old
 # Xen kernels"
-# Currently setupboot_grub2 relies on Grub menu not having submenu.
-# Check Debian bug #690538.
 sub setupboot_grub2 ($$$$) {
     my ($ho,$want_kernver,$want_xsm,$xenhopt,$xenkopt) = @_;
     my $bl= { };
@@ -405,7 +403,7 @@ sub setupboot_grub2 ($$$$) {
     my $parsemenu= sub {
         my $f= bl_getmenu_open($ho, $rmenu, "$stash/$ho->{Name}--grub.cfg.1");
 
Quoted 11 lines

Osstest/Debian.pm sub setupboot_grub2 ($$$$) { · line 419

Quoted 11 lines
Osstest/Debian.pm +3 -1
-        my $count= 0;
+        my @offsets = (0);
         my $entry;
         my $submenu;
         while (<$f>) {
@@ -417,6 +415,8 @@ sub setupboot_grub2 ($$$$) {
                         "$submenu->{StartLine}. ".
                         "Our want kern is $want_kernver");
                     $submenu=undef;
+                    $#offsets = $#offsets-1;
+                    $offsets[$#offsets]++;

may consider 'pop/push' operations on @offsets array? I worry about if '$#offsets-1' can always shrink array size correctly. pop/push anyway is some official way to do this.

Quoted 7 lines
Quoted 7 lines
Osstest/Debian.pm +0 -0
                     next;
                 }
                 my (@missing) =
@@ -446,11 +446,12 @@ sub setupboot_grub2 ($$$$) {
             }
             if (m/^menuentry\s+[\'\"](.*)[\'\"].*\{\s*$/) {
                 die $entry->{StartLine} if $entry;
Quoted 8 lines

Osstest/Debian.pm sub setupboot_grub2 ($$$$) { · line 453

Quoted 8 lines
Osstest/Debian.pm +3 -3
-                $entry= { Title => $1, StartLine => $., Number => $count };
-                $count++;
+                $entry= { Title => $1, StartLine => $., MenuEntryPath => join ">", @offsets };
+                $offsets[$#offsets]++;
             }
             if (m/^submenu\s+[\'\"](.*)[\'\"].*\{\s*$/) {
-                $submenu={ StartLine =>$.};
+                $submenu={ StartLine =>$., MenuEntryPath => join ">", @offsets };

Here MenuEntryPath element for $submenu is actually debug purpose only, I think, may be can remove it. correct me if I'm wrong.

Quoted 21 lines

Osstest/Debian.pm sub setupboot_grub2 ($$$$) { · line 454

Quoted 1 line
Osstest/Debian.pm +1 -0
+                $offsets[$#offsets+1] = 0;

I see your points now.
Seems you even considers nested submenu in the future.:) Just 1 question (I'm not a Perl expert): after "$offsets[$#offsets+1] = 0;", $#offsets increases automatically/implicitly, right?

Quoted 14 lines
Osstest/Debian.pm +1 -1
             }
             if (m/^\s*multiboot\s*(?:\/boot)?\/(xen\S+)/) {
                 die unless $entry;
@@ -511,7 +512,7 @@ sub setupboot_grub2 ($$$$) {
             }
             print ::EO <<END or die $!;
 
-GRUB_DEFAULT=$entry->{Number}
+GRUB_DEFAULT="$entry->{MenuEntryPath}"
 END
 
             print ::EO <<END or die $! if defined $xenhopt;
#19 lore raw
In reply to Ian Campbell
Quoted 10 lines · Ian Campbell
Quoted 2 lines · Ian Campbell

From my particular grub.cfg. For real usage setupboot_grub2 will obviously need to become cleverer to count things correctly.

I've not tested extensively but the following incremental patch seems to do the right thing, at least by inspection of the resulting grub.cfg.

Needs more testing (e.g. I haven't tried non-XSM yet) and review from Ian I think, since there may be a more idiomatically Perl way to manipulate the @offsets array (in particular shrinking it).

I've done unit test with this piece of code, by making a sub comprised of this piece of code and constructing various conditions: xsm, non-xsm, xenhopt defined/undefined, all works as expected.

Of course, we'll further test this in real job-running cases.

Quoted 61 lines

Ian.

Osstest/Debian.pm +8 -7
index 282175b..b5148fd 100644
@@ -393,8 +393,6 @@ sub setupboot_grub1 ($$$$) {
 # Note on running OSSTest on Squeeze with old Xen kernel: check out
 # Debian bug #633127 "/etc/grub/20_linux does not recognise some old
 # Xen kernels"
-# Currently setupboot_grub2 relies on Grub menu not having submenu.
-# Check Debian bug #690538.
 sub setupboot_grub2 ($$$$) {
     my ($ho,$want_kernver,$want_xsm,$xenhopt,$xenkopt) = @_;
     my $bl= { };
@@ -405,7 +403,7 @@ sub setupboot_grub2 ($$$$) {
     my $parsemenu= sub {
         my $f= bl_getmenu_open($ho, $rmenu, "$stash/$ho->{Name}--grub.cfg.1");
 
-        my $count= 0;
+        my @offsets = (0);
         my $entry;
         my $submenu;
         while (<$f>) {
@@ -417,6 +415,8 @@ sub setupboot_grub2 ($$$$) {
                         "$submenu->{StartLine}. ".
                         "Our want kern is $want_kernver");
                     $submenu=undef;
+                    $#offsets = $#offsets-1;
+                    $offsets[$#offsets]++;
                     next;
                 }
                 my (@missing) =
@@ -446,11 +446,12 @@ sub setupboot_grub2 ($$$$) {
             }
             if (m/^menuentry\s+[\'\"](.*)[\'\"].*\{\s*$/) {
                 die $entry->{StartLine} if $entry;
-                $entry= { Title => $1, StartLine => $., Number => $count };
-                $count++;
+                $entry= { Title => $1, StartLine => $., MenuEntryPath => join ">", @offsets };
+                $offsets[$#offsets]++;
             }
             if (m/^submenu\s+[\'\"](.*)[\'\"].*\{\s*$/) {
-                $submenu={ StartLine =>$.};
+                $submenu={ StartLine =>$., MenuEntryPath => join ">", @offsets };
+                $offsets[$#offsets+1] = 0;
             }
             if (m/^\s*multiboot\s*(?:\/boot)?\/(xen\S+)/) {
                 die unless $entry;
@@ -511,7 +512,7 @@ sub setupboot_grub2 ($$$$) {
             }
             print ::EO <<END or die $!;
 
-GRUB_DEFAULT=$entry->{Number}
+GRUB_DEFAULT="$entry->{MenuEntryPath}"
 END
 
             print ::EO <<END or die $! if defined $xenhopt;
#16 lore raw
In reply to Robert Hu
Quoted 5 lines · Robert Hu
Quoted 2 lines

Osstest/Debian.pm sub setupboot_grub2 ($$$$) { · line 419

Quoted 2 lines
Osstest/Debian.pm +2 -0
+                    $#offsets = $#offsets-1;
+                    $offsets[$#offsets]++;

may consider 'pop/push' operations on @offsets array? I worry about if '$#offsets-1' can always shrink array size correctly. pop/push anyway is some official way to do this.

Assigning to $#offsets is defined to change the length of the array. But I think you are correct that pop/push would be a more idiomatic way to do this.

It is a public holiday on Monday, but I'll take a look on Tuesday, unless you fancy doing it in the meantime.

Quoted 12 lines

@@ -446,11 +446,12 @@ sub setupboot_grub2 ($$$$) {

Quoted 11 lines

Osstest/Debian.pm sub setupboot_grub2 ($$$$) { · line 453

Quoted 11 lines
             }
             if (m/^menuentry\s+[\'\"](.*)[\'\"].*\{\s*$/) {
                 die $entry->{StartLine} if $entry;
Osstest/Debian.pm +3 -3
-                $entry= { Title => $1, StartLine => $., Number => $count };
-                $count++;
+                $entry= { Title => $1, StartLine => $., MenuEntryPath => join ">", @offsets };
+                $offsets[$#offsets]++;
             }
             if (m/^submenu\s+[\'\"](.*)[\'\"].*\{\s*$/) {
-                $submenu={ StartLine =>$.};
+                $submenu={ StartLine =>$., MenuEntryPath => join ">", @offsets };
Quoted 2 lines

Here MenuEntryPath element for $submenu is actually debug purpose only, I think, may be can remove it. correct me if I'm wrong.

It is just for debug, I think it would be OK to leave it though.

Ian.

#17 lore raw
Quoted 7 lines · Ian Campbell
Quoted 5 lines · Robert Hu
Quoted 2 lines

Osstest/Debian.pm sub setupboot_grub2 ($$$$) { · line 419

Quoted 2 lines
Osstest/Debian.pm +2 -0
+                    $#offsets = $#offsets-1;
+                    $offsets[$#offsets]++;

may consider 'pop/push' operations on @offsets array? I worry about if '$#offsets-1' can always shrink array size correctly. pop/push anyway is some official way to do this.

Quoted 6 lines

Assigning to $#offsets is defined to change the length of the array. But I think you are correct that pop/push would be a more idiomatic way to do this.

It is a public holiday on Monday, but I'll take a look on Tuesday, unless you fancy doing it in the meantime.

Sure I will do this.

Quoted 20 lines
Quoted 13 lines

@@ -446,11 +446,12 @@ sub setupboot_grub2 ($$$$) {

Quoted 11 lines

Osstest/Debian.pm sub setupboot_grub2 ($$$$) { · line 453

Quoted 11 lines
             }
             if (m/^menuentry\s+[\'\"](.*)[\'\"].*\{\s*$/) {
                 die $entry->{StartLine} if $entry;
Osstest/Debian.pm +3 -3
-                $entry= { Title => $1, StartLine => $., Number => $count };
-                $count++;
+                $entry= { Title => $1, StartLine => $., MenuEntryPath => join ">", @offsets };
+                $offsets[$#offsets]++;
             }
             if (m/^submenu\s+[\'\"](.*)[\'\"].*\{\s*$/) {
-                $submenu={ StartLine =>$.};
+                $submenu={ StartLine =>$., MenuEntryPath => join ">", @offsets };
Quoted 2 lines

Here MenuEntryPath element for $submenu is actually debug purpose only, I think, may be can remove it. correct me if I'm wrong.

It is just for debug, I think it would be OK to leave it though.

Ian.

#18 lore raw
Quoted 8 lines · Robert Hu
Quoted 7 lines · Ian Campbell
Quoted 5 lines · Robert Hu
Quoted 2 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+                    $#offsets = $#offsets-1;
+                    $offsets[$#offsets]++;

may consider 'pop/push' operations on @offsets array? I worry about if '$#offsets-1' can always shrink array size correctly. pop/push anyway is some official way to do this.

Quoted 7 lines
Quoted 6 lines

Assigning to $#offsets is defined to change the length of the array. But I think you are correct that pop/push would be a more idiomatic way to do this.

It is a public holiday on Monday, but I'll take a look on Tuesday, unless you fancy doing it in the meantime.

Sure I will do this.

Done the test with pop/push alternative. Same effect as your original patch.
Here is the trivial change on your patch.

Osstest/Debian.pm +1 -1
index 607c9ce..68101e0 100644
@@ -415,7 +415,7 @@ sub setupboot_grub2 ($$$$) {
                         "$submenu->{StartLine}. ".
                         "Our want kern is $want_kernver");
                     $submenu=undef;
-                    $#offsets = $#offsets-1;
+                    pop @offsets;
                     $offsets[$#offsets]++;
                     next;
                 }
@@ -451,7 +451,7 @@ sub setupboot_grub2 ($$$$) {
             }
             if (m/^submenu\s+[\'\"](.*)[\'\"].*\{\s*$/) {
                 $submenu={ StartLine =>$., MenuEntryPath => join ">",

@offsets };
- $offsets[$#offsets+1] = 0;

+                push @offsets,(0);
             }
             if (m/^\s*multiboot\s*(?:\/boot)?\/(xen\S+)/) {
                 die unless $entry;
Quoted 22 lines
Quoted 20 lines
Quoted 13 lines

@@ -446,11 +446,12 @@ sub setupboot_grub2 ($$$$) {

Quoted 11 lines

Review

Quoted 11 lines
             }
             if (m/^menuentry\s+[\'\"](.*)[\'\"].*\{\s*$/) {
                 die $entry->{StartLine} if $entry;
(quoted diff) +3 -3
-                $entry= { Title => $1, StartLine => $., Number => $count };
-                $count++;
+                $entry= { Title => $1, StartLine => $., MenuEntryPath => join ">", @offsets };
+                $offsets[$#offsets]++;
             }
             if (m/^submenu\s+[\'\"](.*)[\'\"].*\{\s*$/) {
-                $submenu={ StartLine =>$.};
+                $submenu={ StartLine =>$., MenuEntryPath => join ">", @offsets };
Quoted 2 lines

Here MenuEntryPath element for $submenu is actually debug purpose only, I think, may be can remove it. correct me if I'm wrong.

It is just for debug, I think it would be OK to leave it though.

Ian.