Commit 68911069 authored by Masayoshi Mizuma's avatar Masayoshi Mizuma Committed by Steven Rostedt (VMware)
Browse files

ktest: Add support for meta characters in GRUB_MENU

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: default avatarMasayoshi Mizuma <m.mizuma@jp.fujitsu.com>
Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
parent fca797f1
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -1878,9 +1878,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;
@@ -1921,9 +1922,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;