]> Git Repo - linux.git/commitdiff
ktest.pl: Avoid false positives with grub2 skip regex
authorDaniel Jordan <[email protected]>
Wed, 4 Sep 2024 17:55:30 +0000 (13:55 -0400)
committerSteven Rostedt <[email protected]>
Wed, 4 Sep 2024 19:06:28 +0000 (15:06 -0400)
Some distros have grub2 config files with the lines

    if [ x"${feature_menuentry_id}" = xy ]; then
      menuentry_id_option="--id"
    else
      menuentry_id_option=""
    fi

which match the skip regex defined for grub2 in get_grub_index():

    $skip = '^\s*menuentry';

These false positives cause the grub number to be higher than it
should be, and the wrong kernel can end up booting.

Grub documents the menuentry command with whitespace between it and the
title, so make the skip regex reflect this.

Link: https://lore.kernel.org/[email protected]
Signed-off-by: Daniel Jordan <[email protected]>
Acked-by: John 'Warthog9' Hawley (Tenstorrent) <[email protected]>
Signed-off-by: Steven Rostedt <[email protected]>
tools/testing/ktest/ktest.pl

index c82b8d55dddb8ef6266c504abb4141b011203d68..dacad94e2be42a86f9680fcb50b65d1f3a78afb5 100755 (executable)
@@ -2056,7 +2056,7 @@ sub get_grub_index {
     } elsif ($reboot_type eq "grub2") {
        $command = "cat $grub_file";
        $target = '^\s*menuentry.*' . $grub_menu_qt;
-       $skip = '^\s*menuentry';
+       $skip = '^\s*menuentry\s';
        $submenu = '^\s*submenu\s';
     } elsif ($reboot_type eq "grub2bls") {
        $command = $grub_bls_get;
This page took 0.0779 seconds and 4 git commands to generate.