ktest: Add support for meta characters in GRUB_MENU
PATCH v2 1/1 ktest: Add support for meta characters in GRUB_MENU
From: Masayoshi Mizuma <[email protected]>
ktest fails if meta characters are in GRUB_MENU, for example GRUB_MENU = 'Fedora (test)'
The failure happens because the meta characters are not escaped, so the menu doesn't match in any entries in GRUB_FILE.
Use quotemeta() to escape the meta characters.
--- tools/testing/ktest/ktest.pl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
tools/testing/ktest/ktest.pl +4 -2
@@ -1866,9 +1866,10 @@ sub get_grub2_index { or dodie "unable to get $grub_file"; my $found = 0; + my $grub_menu_qt = quotemeta($grub_menu); while (<IN>) { - if (/^menuentry.*$grub_menu/) { + if (/^menuentry.*$grub_menu_qt/) { $grub_number++; $found = 1; last;
@@ -1909,9 +1910,10 @@ sub get_grub_index { or dodie "unable to get menu.lst"; my $found = 0; + my $grub_menu_qt = quotemeta($grub_menu); while (<IN>) { - if (/^\s*title\s+$grub_menu\s*$/) { + if (/^\s*title\s+$grub_menu_qt\s*$/) { $grub_number++; $found = 1; last;
Signature · 1 line
2.20.1
Steven Rostedt
maintainerQuoted 11 lines · On Wed, 17 Apr 2019 19:58:23 -0400 Masayoshi Mizuma <[email protected]>…
From: Masayoshi Mizuma <[email protected]>
ktest fails if meta characters are in
GRUB_MENU, for exampleGRUB_MENU= 'Fedora (test)'The failure happens because the meta characters are not escaped, so the menu doesn't match in any entries in
GRUB_FILE.Use
quotemeta()to escape the meta characters.Signed-off-by Masayoshi Mizuma <[email protected]>
I applied this patch to my tree but haven't pushed it out. The ktest.pl I use to test my kernels is a soft link to my development tree (where I just added this patch). If it doesn't cause me any issues, I'll push it to linux-next in a week or so and then push it to Linus after that.
-- Steve
Quoted 32 lines
--- tools/testing/ktest/ktest.pl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)tools/testing/ktest/ktest.pl +4
-2@@ -1866,9 +1866,10 @@ sub get_grub2_index { or dodie "unable to get $grub_file"; my $found = 0; + my $grub_menu_qt = quotemeta($grub_menu); while (<IN>) { - if (/^menuentry.*$grub_menu/) { + if (/^menuentry.*$grub_menu_qt/) { $grub_number++; $found = 1; last;@@ -1909,9 +1910,10 @@ sub get_grub_index { or dodie "unable to get menu.lst"; my $found = 0; + my $grub_menu_qt = quotemeta($grub_menu); while (<IN>) { - if (/^\s*title\s+$grub_menu\s*$/) { + if (/^\s*title\s+$grub_menu_qt\s*$/) { $grub_number++; $found = 1; last;