[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <3af6075b-60e2-5ed2-5cd2-7d6850dbafbc@infradead.org>
Date: Wed, 17 Apr 2019 13:52:11 -0700
From: Randy Dunlap <rdunlap@...radead.org>
To: Masayoshi Mizuma <msys.mizuma@...il.com>,
Steven Rostedt <rostedt@...dmis.org>
Cc: Masayoshi Mizuma <m.mizuma@...fujitsu.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ktest: Add support for meta characters in GRUB_MENU
On 4/17/19 1:11 PM, Masayoshi Mizuma wrote:
> From: Masayoshi Mizuma <m.mizuma@...fujitsu.com>
>
> 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 quotameta() to escape the meta characters.
Use quotemeta()
>
> Signed-off-by: Masayoshi Mizuma <m.mizuma@...fujitsu.com>
> ---
> tools/testing/ktest/ktest.pl | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
> index 87af8a68ab25..ea07d43856b8 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 = quotemeta($grub_menu);
>
> while (<IN>) {
> - if (/^menuentry.*$grub_menu/) {
> + if (/^menuentry.*$_grub_menu/) {
> $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 = quotemeta($grub_menu);
>
> while (<IN>) {
> - if (/^\s*title\s+$grub_menu\s*$/) {
> + if (/^\s*title\s+$_grub_menu\s*$/) {
> $grub_number++;
> $found = 1;
> last;
>
--
~Randy
Powered by blists - more mailing lists