Skip to content

Commit

Permalink
ktest.pl: Avoid false positives with grub2 skip regex
Browse files Browse the repository at this point in the history
[ Upstream commit 2351e8c ]

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]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
danieljordan10 authored and gregkh committed Oct 17, 2024
1 parent b85e6e4 commit ee603aa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/testing/ktest/ktest.pl
Original file line number Diff line number Diff line change
Expand Up @@ -2036,7 +2036,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;
Expand Down

0 comments on commit ee603aa

Please sign in to comment.