All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: qemu-devel@nongnu.org, pbonzini@redhat.com, alex.bennee@linaro.org
Subject: Re: [Qemu-devel] [PATCH 2/3] log: Fix qemu_set_dfilter_ranges() error reporting
Date: Thu, 16 Jun 2016 09:40:19 +0200	[thread overview]
Message-ID: <87a8ilfuos.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <5761A71D.8070003@redhat.com> (Eric Blake's message of "Wed, 15 Jun 2016 13:06:05 -0600")

Eric Blake <eblake@redhat.com> writes:

> 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.

Yup, except I'd call it "build upon", not "improve".

>> 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 <armbru@redhat.com>
>> ---
>>  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?

The former would add a test for the error handling of
qemu_set_dfilter_ranges()'s other use of qemu_strtoull().  If it wasn't
worth testing before my patch...  But I can add a test case anyway, if I
need to respin.

The latter would basically test an additional error path within
qemu_strtoull().

>
> Reviewed-by: Eric Blake <eblake@redhat.com>

Thanks!

  reply	other threads:[~2016-06-16  7:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-15 17:27 [Qemu-devel] [PATCH 0/3] log: Fix error handling and a memory leak Markus Armbruster
2016-06-15 17:27 ` [Qemu-devel] [PATCH 1/3] log: Plug memory leak on multiple -dfilter Markus Armbruster
2016-06-15 18:42   ` Eric Blake
2016-06-15 17:27 ` [Qemu-devel] [PATCH 2/3] log: Fix qemu_set_dfilter_ranges() error reporting Markus Armbruster
2016-06-15 19:06   ` Eric Blake
2016-06-16  7:40     ` Markus Armbruster [this message]
2016-06-15 17:27 ` [Qemu-devel] [PATCH 3/3] log: Fix qemu_set_log_filename() error handling Markus Armbruster
2016-06-15 19:11   ` Eric Blake

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=87a8ilfuos.fsf@dusky.pond.sub.org \
    --to=armbru@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=eblake@redhat.com \
    --cc=pbonzini@redhat.com \
    --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 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.