* [PATCH v2] ktest.pl: Avoid false positives with grub2 skip regex
@ 2024-09-04 17:55 Daniel Jordan
2024-09-04 18:44 ` John 'Warthog9' Hawley
0 siblings, 1 reply; 3+ messages in thread
From: Daniel Jordan @ 2024-09-04 17:55 UTC (permalink / raw)
To: Steven Rostedt, John Hawley; +Cc: Daniel Jordan, linux-kernel
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.
Signed-off-by: Daniel Jordan <daniel.m.jordan@oracle.com>
---
v2: Resend, removing unnecessary terminal + from regex.
v1: https://lkml.kernel.org/r/20240802145706.1283189-1-daniel.m.jordan@oracle.com
tools/testing/ktest/ktest.pl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index eb31cd9c977bf..621a874b24264 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -2047,7 +2047,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;
--
2.45.2
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH v2] ktest.pl: Avoid false positives with grub2 skip regex
2024-09-04 17:55 [PATCH v2] ktest.pl: Avoid false positives with grub2 skip regex Daniel Jordan
@ 2024-09-04 18:44 ` John 'Warthog9' Hawley
2024-09-04 18:48 ` Daniel Jordan
0 siblings, 1 reply; 3+ messages in thread
From: John 'Warthog9' Hawley @ 2024-09-04 18:44 UTC (permalink / raw)
To: Daniel Jordan, Steven Rostedt; +Cc: linux-kernel
On 9/4/2024 10:55 AM, Daniel Jordan wrote:
> 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.
>
> Signed-off-by: Daniel Jordan <daniel.m.jordan@oracle.com>
> ---
> v2: Resend, removing unnecessary terminal + from regex.
> v1: https://lkml.kernel.org/r/20240802145706.1283189-1-daniel.m.jordan@oracle.com
>
> tools/testing/ktest/ktest.pl | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
> index eb31cd9c977bf..621a874b24264 100755
> --- a/tools/testing/ktest/ktest.pl
> +++ b/tools/testing/ktest/ktest.pl
> @@ -2047,7 +2047,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;
Easy enough fix. Out of curiosity which distro(s) did you find have
that? Haven't run into that myself.
Acked-by: John 'Warthog9' Hawley (Tenstorrent) <warthog9@eaglescrag.net>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH v2] ktest.pl: Avoid false positives with grub2 skip regex
2024-09-04 18:44 ` John 'Warthog9' Hawley
@ 2024-09-04 18:48 ` Daniel Jordan
0 siblings, 0 replies; 3+ messages in thread
From: Daniel Jordan @ 2024-09-04 18:48 UTC (permalink / raw)
To: John 'Warthog9' Hawley; +Cc: Steven Rostedt, linux-kernel
On Wed, Sep 04, 2024 at 11:44:12AM GMT, John 'Warthog9' Hawley wrote:
> Easy enough fix. Out of curiosity which distro(s) did you find have that?
> Haven't run into that myself.
I see it on Arch and Oracle.
> Acked-by: John 'Warthog9' Hawley (Tenstorrent) <warthog9@eaglescrag.net>
Thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-09-04 18:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-04 17:55 [PATCH v2] ktest.pl: Avoid false positives with grub2 skip regex Daniel Jordan
2024-09-04 18:44 ` John 'Warthog9' Hawley
2024-09-04 18:48 ` Daniel Jordan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®