[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] xen/pygrub: grub2/grub.cfg from RHEL 7 has new commands in menuentry.



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

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.