* [PATCH] ktest: Add support for meta characters in GRUB_MENU
@ 2019-04-17 20:11 Masayoshi Mizuma
2019-04-17 20:17 ` Steven Rostedt
2019-04-17 20:52 ` Randy Dunlap
0 siblings, 2 replies; 4+ messages in thread
From: Masayoshi Mizuma @ 2019-04-17 20:11 UTC (permalink / raw)
To: Steven Rostedt; +Cc: Masayoshi Mizuma, Masayoshi Mizuma, linux-kernel
From: Masayoshi Mizuma <m.mizuma@jp.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.
Signed-off-by: Masayoshi Mizuma <m.mizuma@jp.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;
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ktest: Add support for meta characters in GRUB_MENU
2019-04-17 20:11 [PATCH] ktest: Add support for meta characters in GRUB_MENU Masayoshi Mizuma
@ 2019-04-17 20:17 ` Steven Rostedt
2019-04-17 20:35 ` Masayoshi Mizuma
2019-04-17 20:52 ` Randy Dunlap
1 sibling, 1 reply; 4+ messages in thread
From: Steven Rostedt @ 2019-04-17 20:17 UTC (permalink / raw)
To: Masayoshi Mizuma; +Cc: Masayoshi Mizuma, linux-kernel
On Wed, 17 Apr 2019 16:11:14 -0400
Masayoshi Mizuma <msys.mizuma@gmail.com> wrote:
> From: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
>
> ktest fails if meta characters are in GRUB_MENU, for example
> GRUB_MENU = 'Fedora (test)'
>
Thanks for the patch! One little nit below though.
> 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.
>
> Signed-off-by: Masayoshi Mizuma <m.mizuma@jp.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);
I'd like to avoid names that start with underscore. Could you call this:
$grub_menu_qt
or something similar, to be a bit more descriptive of what the variable
is.
Thanks!
-- Steve
>
> 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;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ktest: Add support for meta characters in GRUB_MENU
2019-04-17 20:17 ` Steven Rostedt
@ 2019-04-17 20:35 ` Masayoshi Mizuma
0 siblings, 0 replies; 4+ messages in thread
From: Masayoshi Mizuma @ 2019-04-17 20:35 UTC (permalink / raw)
To: Steven Rostedt; +Cc: Masayoshi Mizuma, linux-kernel
On Wed, Apr 17, 2019 at 04:17:39PM -0400, Steven Rostedt wrote:
> On Wed, 17 Apr 2019 16:11:14 -0400
> Masayoshi Mizuma <msys.mizuma@gmail.com> wrote:
>
> > From: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
> >
> > ktest fails if meta characters are in GRUB_MENU, for example
> > GRUB_MENU = 'Fedora (test)'
> >
>
> Thanks for the patch! One little nit below though.
>
> > 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.
> >
> > Signed-off-by: Masayoshi Mizuma <m.mizuma@jp.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);
>
> I'd like to avoid names that start with underscore. Could you call this:
>
> $grub_menu_qt
>
> or something similar, to be a bit more descriptive of what the variable
> is.
Thank you for your review! I'll fix it and post the v2.
Thanks!
Masa
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ktest: Add support for meta characters in GRUB_MENU
2019-04-17 20:11 [PATCH] ktest: Add support for meta characters in GRUB_MENU Masayoshi Mizuma
2019-04-17 20:17 ` Steven Rostedt
@ 2019-04-17 20:52 ` Randy Dunlap
1 sibling, 0 replies; 4+ messages in thread
From: Randy Dunlap @ 2019-04-17 20:52 UTC (permalink / raw)
To: Masayoshi Mizuma, Steven Rostedt; +Cc: Masayoshi Mizuma, linux-kernel
On 4/17/19 1:11 PM, Masayoshi Mizuma wrote:
> From: Masayoshi Mizuma <m.mizuma@jp.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@jp.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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-04-17 20:52 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-17 20:11 [PATCH] ktest: Add support for meta characters in GRUB_MENU Masayoshi Mizuma
2019-04-17 20:17 ` Steven Rostedt
2019-04-17 20:35 ` Masayoshi Mizuma
2019-04-17 20:52 ` Randy Dunlap
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.