qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 2/3] log: Fix qemu_set_dfilter_ranges() error re


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 2/3] log: Fix qemu_set_dfilter_ranges() error reporting
Date: Wed, 15 Jun 2016 13:06:05 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

On 06/15/2016 11:27 AM, Markus Armbruster wrote:
> g_error() is not an acceptable way to report errors to the user:
> 
>     $ qemu-system-x86_64 -dfilter 1000+0
> 
>     ** (process:17187): ERROR **: Failed to parse range in: 1000+0
>     Trace/breakpoint trap (core dumped)
> 
> g_assert() isn't, either:
> 
>     $ qemu-system-x86_64 -dfilter 1000x+64
>     **
>     ERROR:/work/armbru/qemu/util/log.c:180:qemu_set_dfilter_ranges: assertion 
> failed: (e == range_op)
>     Aborted (core dumped)

I see you're trying to improve my range.h patches, and got dragged into
this stuff.

> 
> Convert qemu_set_dfilter_ranges() to Error.  Rework its deeply nested
> control flow.  Touch up the error messages.  Call it with
> &error_fatal.
> 
> This also permits testing without a subprocess, so do that.
> 
> Signed-off-by: Markus Armbruster <address@hidden>
> ---
>  include/qemu/log.h   |   2 +-
>  tests/test-logging.c |  49 ++++++++--------------
>  util/log.c           | 113 
> ++++++++++++++++++++++++++-------------------------
>  vl.c                 |   2 +-
>  4 files changed, 75 insertions(+), 91 deletions(-)
> 

> +    qemu_set_dfilter_ranges("0x1000+onehundred", &err);
> +    error_free_or_abort(&err);
> +
> +    qemu_set_dfilter_ranges("0x1000+0", &err);
> +    error_free_or_abort(&err);
>  }
>  

Maybe also worth testing "0x" and "0x1000+0x" for being invalid?

Reviewed-by: Eric Blake <address@hidden>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]