All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xen/pygrub: grub2/grub.cfg from RHEL 7 has new commands in menuentry.
@ 2014-01-30 11:31 Joby Poriyath
  2014-01-30 11:45 ` Andrew Cooper
  0 siblings, 1 reply; 14+ messages in thread
From: Joby Poriyath @ 2014-01-30 11:31 UTC (permalink / raw)
  To: xen-devel; +Cc: Andrew Cooper, Ian Campbell

menuentry in grub2/grub.cfg uses linux16 and initrd16 commands
instead of linux and initrd. Due to this RHEL 7 (beta) guest failed to
boot after the installation.

In addition to this, menuentry has some options as well
(--class red, --class gnu, etc).

Signed-off-by: Joby Poriyath <joby.poriyath@citrix.com>
---
 tools/pygrub/src/GrubConf.py |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/pygrub/src/GrubConf.py b/tools/pygrub/src/GrubConf.py
index cb853c9..974cded 100644
--- a/tools/pygrub/src/GrubConf.py
+++ b/tools/pygrub/src/GrubConf.py
@@ -348,7 +348,9 @@ class Grub2Image(_GrubImage):
                 
     commands = {'set:root': 'root',
                 'linux': 'kernel',
+                'linux16': 'kernel',
                 'initrd': 'initrd',
+                'initrd16': 'initrd',
                 'echo': None,
                 'insmod': None,
                 'search': None}
@@ -394,7 +396,7 @@ class Grub2ConfigFile(_GrubConfigFile):
                 continue
 
             # new image
-            title_match = re.match('^menuentry ["\'](.*)["\'] (.*){', l)
+            title_match = re.match('^menuentry ["\'](.*?)["\'] (.*){', l)
             if title_match:
                 if img is not None:
                     raise RuntimeError, "syntax error: cannot nest menuentry (%d %s)" % (len(img),img)
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH] xen/pygrub: grub2/grub.cfg from RHEL 7 has new commands in menuentry.
  2014-01-30 11:31 [PATCH] xen/pygrub: grub2/grub.cfg from RHEL 7 has new commands in menuentry Joby Poriyath
@ 2014-01-30 11:45 ` Andrew Cooper
  2014-01-30 12:01   ` Joby Poriyath
  0 siblings, 1 reply; 14+ messages in thread
From: Andrew Cooper @ 2014-01-30 11:45 UTC (permalink / raw)
  To: Joby Poriyath; +Cc: Ian Campbell, xen-devel

On 30/01/14 11:31, Joby Poriyath wrote:
> menuentry in grub2/grub.cfg uses linux16 and initrd16 commands
> instead of linux and initrd. Due to this RHEL 7 (beta) guest failed to
> boot after the installation.
>
> In addition to this, menuentry has some options as well
> (--class red, --class gnu, etc).
>
> Signed-off-by: Joby Poriyath <joby.poriyath@citrix.com>

It is typical to put an example in tools/pygrub/examples

Also, you will need to CC George Dunlap and specify why this change
might want a freeze exception to be included in 4.4

> ---
>  tools/pygrub/src/GrubConf.py |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/tools/pygrub/src/GrubConf.py b/tools/pygrub/src/GrubConf.py
> index cb853c9..974cded 100644
> --- a/tools/pygrub/src/GrubConf.py
> +++ b/tools/pygrub/src/GrubConf.py
> @@ -348,7 +348,9 @@ class Grub2Image(_GrubImage):
>                  
>      commands = {'set:root': 'root',
>                  'linux': 'kernel',
> +                'linux16': 'kernel',
>                  'initrd': 'initrd',
> +                'initrd16': 'initrd',
>                  'echo': None,
>                  'insmod': None,
>                  'search': None}
> @@ -394,7 +396,7 @@ class Grub2ConfigFile(_GrubConfigFile):
>                  continue
>  
>              # new image
> -            title_match = re.match('^menuentry ["\'](.*)["\'] (.*){', l)
> +            title_match = re.match('^menuentry ["\'](.*?)["\'] (.*){', l)

Why is this necessary? fedora-19 also have the aformentioned "--class
red, --class gnu" yet is parsed happily.

~Andrew

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] xen/pygrub: grub2/grub.cfg from RHEL 7 has new commands in menuentry.
  2014-01-30 11:45 ` Andrew Cooper
