From: Luiz Capitulino <lcapitulino@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-trivial@nongnu.org, peter.maydell@linaro.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-trivial] [PATCH for-1.4 v2 1/6] error: Clean up error strings with embedded newlines
Date: Fri, 8 Feb 2013 17:13:15 -0200 [thread overview]
Message-ID: <20130208171315.2fc46fb4@redhat.com> (raw)
In-Reply-To: <87wquid48e.fsf@blackfin.pond.sub.org>
On Fri, 08 Feb 2013 19:56:17 +0100
Markus Armbruster <armbru@redhat.com> wrote:
> Luiz Capitulino <lcapitulino@redhat.com> writes:
>
> > On Fri, 8 Feb 2013 17:17:07 +0100
> > Markus Armbruster <armbru@redhat.com> wrote:
> >
> >> The arguments of error_report() should yield a short error string
> >> without newlines.
> >>
> >> A few places try to print additional help after the error message by
> >> embedding newlines in the error string. That's nice, but let's do it
> >> the right way.
> >>
> >> Since I'm touching these lines anyway, drop a stray preposition and
> >> some tabs. We don't use tabs for similar messages elsewhere.
> >>
> >> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> >> ---
> >> hw/kvm/pci-assign.c | 12 ++++++------
> >> 1 file changed, 6 insertions(+), 6 deletions(-)
> >>
> >> diff --git a/hw/kvm/pci-assign.c b/hw/kvm/pci-assign.c
> >> index 896cfe8..da64b5b 100644
> >> --- a/hw/kvm/pci-assign.c
> >> +++ b/hw/kvm/pci-assign.c
> >> @@ -936,8 +936,8 @@ retry:
> >> /* Retry with host-side MSI. There might be an IRQ conflict and
> >> * either the kernel or the device doesn't support sharing. */
> >> error_report("Host-side INTx sharing not supported, "
> >> - "using MSI instead.\n"
> >> - "Some devices do not to work properly in this mode.");
> >> + "using MSI instead");
> >> + error_printf("Some devices do not work properly in this mode.\n");
> >
> > This is fixing command-line, right?
>
> Whatever made assign_intx() run. I'm not familiar with this code, and I
> don't know how to trigger the error.
>
> Hmm, one call chain is via PCIDeviceClass init method assigned_initfn().
> So it could also be device_add.
>
> > I honestly don't know which is less worse, the current code or having
> > to call two different functions in the correct order to report an
> > error :(
>
> You call one function to report the error. In the rare case that you
> want to add some explanation or hint to the error message, you use
> another function to print to the error destination. Big deal :)
I think the important point is not whether or not this is a big deal,
but that this is a bad API which will break from time to time (as it's
more or less the case now).
> Explanations and hints are *not* error messages. Sticking them into the
> error string like the code does before my patch happens to work due to
> the way error_report() formats the error message. Relying on that is
> unclean. Besides, error_report()'s function comment clearly stipulates
> "no newlines".
I agree.
But regarding this patch, we first have to decide whether or not this is
good for 1.4 and then we have to come with a better solution for this
(post 1.4).
Regarding the first point, I have to questions:
1. Were the additional newlines added in 1.4?
2. What's the worse case here?
next prev parent reply other threads:[~2013-02-08 19:13 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-08 16:17 [Qemu-trivial] [PATCH for-1.4 v2 0/6] Error reporting fixes Markus Armbruster
2013-02-08 16:17 ` [Qemu-trivial] [PATCH for-1.4 v2 1/6] error: Clean up error strings with embedded newlines Markus Armbruster
2013-02-08 17:41 ` Luiz Capitulino
2013-02-08 18:56 ` Markus Armbruster
2013-02-08 19:13 ` Luiz Capitulino [this message]
2013-02-08 19:48 ` Markus Armbruster
2013-02-13 19:28 ` Luiz Capitulino
2013-02-08 16:17 ` [Qemu-trivial] [PATCH for-1.4 v2 2/6] error: Clean up abuse of error_report() for help Markus Armbruster
2013-02-08 16:17 ` [Qemu-trivial] [PATCH for-1.4 v2 3/6] error: Strip trailing '\n' from error string arguments (again) Markus Armbruster
2013-02-08 17:45 ` Luiz Capitulino
2013-02-08 16:17 ` [Qemu-trivial] [PATCH for-1.4 v2 4/6] qemu-option: Disable two helpful messages that got broken recently Markus Armbruster
2013-02-08 17:53 ` Luiz Capitulino
2013-02-08 18:58 ` Markus Armbruster
2013-02-08 19:16 ` Luiz Capitulino
2013-02-08 19:34 ` Markus Armbruster
2013-02-13 19:20 ` Luiz Capitulino
2013-02-08 16:17 ` [Qemu-trivial] [PATCH for-1.4 v2 5/6] vl: Drop redundant "parse error" reports Markus Armbruster
2013-02-08 17:54 ` Luiz Capitulino
2013-02-08 16:17 ` [Qemu-trivial] [PATCH for-1.4 v2 6/6] vl: Exit unsuccessfully on option argument syntax error Markus Armbruster
2013-02-08 18:00 ` Luiz Capitulino
2013-02-08 18:30 ` Markus Armbruster
2013-02-08 18:59 ` [Qemu-trivial] [PATCH for-1.4 v2 0/6] Error reporting fixes Markus Armbruster
2013-02-08 19:16 ` Luiz Capitulino
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=20130208171315.2fc46fb4@redhat.com \
--to=lcapitulino@redhat.com \
--cc=armbru@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.