[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, 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-greedyThanks, 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 correctAny 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 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |