qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: jcody@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH v3 1/6] qemu-option: has_help_option() and is_valid_option_list()
Date: Mon, 24 Feb 2014 10:42:26 +0100	[thread overview]
Message-ID: <20140224094226.GC3775@dhcp-200-207.str.redhat.com> (raw)
In-Reply-To: <87bnxw6gws.fsf@blackfin.pond.sub.org>

Am 24.02.2014 um 09:42 hat Markus Armbruster geschrieben:
> Kevin Wolf <kwolf@redhat.com> writes:
> 
> > Am 21.02.2014 um 21:22 hat Eric Blake geschrieben:
> >> On 02/21/2014 08:24 AM, Kevin Wolf wrote:
> >> > has_help_option() checks if any help option ('help' or '?') occurs
> >> > anywhere in an option string, so that things like 'cluster_size=4k,help'
> >> > are recognised.
> >> > 
> >> > is_valid_option_list() ensures that the option list doesn't have options
> >> > with leading commas or trailing unescaped commas.
> 
> Care to explain why these are bad?  I dimly remember Eric and you
> discussing it last week, but I sure won't next time I look at this
> code...

Because with them you can trick qemu-img into producing escaped commas
when it tries to concatenate option strings ('-o backing_file=foo, -o
help' results in '-o backing_file=foo,,help').

> >> Rejects empty options, but also rejects values beginning with a comma.
> >> But we have legacy users that accept implicitly named first options (see
> >> opts_do_parse()).  For example, this is a valid command line (albeit one
> >> that prints a list of valid machines):
> >> 
> >> qemu-kvm -machine ,,blah
> >> 
> >> as shorthand for
> >> 
> >> qemu-kvm -machine type=,,blah
> >> 
> >> and where *buf would indeed be validly ','.
> >
> > Right, but I can't allow this without allowing '-o ,,' which breaks the
> > real use case. So the lesson is that you can concatenate option strings
> > and use implicit option names at the same time.
> 
> Another wart on the freakishly complex QemuOpts.

Rather what you get for operating on strings instead of directly going
to QemuOpts. We're parsing the option strings in the wrong place and
qemu-img shouldn't be concatenating option strings. But it takes a
larger cleanup until we can have that and I didn't want to block this
improvement on infrastructure work.

Kevin

  reply	other threads:[~2014-02-24  9:42 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-21 15:24 [Qemu-devel] [PATCH v3 0/6] qemu-img: Support multiple -o options Kevin Wolf
2014-02-21 15:24 ` [Qemu-devel] [PATCH v3 1/6] qemu-option: has_help_option() and is_valid_option_list() Kevin Wolf
2014-02-21 20:22   ` Eric Blake
2014-02-21 20:57     ` Kevin Wolf
2014-02-24  8:42       ` Markus Armbruster
2014-02-24  9:42         ` Kevin Wolf [this message]
2014-02-21 15:24 ` [Qemu-devel] [PATCH v3 2/6] qemu-img create: Support multiple -o options Kevin Wolf
2014-02-21 15:24 ` [Qemu-devel] [PATCH v3 3/6] qemu-img convert: " Kevin Wolf
2014-03-03 11:43   ` Peter Lieven
2014-03-03 13:08     ` Kevin Wolf
2014-02-21 15:24 ` [Qemu-devel] [PATCH v3 4/6] qemu-img amend: " Kevin Wolf
2014-02-21 15:24 ` [Qemu-devel] [PATCH v3 5/6] qemu-img: Allow -o help with incomplete argument list Kevin Wolf
2014-02-21 15:24 ` [Qemu-devel] [PATCH v3 6/6] qemu-iotests: Check qemu-img command line parsing Kevin Wolf
2014-02-21 20:38   ` Eric Blake
2014-02-21 19:59 ` [Qemu-devel] [PATCH v3 0/6] qemu-img: Support multiple -o options Jeff Cody

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=20140224094226.GC3775@dhcp-200-207.str.redhat.com \
    --to=kwolf@redhat.com \
    --cc=armbru@redhat.com \
    --cc=jcody@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /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).