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

Re: [Xen-devel] [PATCH] pygrub: Add option to list grub entries

>>> On 10/25/2012 at 09:02 AM, in message
<20617.21621.886298.796143@xxxxxxxxxxxxxxxxxxxxxxxx>, Ian Jackson
<Ian.Jackson@xxxxxxxxxxxxx> wrote: 
> Charles Arnold writes ("[Xen-devel]  [PATCH] pygrub: Add option to list grub 
> entries"):
>> pygrub: Add option to list grub entries
>> The argument to "--entry" allows 2 syntaxes, either directly the entry number
>> in menu.lst, or the whole string behind the "title" key word. This poses the
>> following issue:
>> >From Dom0 there is no way to guess the number and, or the complete title
>> string because this string contains the kernel version, which will change
>> with a kernel update.
>> This patch adds [-l|--list-entries] as an argument to pygrub.
>> +    if list_entries:
>> +        for i in range(len(g.cf.images)):
>> +            img = g.cf.images[i]
>> +            print "title: %s" % img.title
>> +            print "  root: %s" % img.root
>> +            print "  kernel: %s" % img.kernel[1]
>> +            print "  args: %s" % img.args
>> +            print "  initrd: %s" % img.initrd[1]
> Is it possible for any of these to contain newlines ?  I don't think
> so but I'm not entirely sure.  If it is then they need to be quoted
> somehow or the caller may be unable to unambigously parse the output.
> Ian.

No, newlines in the menu.lst / grub.cfg files are treated as terminating
characters for each entry option.  Nothing I've read in the grub specification
indicates that the entries can be wrapped with an escaped newline character.
My attempts to force a newline character in an entry always fails.  The
parsing code in GrubConf.py splits the config file at all newlines.

- Charles

Xen-devel mailing list



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