From: "Richard W.M. Jones" <rjones@redhat.com>
To: Max Reitz <mreitz@redhat.com>
Cc: Eric Blake <eblake@redhat.com>,
kwolf@redhat.com, qemu-block@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2] qemu-io: Reinitialize optind to 1 (not 0) before parsing inner command.
Date: Mon, 7 Jan 2019 18:40:58 +0000 [thread overview]
Message-ID: <20190107184058.GN27120@redhat.com> (raw)
In-Reply-To: <f5aa2057-509b-28fa-d803-b18ca525ae73@redhat.com>
On Mon, Jan 07, 2019 at 06:50:53PM +0100, Max Reitz wrote:
[...]
I don't particularly care how we fix this, but it breaks the nbdkit
tests on FreeBSD so I am keen to fix it one way or another.
> And if optreset not being available for glibc is the only issue, I'd say
> adding it as a weak global variable would work without #ifdefs.
The weak global variable doesn't make the code "#ifdef free". I tried
a patch like this:
+int optreset __attribute__((weak));
...
static int command(...)
{
...
optind = 0;
+ optreset = 1;
...
}
but that still doesn't work on FreeBSD.
You have to set optind=1 apparently. So if we want to set optreset=1
we still end up with #ifdef __FreeBSD__. The final patch will
end up looking something like:
static int command(...)
{
...
+#ifdef __FreeBSD__
+ optind = 1;
+ optreset = 1;
+#else
optind = 0;
+#endif
...
}
If you want me to submit a formal patch like this let me know.
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
next prev parent reply other threads:[~2019-01-07 18:46 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-03 9:47 [Qemu-devel] [PATCH v2] qemu-io: Reinitialize optind to 1 (not 0) before parsing inner command Richard W.M. Jones
2019-01-03 9:47 ` Richard W.M. Jones
2019-01-03 19:46 ` Eric Blake
2019-01-07 17:17 ` Max Reitz
2019-01-07 17:46 ` Eric Blake
2019-01-07 17:50 ` Max Reitz
2019-01-07 17:59 ` Eric Blake
2019-01-07 18:14 ` Max Reitz
2019-01-07 18:45 ` Eric Blake
2019-01-09 12:30 ` Max Reitz
2019-01-07 18:40 ` Richard W.M. Jones [this message]
2019-01-08 12:16 ` Kevin Wolf
2019-01-08 14:51 ` Eric Blake
2019-01-08 15:13 ` Kevin Wolf
2019-01-08 15:35 ` Richard W.M. Jones
2019-01-09 12:33 ` Max Reitz
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=20190107184058.GN27120@redhat.com \
--to=rjones@redhat.com \
--cc=eblake@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@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).