From: Paolo Bonzini <pbonzini@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org
Subject: Re: [PATCH] storage-daemon: include current command line option in the errors
Date: Mon, 1 Mar 2021 16:09:20 +0100 [thread overview]
Message-ID: <6d8b8217-d1d3-b7e9-c005-90ce4b2f8b1a@redhat.com> (raw)
In-Reply-To: <20210301122638.GG7698@merkur.fritz.box>
On 01/03/21 13:26, Kevin Wolf wrote:
> This save_index approach isn't perfect because getopt may skip
> non-option arguments and they will be included in the help text:
>
> $ build/storage-daemon/qemu-storage-daemon foo --object iothread
> qemu-storage-daemon: foo --object iothread: Parameter 'id' is missing
>
> $ build/storage-daemon/qemu-storage-daemon foo --object iothread,id=t
> qemu-storage-daemon: --object iothread,id=t foo: Unexpected argument: foo
>
> However, without changing the interface of loc_set_cmdline(), getting
> the right index seems hard. Not sure what is the best way for fixing
> this or if it's worth the effort.
We can do better by passing "-hT:V" to getopt_long. Then each
non-option argument is returned directly, and everything works as
getopt_long no longer needs to reorder argv.
Paolo
prev parent reply other threads:[~2021-03-01 15:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-26 11:03 [PATCH] storage-daemon: include current command line option in the errors Paolo Bonzini
2021-02-26 13:44 ` Eric Blake
2021-03-01 12:26 ` Kevin Wolf
2021-03-01 15:09 ` Paolo Bonzini [this message]
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=6d8b8217-d1d3-b7e9-c005-90ce4b2f8b1a@redhat.com \
--to=pbonzini@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-block@nongnu.org \
--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).