@ 2014-01-30 12:01   ` Joby Poriyath
  2014-01-30 12:07     ` Ian Campbell
  2014-01-30 12:24     ` Igor Kozhukhov
  0 siblings, 2 replies; 14+ messages in thread
From: Joby Poriyath @ 2014-01-30 12:01 UTC (permalink / raw)
  To: Andrew Cooper; +Cc: Ian Campbell, xen-devel

On Thu, Jan 30, 2014 at 11:45:43AM +0000, Andrew Cooper wrote:
> On 30/01/14 11:31, Joby Poriyath wrote:
> > menuentry in grub2/grub.cfg uses linux16 and initrd16 commands
> > instead of linux and initrd. Due to this RHEL 7 (beta) guest failed to
> > boot after the installation.
> >
> > In addition to this, menuentry has some options as well
> > (--class red, --class gnu, etc).
> >
> > Signed-off-by: Joby Poriyath <joby.poriyath@citrix.com>
> 
> It is typical to put an example in tools/pygrub/examples
> 
> Also, you will need to CC George Dunlap and specify why this change
> might want a freeze exception to be included in 4.4
> 
Alright. I'll CC George.

> > ---
> >  tools/pygrub/src/GrubConf.py |    4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/tools/pygrub/src/GrubConf.py b/tools/pygrub/src/GrubConf.py
> > index cb853c9..974cded 100644
> > --- a/tools/pygrub/src/GrubConf.py
> > +++ b/tools/pygrub/src/GrubConf.py
> > @@ -348,7 +348,9 @@ class Grub2Image(_GrubImage):
> >                  
> >      commands = {'set:root': 'root',
> >                  'linux': 'kernel',
> > +                'linux16': 'kernel',
> >                  'initrd': 'initrd',
> > +                'initrd16': 'initrd',
> >                  'echo': None,
> >                  'insmod': None,
> >                  'search': None}
> > @@ -394,7 +396,7 @@ class Grub2ConfigFile(_GrubConfigFile):
> >                  continue
> >  
> >              # new image
> > -            title_match = re.match('^menuentry ["\'](.*)["\'] (.*){', l)
> > +            title_match = re.match('^menuentry ["\'](.*?)["\'] (.*){', l)
> 
> Why is this necessary? fedora-19 also have the aformentioned "--class
> red, --class gnu" yet is parsed happily.

A menuentry from RHEL 7 looks like this...

menuentry 'Red Hat Enterprise Linux Everything, with Linux 0-rescue-af34f0b8cf364cdbbe6d093f8228a37f' --class red --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-0-rescue-af34f0b8cf364cdbbe6d093f8228a37f-advanced-d23b8b49-4cfe-4900-8ef1-ec80bc633163' 

So we need 'lazy' match with '.*?'.

-Joby

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] xen/pygrub: grub2/grub.cfg from RHEL 7 has new commands in menuentry.
  2014-01-30 12:01   ` Joby Poriyath
