xen/pygrub: grub2/grub.cfg from RHEL 7 has new commands in menuentry.
PATCH 1/1 xen/pygrub: grub2/grub.cfg from RHEL 7 has new commands in menuentry.
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).
--- tools/pygrub/src/GrubConf.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
tools/pygrub/src/GrubConf.py +3 -1
@@ -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)
Signature · 1 line
1.7.10.4
Quoted 8 lines · Joby Poriyath
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 <[email protected]>
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
Quoted 19 lines
--- tools/pygrub/src/GrubConf.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)tools/pygrub/src/GrubConf.py +2
-0@@ -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}
tools/pygrub/src/GrubConf.py class Grub2ConfigFile(_GrubConfigFile): · line 399
Quoted 5 lines
tools/pygrub/src/GrubConf.py +1
-1@@ -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
Quoted 8 lines · Andrew Cooper
Quoted 7 lines · Joby Poriyath
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).
Quoted 7 lines
Quoted 1 line
Signed-off-by Joby Poriyath <[email protected]>It is typical to put an example in
tools/pygrub/examplesAlso, 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.
Quoted 21 lines
Quoted 21 lines
--- tools/pygrub/src/GrubConf.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)tools/pygrub/src/GrubConf.py +2
-0@@ -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
Quoted 6 lines
tools/pygrub/src/GrubConf.py class Grub2ConfigFile(_GrubConfigFile): · line 399
Quoted 3 lines
tools/pygrub/src/GrubConf.py +1
-1# 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
Quoted 10 lines · Joby Poriyath
Quoted 9 lines
tools/pygrub/src/GrubConf.py class Grub2ConfigFile(_GrubConfigFile): · line 399
Quoted 6 lines
tools/pygrub/src/GrubConf.py +1
-1@@ -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.
Quoted 5 lines
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.
Quoted 11 lines · Ian Campbell
Quoted 10 lines · Joby Poriyath
Quoted 9 lines
tools/pygrub/src/GrubConf.py class Grub2ConfigFile(_GrubConfigFile): · line 399
Quoted 6 lines
tools/pygrub/src/GrubConf.py +1
-1@@ -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.
Quoted 8 lines
Quoted 5 lines
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
Quoted 6 lines
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
Quoted 14 lines · Joby Poriyath
Quoted 13 lines · Ian Campbell
Quoted 12 lines · Joby Poriyath
Quoted 9 lines
tools/pygrub/src/GrubConf.py class Grub2ConfigFile(_GrubConfigFile): · line 399
Quoted 6 lines
tools/pygrub/src/GrubConf.py +1
-1@@ -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...
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
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...
Quoted 3 lines
Quoted 3 lines
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.
Quoted 4 lines
Quoted 2 lines
Have you run this new regex over
tools/pygrub/examples?I ran this regex over examples.
Great.
Quoted 24 lines · Ian Campbell
Quoted 14 lines · Joby Poriyath
Quoted 13 lines · Ian Campbell
Quoted 12 lines · Joby Poriyath
Quoted 9 lines
tools/pygrub/src/GrubConf.py class Grub2ConfigFile(_GrubConfigFile): · line 399
Quoted 6 lines
tools/pygrub/src/GrubConf.py +1
-1@@ -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...
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
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
Quoted 7 lines
Thanks, pure punctuation is a bit tricky to for a search engine...
Quoted 3 lines
Quoted 3 lines
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
Quoted 32 lines · M A Young
Quoted 30 lines · Ian Campbell
Quoted 14 lines · Joby Poriyath
Quoted 13 lines · Ian Campbell
Quoted 12 lines · Joby Poriyath
Quoted 9 lines
Review class Grub2ConfigFile(_GrubConfigFile): · line 399
Quoted 6 lines
(quoted diff) +1
-1@@ -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...
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
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...
Quoted 3 lines
Quoted 3 lines
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
Quoted 5 lines
Quoted 1 line
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.
Quoted 33 lines · Ian Campbell
Quoted 32 lines · M A Young
Quoted 30 lines · Ian Campbell
Quoted 14 lines · Joby Poriyath
Quoted 13 lines · Ian Campbell
Quoted 12 lines · Joby Poriyath
Quoted 9 lines
Review class Grub2ConfigFile(_GrubConfigFile): · line 399
Quoted 6 lines
(quoted diff) +1
-1@@ -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...
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
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...
Quoted 3 lines
Quoted 3 lines
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
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
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
Quoted 1 line · M A Young
I don't think I ever got around to submitting it upstream
oh ok.
Quoted 2 lines
(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.
Quoted 5 lines · Ian Campbell
Quoted 3 lines
Quoted 3 lines
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.
Quoted 10 lines
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
Quoted 8 lines · Joby Poriyath
Quoted 5 lines · Ian Campbell
Quoted 3 lines
Quoted 3 lines
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
Quoted 2 lines
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.
it is possible to fix it for Oracle Solaris 11.1 ?
-Igor
Quoted 60 lines · Joby Poriyath
Quoted 8 lines · Andrew Cooper
Quoted 7 lines · Joby Poriyath
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).
Quoted 7 lines
Quoted 1 line
Signed-off-by Joby Poriyath <[email protected]>It is typical to put an example in
tools/pygrub/examplesAlso, 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.
Quoted 21 lines
Quoted 21 lines
---
tools/pygrub/src/GrubConf.py| 4 +++-1 file changed, 3 insertions(+), 1 deletion(-)tools/pygrub/src/GrubConf.py +2
-0@@ -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): continueQuoted 6 lines
tools/pygrub/src/GrubConf.py class Grub2ConfigFile(_GrubConfigFile): · line 399
Quoted 3 lines
tools/pygrub/src/GrubConf.py +1
-1# 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
[email protected]
http://lists.xen.org/xen-devel
Quoted 1 line · Igor Kozhukhov
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.