From: Markus Armbruster <armbru@redhat.com>
To: David Hildenbrand <david@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
qemu-devel@nongnu.org, Michael Roth <mdroth@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] [PATCH RFC 3/6] qapi: rewrite string-input-visitor
Date: Thu, 15 Nov 2018 15:57:24 +0100 [thread overview]
Message-ID: <87ftw2e6cr.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <ef7b64f3-d7f3-6892-e0f3-f4e605604225@redhat.com> (David Hildenbrand's message of "Thu, 15 Nov 2018 11:16:48 +0100")
David Hildenbrand <david@redhat.com> writes:
> On 15.11.18 10:48, Markus Armbruster wrote:
>> David Hildenbrand <david@redhat.com> writes:
>>
>>> On 14.11.18 18:38, Markus Armbruster wrote:
>>>> David Hildenbrand <david@redhat.com> writes:
>>>>
>>>>> The input visitor has some problems right now, especially
>>>>> - unsigned type "Range" is used to process signed ranges, resulting in
>>>>> inconsistent behavior and ugly/magical code
>>>>> - uint64_t are parsed like int64_t, so big uint64_t values are not
>>>>> supported and error messages are misleading
>>>>> - lists/ranges of int64_t are accepted although no list is parsed and
>>>>> we should rather report an error
>>>>> - lists/ranges are preparsed using int64_t, making it hard to
>>>>> implement uint64_t values or uint64_t lists
>>>>> - types that don't support lists don't bail out
>>>>
>>>> Known weirdness: empty list is invalid (test-string-input-visitor.c
>>>> demonstates). Your patch doesn't change that (or else it would update
>>>> the test). Should it be changed?
>>>>
>>>
>>> I don't change the test, so the old behavior still works.
>>> (empty string -> error)
>>
>> Understand. Design question: should it remain an error? Feel free to
>> declare the question out of scope for this patch.
>
> I think I was confused, let me retry to explain.
>
> Empty lists actually don't result in an error. Calling start_list() on
> an empty string works just fine.
>
> However
> - check_list() will result in "Fewer list elements expected"
> - visit_type_.*int64() will result in "Fewer list elements expected"
> - next_list() will result in NULL
>
> I guess that is the intended behavior. E.g. the test does
>
> v = visitor_input_test_init(data, "");
> visit_type_uint64List(v, NULL, &res, &error_abort);
> g_assert(!res);
>
> So there won't be any error as the first "visit_next_list()" will
> properly indicate "NULL".
You know, I was confused, too :) I looked at commit 3d089cea0d3, which
added the test case:
+ /* Empty list is invalid (weird) */
+
+ v = visitor_input_test_init(data, "");
+ visit_type_int64List(v, NULL, &res, &err);
+ error_free_or_abort(&err);
I missed regression fix commit d2788227c61:
- /* Empty list is invalid (weird) */
+ /* Empty list */
v = visitor_input_test_init(data, "");
- visit_type_int64List(v, NULL, &res, &err);
- error_free_or_abort(&err);
+ visit_type_int64List(v, NULL, &res, &error_abort);
+ g_assert(!res);
So the test actually demonstrates empty lists work fine before and after
your patch.
>>> Added "Only flat lists of integers (int64/uint64) are supported."
>>
>> Hmm, do lists of narrower integer types also work? I guess they do: the
>> narrower visit_type_*int*() call v->type_*int64() via
>> visit_type_*intN().
>>
>> Lists of type size are expressly excluded, in parse_type_size() below.
>> That's okay, we can lift the restriction when it gets in the way.
>
> Right, we can make that clearer
>
> "Only flat lists of integers (except type "size") are supported." ?
> [...]
Sold!
[...]
next prev parent reply other threads:[~2018-11-15 14:57 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-09 11:02 [Qemu-devel] [PATCH RFC 0/6] qapi: rewrite string-input-visitor David Hildenbrand
2018-11-09 11:02 ` [Qemu-devel] [PATCH RFC 1/6] cutils: add qemu_strtod() David Hildenbrand
2018-11-09 11:02 ` [Qemu-devel] [PATCH RFC 2/6] qapi: use qemu_strtod() in string-input-visitor David Hildenbrand
2018-11-14 16:09 ` Markus Armbruster
2018-11-15 11:09 ` David Hildenbrand
2018-11-15 13:17 ` Eric Blake
2018-11-15 13:54 ` David Hildenbrand
2018-11-15 14:43 ` Markus Armbruster
2018-11-09 11:02 ` [Qemu-devel] [PATCH RFC 3/6] qapi: rewrite string-input-visitor David Hildenbrand
2018-11-14 17:38 ` Markus Armbruster
2018-11-14 19:56 ` David Hildenbrand
2018-11-15 9:48 ` Markus Armbruster
2018-11-15 10:16 ` David Hildenbrand
2018-11-15 14:57 ` Markus Armbruster [this message]
2018-11-09 11:02 ` [Qemu-devel] [PATCH RFC 4/6] test-string-input-visitor: use virtual walk David Hildenbrand
2018-11-09 11:02 ` [Qemu-devel] [PATCH RFC 5/6] test-string-input-visitor: split off uint64 list tests David Hildenbrand
2018-11-14 16:21 ` Markus Armbruster
2018-11-14 20:03 ` David Hildenbrand
2018-11-15 9:59 ` Markus Armbruster
2018-11-09 11:02 ` [Qemu-devel] [PATCH RFC 6/6] test-string-input-visitor: add range overflow tests David Hildenbrand
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=87ftw2e6cr.fsf@dusky.pond.sub.org \
--to=armbru@redhat.com \
--cc=david@redhat.com \
--cc=mdroth@linux.vnet.ibm.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.