@ 2014-01-30 12:07     ` Ian Campbell
  2014-01-30 13:02       ` Joby Poriyath
  2014-01-30 12:24     ` Igor Kozhukhov
  1 sibling, 1 reply; 14+ messages in thread
From: Ian Campbell @ 2014-01-30 12:07 UTC (permalink / raw)
  To: Joby Poriyath; +Cc: Andrew Cooper, xen-devel

On Thu, 2014-01-30 at 12:01 +0000, Joby Poriyath wrote:
> > > @@ -394,7 +396,7 @@ class Grub2ConfigFile(_GrubConfigFile):
> > >                  continue
> > >  
> > >              # new image
> > > -            title_match = re.match('^menuentry ["\'](.*)["\'] (.*){', l)
> > > +            title_match = re.match('^menuentry ["\'](.*?)["\'] (.*){', l)
> > 
> > Why is this necessary? fedora-19 also have the aformentioned "--class
> > red, --class gnu" yet is parsed happily.
> 
> A menuentry from RHEL 7 looks like this...
> 
> menuentry 'Red Hat Enterprise Linux Everything, with Linux 0-rescue-af34f0b8cf364cdbbe6d093f8228a37f' --class red --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-0-rescue-af34f0b8cf364cdbbe6d093f8228a37f-advanced-d23b8b49-4cfe-4900-8ef1-ec80bc633163' 
> 
> So we need 'lazy' match with '.*?'.

".*" already matches zero or more characters, so I'm not sure what ".*?"
means in addition to that, do you have a reference?

Perhaps ["\']([^"\']*)["\'] is more accurate (i.e. disallow quotes in
the name itself, although you might have to split into handling " and '
separately to be more correct

Have you run this new regex over tools/pygrub/examples?

Ian.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] xen/pygrub: grub2/grub.cfg from RHEL 7 has new commands in menuentry.
  2014-01-30 12:01   ` Joby Poriyath
  2014-01-30 12:07     ` Ian Campbell
@ 2014-01-30 12:24     ` Igor Kozhukhov
  2014-01-30 12:28       ` Ian Campbell
  1 sibling, 1 reply; 14+ messages in thread
From: Igor Kozhukhov @ 2014-01-30 12:24 UTC (permalink / raw)
  To: Joby Poriyath; +Cc: Andrew Cooper, Ian Campbell, xen-devel


it is possible to fix it for Oracle Solaris 11.1 ?

-Igor

On Jan 30, 2014, at 4:01 PM, Joby Poriyath wrote:

> On Thu, Jan 30, 2014 at 11:45:43AM +0000, Andrew Cooper wrote:
>> On 30/01/14 11:31, Joby Poriyath wrote:
>>> menuentry in grub2/grub.cfg uses linux16 and initrd16 commands
>>> instead of linux and initrd. Due to this RHEL 7 (beta) guest failed to
>>> boot after the installation.
>>> 
>>> In addition to this, menuentry has some options as well
>>> (--class red, --class gnu, etc).
>>> 
>>> Signed-off-by: Joby Poriyath <joby.poriyath@citrix.com>
>> 
>> It is typical to put an example in tools/pygrub/examples
>> 
>> Also, you will need to CC George Dunlap and specify why this change
>> might want a freeze exception to be included in 4.4
>> 
> Alright. I'll CC George.
> 
>>> ---
>>> tools/pygrub/src/GrubConf.py |    4 +++-
>>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>> 
>>> diff --git a/tools/pygrub/src/GrubConf.py b/tools/pygrub/src/GrubConf.py
>>> index cb853c9..974cded 100644
>>> --- a/tools/pygrub/src/GrubConf.py
>>> +++ b/tools/pygrub/src/GrubConf.py
>>> @@ -348,7 +348,9 @@ class Grub2Image(_GrubImage):
>>> 
>>>     commands = {'set:root': 'root',
>>>                 'linux': 'kernel',
>>> +                'linux16': 'kernel',
>>>                 'initrd': 'initrd',
>>> +                'initrd16': 'initrd',
>>>                 'echo': None,
>>>                 'insmod': None,
>>>                 'search': None}
>>> @@ -394,7 +396,7 @@ class Grub2ConfigFile(_GrubConfigFile):
>>>                 continue
>>> 
>>>             # new image
>>> -            title_match = re.match('^menuentry ["\'](.*)["\'] (.*){', l)
>>> +            title_match = re.match('^menuentry ["\'](.*?)["\'] (.*){', l)
>> 
>> Why is this necessary? fedora-19 also have the aformentioned "--class
>> red, --class gnu" yet is parsed happily.
> 
> A menuentry from RHEL 7 looks like this...
> 
> menuentry 'Red Hat Enterprise Linux Everything, with Linux 0-rescue-af34f0b8cf364cdbbe6d093f8228a37f' --class red --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-0-rescue-af34f0b8cf364cdbbe6d093f8228a37f-advanced-d23b8b49-4cfe-4900-8ef1-ec80bc633163' 
> 
> So we need 'lazy' match with '.*?'.
> 
> -Joby
> 
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] xen/pygrub: grub2/grub.cfg from RHEL 7 has new commands in menuentry.
  2014-01-30 12:24     ` Igor Kozhukhov
@ 2014-01-30 12:28       ` Ian Campbell
  0 siblings, 0 replies; 14+ messages in thread
From: Ian Campbell @ 2014-01-30 12:28 UTC (permalink / raw)
  To: Igor Kozhukhov; +Cc: Andrew Cooper, Joby Poriyath, xen-devel

On Thu, 2014-01-30 at 16:24 +0400, Igor Kozhukhov wrote:
> it is possible to fix it for Oracle Solaris 11.1 ?

If you send a patch then sure. At the very minimum please patch an
example of the syntax used by Solaris into tools/pygrub/examples.

Ian.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] xen/pygrub: grub2/grub.cfg from RHEL 7 has new commands in menuentry.
  2014-01-30 12:07     ` Ian Campbell
