[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] error: Fix error_report_err(), warn_report_err(
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH] error: Fix error_report_err(), warn_report_err() hint printing |
Date: |
Tue, 16 Apr 2019 10:50:41 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 |
On 4/16/19 10:38 AM, Markus Armbruster wrote:
> Before the from qerror_report() to error_setg(), hints looked like
s/the from/the change from/
> this:
>
> qerror_report(QERR_MACRO, ... arguments ...);
> error_printf_unless_qmp(... hint ...);
>
> error_printf_unless_qmp() made perfect sense: it printed exactly when
> qerror_report() did.
>
> After the conversion to error_setg():
Commit id?
>
> error_setg(errp, QERR_MACRO, ... arguments ...);
> error_printf_unless_qmp(... hint ...);
>
> The "unless QMP part" still made some sense; in QMP context, the
> caller generally uses the error as QMP response instead of printing
> it.
>
> However, everything else is wrong. If the caller handles the error,
> the hint gets printed anyway (unless QMP). If the caller reports the
> error, the hint gets printed *before* the report (unless QMP) or not
> at all (if QMP).
>
> Commit 50b7b000c91 fixed this by making hints a member of Error. It
Belongs to 2.5.0.
> kept printing hints with error_printf_unless_qmp():
>
> void error_report_err(Error *err)
> {
> error_report("%s", error_get_pretty(err));
> + if (err->hint) {
> + error_printf_unless_qmp("%s\n", err->hint->str);
> + }
> error_free(err);
> }
>
> This is wrong. We should (and now can) print the hint exactly when we
> print the error.
>
> The mistake has since been copied to warn_report_err().
Commit id?
>
> Fix both to use error_printf().
>
> Reported-by: Vladimir Sementsov-Ogievskiy <address@hidden>
> Cc: Eric Blake <address@hidden>
> Signed-off-by: Markus Armbruster <address@hidden>
> ---
> util/error.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
Probably too late for 4.0-rc4. Then again, it regressed in 2.5, so
having yet one more release with the lame output doesn't hurt.
Reviewed-by: Eric Blake <address@hidden>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature