Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ktest: Take submenu into account for grub2 menus

grub-reboot selects the submenu's first menuentry (title is "1>0") rather than ktest's
menuentry (title is "2") by mistake.

===
$ sudo cat /boot/grub/grub.cfg | grep -E "^menuentry|^submenu"
...
menuentry 'Ubuntu' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option '...' {
...
submenu 'Advanced options for Ubuntu' $menuentry_id_option '...' {
...
menuentry 'ktest' {
...
===

Correct it by taking submenu entries into account in get_grub2_index().

Link: http://lkml.kernel.org/r/87poaje4as.wl-satoru.takeuchi@gmail.com

Signed-off-by: Satoru Takeuchi <satoru.takeuchi@gmail.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

authored by

Satoru Takeuchi and committed by
Steven Rostedt (VMware)
6cd110a9 c2d84ddb

+1 -1
+1 -1
tools/testing/ktest/ktest.pl
··· 1872 1872 $grub_number++; 1873 1873 $found = 1; 1874 1874 last; 1875 - } elsif (/^menuentry\s/) { 1875 + } elsif (/^menuentry\s|^submenu\s/) { 1876 1876 $grub_number++; 1877 1877 } 1878 1878 }