@ 2014-01-30 13:02       ` Joby Poriyath
  2014-01-30 14:06         ` Ian Campbell
  0 siblings, 1 reply; 14+ messages in thread
From: Joby Poriyath @ 2014-01-30 13:02 UTC (permalink / raw)
  To: Ian Campbell; +Cc: Andrew Cooper, xen-devel

On Thu, Jan 30, 2014 at 12:07:34PM +0000, Ian Campbell wrote:
> On Thu, 2014-01-30 at 12:01 +0000, Joby Poriyath wrote:
> > > > @@ -394,7 +396,7 @@ class Grub2ConfigFile(_GrubConfigFile):
> > > >                  continue
> > > >  
> > > >              # new image
> > > > -            title_match = re.match('^menuentry ["\'](.*)["\'] (.*){', l)
> > > > +            title_match = re.match('^menuentry ["\'](.*?)["\'] (.*){', l)
> > > 
> > > Why is this necessary? fedora-19 also have the aformentioned "--class
> > > red, --class gnu" yet is parsed happily.
> > 
> > A menuentry from RHEL 7 looks like this...
> > 
> > menuentry 'Red Hat Enterprise Linux Everything, with Linux 0-rescue-af34f0b8cf364cdbbe6d093f8228a37f' --class red --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-0-rescue-af34f0b8cf364cdbbe6d093f8228a37f-advanced-d23b8b49-4cfe-4900-8ef1-ec80bc633163' 
> > 
> > So we need 'lazy' match with '.*?'.
> 
> ".*" already matches zero or more characters, so I'm not sure what ".*?"
> means in addition to that, do you have a reference?

http://docs.python.org/2/howto/regex.html#greedy-versus-non-greedy

> 
> Perhaps ["\']([^"\']*)["\'] is more accurate (i.e. disallow quotes in
> the name itself, although you might have to split into handling " and '
> separately to be more correct
> 
> Have you run this new regex over tools/pygrub/examples?

I ran this regex over examples. 

Thanks,
Joby

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] xen/pygrub: grub2/grub.cfg from RHEL 7 has new commands in menuentry.
  2014-01-30 13:02       ` Joby Poriyath
@ 2014-01-30 14:06         ` Ian Campbell
  2014-01-30 14:32           ` M A Young
  2014-01-30 14:55           ` Joby Poriyath
  0 siblings, 2 replies; 14+ messages in thread
From: Ian Campbell @ 2014-01-30 14:06 UTC (permalink / raw)
  To: Joby Poriyath; +Cc: Andrew Cooper, xen-devel

On Thu, 2014-01-30 at 13:02 +0000, Joby Poriyath wrote:
> On Thu, Jan 30, 2014 at 12:07:34PM +0000, Ian Campbell wrote:
> > On Thu, 2014-01-30 at 12:01 +0000, Joby Poriyath wrote:
> > > > > @@ -394,7 +396,7 @@ class Grub2ConfigFile(_GrubConfigFile):
> > > > >                  continue
> > > > >  
> > > > >              # new image
> > > > > -            title_match = re.match('^menuentry ["\'](.*)["\'] (.*){', l)
> > > > > +            title_match = re.match('^menuentry ["\'](.*?)["\'] (.*){', l)
> > > > 
> > > > Why is this necessary? fedora-19 also have the aformentioned "--class
> > > > red, --class gnu" yet is parsed happily.
> > > 
> > > A menuentry from RHEL 7 looks like this...
> > > 
> > > menuentry 'Red Hat Enterprise Linux Everything, with Linux 0-rescue-af34f0b8cf364cdbbe6d093f8228a37f' --class red --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-0-rescue-af34f0b8cf364cdbbe6d093f8228a37f-advanced-d23b8b49-4cfe-4900-8ef1-ec80bc633163' 
> > > 
> > > So we need 'lazy' match with '.*?'.
> > 
> > ".*" already matches zero or more characters, so I'm not sure what ".*?"
> > means in addition to that, do you have a reference?
> 
> http://docs.python.org/2/howto/regex.html#greedy-versus-non-greedy

Thanks, pure punctuation is a bit tricky to for a search engine...

