diff options
author | Masayoshi Mizuma <m.mizuma@jp.fujitsu.com> | 2019-04-17 19:58:23 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-01-18 11:30:52 +0100 |
commit | 80295824e15fe76fed575000831fef80cb913758 (patch) | |
tree | 52507bf7931a678ced9375865ddf358a2b0c2e95 /tools | |
parent | 7795d8f10ecaaf9476fe4102c4e9ceb95bf424dd (diff) | |
download | linux-stable-80295824e15fe76fed575000831fef80cb913758.tar.gz linux-stable-80295824e15fe76fed575000831fef80cb913758.tar.bz2 linux-stable-80295824e15fe76fed575000831fef80cb913758.zip |
ktest: Add support for meta characters in GRUB_MENU
[ Upstream commit 68911069f509ba3bf0f513d9af00309e07932906 ]
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.
Link: http://lkml.kernel.org/r/20190417235823.18176-1-msys.mizuma@gmail.com
Signed-off-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Stable-dep-of: 26df05a8c142 ("kest.pl: Fix grub2 menu handling for rebooting")
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/testing/ktest/ktest.pl | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl index 92663d123be1..635121ecf543 100755 --- a/tools/testing/ktest/ktest.pl +++ b/tools/testing/ktest/ktest.pl @@ -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; |