qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Richard W.M. Jones" <rjones@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: QEMU Development <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] Writing a C library to generate qemu command lines and configuration files
Date: Tue, 2 May 2017 15:59:13 +0100	[thread overview]
Message-ID: <20170502145913.GF16511@redhat.com> (raw)
In-Reply-To: <87y3ufjpsr.fsf@dusky.pond.sub.org>

On Tue, May 02, 2017 at 04:28:52PM +0200, Markus Armbruster wrote:
> > * Is comma-quoting (ie. doubling any commas) sufficient?  Or are there
> >   other forms of quoting?  A quick look at options parsing in qemu
> >   doesn't show any.
> 
> A quick look at QemuOpts will at best confuse, and possibly deceive.
> 
> The beginnings of its replacement in util/keyval.c comes with a *gasp*
> grammar.  It doesn't have all of QemuOpts bells & whistles, at least not
> yet.  You might find it useful anyway.
> 
> To answer your question: you have to double comma after '=', or else it
> terminates the value.  There is no other quoting.

Hmm, is that really right?  It seems to me that any comma must be
doubled.  For example:

$ qemu-system-x86_64 -name foo,bar -writeconfig - -hda die
qemu-system-x86_64: -name foo,bar: Invalid parameter 'bar'

$ qemu-system-x86_64 -name foo,,bar -writeconfig - -hda die
# qemu config file

[name]
  guest = "foo,bar"

qemu-system-x86_64: -hda die: Could not open 'die': No such file or directory

--- Or:

$ qemu-system-x86_64 -drive file=foo,,bar -writeconfig - 
# qemu config file

[drive]
  file = "foo,bar"

qemu-system-x86_64: -drive file=foo,,bar: Could not open 'foo,bar': No such file or directory

> > * From the point of view of a client generating command lines, is there
> >   any significance to dotted names (eg. ‘-drive file.driver=ssh,...’)
> 
> Right now, you can still pretend dotted names are just names.
> 
> But option arguments have really become trees.  We've shoehorned them
> into the existing command line syntax with dotted keys.  Design
> discussion, if you're interested:
> 
>     Subject: Non-flat command line option argument syntax
>     Message-ID: <87bmukmlau.fsf@dusky.pond.sub.org>
>     https://lists.gnu.org/archive/html/qemu-devel/2017-02/msg00555.html
>
> Implementation is the keyval.c mentioned above.
> 
> I'm not sure baking "option argument is a list of (key, string) pairs,
> where both key and string are strings" into your library now is a good
> idea.  Perhaps it would be better to embrace "option argument is a tree"
> from the start.

OK, I'll think about that.

> In the longer run, I intend to make -readconfig (or its replacement)
> accept JSON, because it supports trees directly, and is less badly
> defined.

And JSON actually thinks about quoting too :-)

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org

  reply	other threads:[~2017-05-02 14:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-02  8:35 [Qemu-devel] Writing a C library to generate qemu command lines and configuration files Richard W.M. Jones
2017-05-02 14:28 ` Markus Armbruster
2017-05-02 14:59   ` Richard W.M. Jones [this message]
2017-05-02 15:54     ` Paolo Bonzini
2017-05-02 16:37       ` Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170502145913.GF16511@redhat.com \
    --to=rjones@redhat.com \
    --cc=armbru@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).