> > Perhaps ["\']([^"\']*)["\'] is more accurate (i.e. disallow quotes in
> > the name itself, although you might have to split into handling " and '
> > separately to be more correct

Any thoughts on this?

I suppose it depends a bit on the rules for mixing quotes in grub, e.g.
is
	menuentry "Ian's super cool Linux"

allowed.

On the other hand pygrub is very much best effort so as long as it works
with the current set of inputs which we are aware of then .*? is fine.

> > 
> > Have you run this new regex over tools/pygrub/examples?
> 
> I ran this regex over examples. 

Great.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] xen/pygrub: grub2/grub.cfg from RHEL 7 has new commands in menuentry.
  2014-01-30 14:06         ` Ian Campbell
@ 2014-01-30 14:32           ` M A Young
  2014-01-30 14:38             ` Ian Campbell
  2014-01-30 14:55           ` Joby Poriyath
  1 sibling, 1 reply; 14+ messages in thread
From: M A Young @ 2014-01-30 14:32 UTC (permalink / raw)
  To: Ian Campbell; +Cc: Andrew Cooper, Joby Poriyath, xen-devel

On Thu, 30 Jan 2014, Ian Campbell wrote:

> On Thu, 2014-01-30 at 13:02 +0000, Joby Poriyath wrote:
>> On Thu, Jan 30, 2014 at 12:07:34PM +0000, Ian Campbell wrote:
>>> On Thu, 2014-01-30 at 12:01 +0000, Joby Poriyath wrote:
>>>>>> @@ -394,7 +396,7 @@ class Grub2ConfigFile(_GrubConfigFile):
>>>>>>                  continue
>>>>>>
>>>>>>              # new image
>>>>>> -            title_match = re.match('^menuentry ["\'](.*)["\'] (.*){', l)
>>>>>> +            title_match = re.match('^menuentry ["\'](.*?)["\'] (.*){', l)
>>>>>
>>>>> Why is this necessary? fedora-19 also have the aformentioned "--class
>>>>> red, --class gnu" yet is parsed happily.
>>>>
>>>> A menuentry from RHEL 7 looks like this...
>>>>
>>>> menuentry 'Red Hat Enterprise Linux Everything, with Linux 0-rescue-af34f0b8cf364cdbbe6d093f8228a37f' --class red --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-0-rescue-af34f0b8cf364cdbbe6d093f8228a37f-advanced-d23b8b49-4cfe-4900-8ef1-ec80bc633163'
>>>>
>>>> So we need 'lazy' match with '.*?'.
>>>
>>> ".*" already matches zero or more characters, so I'm not sure what ".*?"
>>> means in addition to that, do you have a reference?
>>
>> http://docs.python.org/2/howto/regex.html#greedy-versus-non-greedy
>
> Thanks, pure punctuation is a bit tricky to for a search engine...
>
>>> Perhaps ["\']([^"\']*)["\'] is more accurate (i.e. disallow quotes in
>>> the name itself, although you might have to split into handling " and '
>>> separately to be more correct
>
> Any thoughts on this?

I went for ["\']([^"\']*)["\'] in a patch I added to Fedora pygrub in May 
last year. That seems to work fine for recent Fedora versions which will 
be somewhat similar to RHEL 7.

 	Michael Young

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] xen/pygrub: grub2/grub.cfg from RHEL 7 has new commands in menuentry.
  2014-01-30 14:32           ` M A Young
@ 2014-01-30 14:38             ` Ian Campbell
  2014-01-30 14:43               ` M A Young
  0 siblings, 1 reply; 14+ messages in thread
From: Ian Campbell @ 2014-01-30 14:38 UTC (permalink / raw)
  To: M A Young; +Cc: Andrew Cooper, Joby Poriyath, xen-devel

On Thu, 2014-01-30 at 14:32 +0000, M A Young wrote:
> On Thu, 30 Jan 2014, Ian Campbell wrote:
> 
> > On Thu, 2014-01-30 at 13:02 +0000, Joby Poriyath wrote:
> >> On Thu, Jan 30, 2014 at 12:07:34PM +0000, Ian Campbell wrote:
> >>> On Thu, 2014-01-30 at 12:01 +0000, Joby Poriyath wrote:
> >>>>>> @@ -394,7 +396,7 @@ class Grub2ConfigFile(_GrubConfigFile):
> >>>>>>                  continue
> >>>>>>
> >>>>>>              # new image
> >>>>>> -            title_match = re.match('^menuentry ["\'](.*)["\'] (.*){', l)
> >>>>>> +            title_match = re.match('^menuentry ["\'](.*?)["\'] (.*){', l)
> >>>>>
> >>>>> Why is this necessary? fedora-19 also have the aformentioned "--class
> >>>>> red, --class gnu" yet is parsed happily.
> >>>>
> >>>> A menuentry from RHEL 7 looks like this...
> >>>>
> >>>> menuentry 'Red Hat Enterprise Linux Everything, with Linux 0-rescue-af34f0b8cf364cdbbe6d093f8228a37f' --class red --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-0-rescue-af34f0b8cf364cdbbe6d093f8228a37f-advanced-d23b8b49-4cfe-4900-8ef1-ec80bc633163'
> >>>>
> >>>> So we need 'lazy' match with '.*?'.
> >>>
> >>> ".*" already matches zero or more characters, so I'm not sure what ".*?"
> >>> means in addition to that, do you have a reference?
> >>
> >> http://docs.python.org/2/howto/regex.html#greedy-versus-non-greedy
> >
> > Thanks, pure punctuation is a bit tricky to for a search engine...
> >
> >>> Perhaps ["\']([^"\']*)["\'] is more accurate (i.e. disallow quotes in
> >>> the name itself, although you might have to split into handling " and '
> >>> separately to be more correct
> >
> > Any thoughts on this?
> 
> I went for ["\']([^"\']*)["\'] in a patch I added to Fedora pygrub in May 
> last year. That seems to work fine for recent Fedora versions which will 
> be somewhat similar to RHEL 7.

Oops, sorry, did I manage to drop that patch on the ground?

Ian.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] xen/pygrub: grub2/grub.cfg from RHEL 7 has new commands in menuentry.
  2014-01-30 14:38             ` Ian Campbell
@ 2014-01-30 14:43               ` M A Young
  2014-01-30 14:45                 ` Ian Campbell
  0 siblings, 1 reply; 14+ messages in thread
From: M A Young @ 2014-01-30 14:43 UTC (permalink / raw)
  To: Ian Campbell; +Cc: Andrew Cooper, Joby Poriyath, xen-devel

On Thu, 30 Jan 2014, Ian Campbell wrote:

> On Thu, 2014-01-30 at 14:32 +0000, M A Young wrote:
>> On Thu, 30 Jan 2014, Ian Campbell wrote:
>>
>>> On Thu, 2014-01-30 at 13:02 +0000, Joby Poriyath wrote:
>>>> On Thu, Jan 30, 2014 at 12:07:34PM +0000, Ian Campbell wrote:
>>>>> On Thu, 2014-01-30 at 12:01 +0000, Joby Poriyath wrote:
>>>>>>>> @@ -394,7 +396,7 @@ class Grub2ConfigFile(_GrubConfigFile):
>>>>>>>>                  continue
>>>>>>>>
>>>>>>>>              # new image
>>>>>>>> -            title_match = re.match('^menuentry ["\'](.*)["\'] (.*){', l)
>>>>>>>> +            title_match = re.match('^menuentry ["\'](.*?)["\'] (.*){', l)
>>>>>>>
>>>>>>> Why is this necessary? fedora-19 also have the aformentioned "--class
>>>>>>> red, --class gnu" yet is parsed happily.
>>>>>>
>>>>>> A menuentry from RHEL 7 looks like this...
>>>>>>
>>>>>> menuentry 'Red Hat Enterprise Linux Everything, with Linux 0-rescue-af34f0b8cf364cdbbe6d093f8228a37f' --class red --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-0-rescue-af34f0b8cf364cdbbe6d093f8228a37f-advanced-d23b8b49-4cfe-4900-8ef1-ec80bc633163'
>>>>>>
>>>>>> So we need 'lazy' match with '.*?'.
>>>>>
>>>>> ".*" already matches zero or more characters, so I'm not sure what ".*?"
>>>>> means in addition to that, do you have a reference?
>>>>
>>>> http://docs.python.org/2/howto/regex.html#greedy-versus-non-greedy
>>>
>>> Thanks, pure punctuation is a bit tricky to for a search engine...
>>>
>>>>> Perhaps ["\']([^"\']*)["\'] is more accurate (i.e. disallow quotes in
>>>>> the name itself, although you might have to split into handling " and '
>>>>> separately to be more correct
>>>
>>> Any thoughts on this?
>>
>> I went for ["\']([^"\']*)["\'] in a patch I added to Fedora pygrub in May
>> last year. That seems to work fine for recent Fedora versions which will
>> be somewhat similar to RHEL 7.
>
> Oops, sorry, did I manage to drop that patch on the ground?

I don't think I ever got around to submitting it upstream (there may be 
other patches in my Fedora build that could go upstream as well).

 	Michael Young

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] xen/pygrub: grub2/grub.cfg from RHEL 7 has new commands in menuentry.
  2014-01-30 14:43               ` M A Young
@ 2014-01-30 14:45                 ` Ian Campbell
  0 siblings, 0 replies; 14+ messages in thread
From: Ian Campbell @ 2014-01-30 14:45 UTC (permalink / raw)
  To: M A Young; +Cc: Andrew Cooper, Joby Poriyath, xen-devel

On Thu, 2014-01-30 at 14:43 +0000, M A Young wrote:
> I don't think I ever got around to submitting it upstream

oh ok.

>  (there may be 
> other patches in my Fedora build that could go upstream as well).

Please do, especially if there are any which you think would be
important for 4.4 (rc3 due soon, so judge the criticality as
appropriate...)

Ian.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] xen/pygrub: grub2/grub.cfg from RHEL 7 has new commands in menuentry.
  2014-01-30 14:06         ` Ian Campbell
  2014-01-30 14:32           ` M A Young
