# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID c7550ed2ccbf0c2498591c2a878cb6068f573982
# Parent a861cbd578f28df80e87c9f4e1ed1f33882f3da4
pygrub currently takes a file on the command line to mean a config file
if it can't figure out partitions and filesystems. This then makes it
balloon to absurd sizes. Make this only happen if you pass a debugging
flag
Signed-off-by: Jeremy Katz <katzj@xxxxxxxxxx>
diff -r a861cbd578f2 -r c7550ed2ccbf tools/pygrub/src/pygrub
--- a/tools/pygrub/src/pygrub Sun Feb 26 09:53:18 2006
+++ b/tools/pygrub/src/pygrub Sun Feb 26 09:54:06 2006
@@ -94,11 +94,17 @@
return struct.unpack("<L", buf[poff+8:poff+12])[0] * SECTOR_SIZE
return -1
-def get_config(fn):
+def get_config(fn, isconfig = False):
if not os.access(fn, os.R_OK):
raise RuntimeError, "Unable to access %s" %(fn,)
cf = grub.GrubConf.GrubConfigFile()
+
+ if isconfig:
+ # set the config file and parse it
+ cf.filename = fn
+ cf.parse()
+ return cf
offset = 0
if is_disk_image(fn):
@@ -130,9 +136,7 @@
# then parse the grub config
cf.parse(buf)
else:
- # set the config file and parse it
- cf.filename = fn
- cf.parse()
+ raise RuntimeError, "Unable to read filesystem"
return cf
@@ -214,7 +218,8 @@
try:
opts, args = getopt.gnu_getopt(sys.argv[1:], 'qh::',
- ["quiet", "help", "output=", "entry="])
+ ["quiet", "help", "output=", "entry=",
+ "isconfig"])
except getopt.GetoptError:
usage()
sys.exit(1)
@@ -227,6 +232,7 @@
output = None
entry = None
interactive = True
+ isconfig = False
for o, a in opts:
if o in ("-q", "--quiet"):
interactive = False
@@ -239,13 +245,15 @@
entry = a
# specifying the entry to boot implies non-interactive
interactive = False
+ elif o in ("--isconfig",):
+ isconfig = True
if output is None or output == "-":
fd = sys.stdout.fileno()
else:
fd = os.open(output, os.O_WRONLY)
- cf = get_config(file)
+ cf = get_config(file, isconfig)
if interactive:
curses.wrapper(run_main)
else:
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|