@ 2014-01-30 14:55           ` Joby Poriyath
  2014-01-30 15:00             ` Ian Campbell
  1 sibling, 1 reply; 14+ messages in thread
From: Joby Poriyath @ 2014-01-30 14:55 UTC (permalink / raw)
  To: Ian Campbell; +Cc: Andrew Cooper, xen-devel

On Thu, Jan 30, 2014 at 02:06:58PM +0000, Ian Campbell wrote:
> > > Perhaps ["\']([^"\']*)["\'] is more accurate (i.e. disallow quotes in
> > > the name itself, although you might have to split into handling " and '
> > > separately to be more correct
> 
> Any thoughts on this?

The two regexes seems to be equivalent. My only worry with '.*?' was 
compatibility with older python. Luckily, it's supported in Python 2.2 
and later.

> 
> I suppose it depends a bit on the rules for mixing quotes in grub, e.g.
> is
> 	menuentry "Ian's super cool Linux"
> 
> allowed.
> 
> On the other hand pygrub is very much best effort so as long as it works
> with the current set of inputs which we are aware of then .*? is fine.
> 

Ok.

Should I send an updated patch along with an example of RHEL 7 grub.cfg
or is this patch acceptable as it is?

Thanks,
Joby

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] xen/pygrub: grub2/grub.cfg from RHEL 7 has new commands in menuentry.
  2014-01-30 14:55           ` Joby Poriyath
@ 2014-01-30 15:00             ` Ian Campbell
  0 siblings, 0 replies; 14+ messages in thread
From: Ian Campbell @ 2014-01-30 15:00 UTC (permalink / raw)
  To: Joby Poriyath; +Cc: Andrew Cooper, xen-devel

On Thu, 2014-01-30 at 14:55 +0000, Joby Poriyath wrote:
> On Thu, Jan 30, 2014 at 02:06:58PM +0000, Ian Campbell wrote:
> > > > Perhaps ["\']([^"\']*)["\'] is more accurate (i.e. disallow quotes in
> > > > the name itself, although you might have to split into handling " and '
> > > > separately to be more correct
> > 
> > Any thoughts on this?
> 
> The two regexes seems to be equivalent.

OK

> Should I send an updated patch along with an example of RHEL 7 grub.cfg
> or is this patch acceptable as it is?

Yes, please send an updated patch with the example added and CC George +
make a case for a release exception.

Ian.

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2014-01-30 15:00 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-30 11:31 [PATCH] xen/pygrub: grub2/grub.cfg from RHEL 7 has new commands in menuentry Joby Poriyath
2014-01-30 11:45 ` Andrew Cooper
2014-01-30 12:01   ` Joby Poriyath
2014-01-30 12:07     ` Ian Campbell
2014-01-30 13:02       ` Joby Poriyath
2014-01-30 14:06         ` Ian Campbell
2014-01-30 14:32           ` M A Young
2014-01-30 14:38             ` Ian Campbell
2014-01-30 14:43               ` M A Young
2014-01-30 14:45                 ` Ian Campbell
2014-01-30 14:55           ` Joby Poriyath
2014-01-30 15:00             ` Ian Campbell
2014-01-30 12:24     ` Igor Kozhukhov
2014-01-30 12:28       ` Ian Campbell

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.