qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 3/3] qapi: Fix QemuOpts visitor regression on


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v2 3/3] qapi: Fix QemuOpts visitor regression on unvisited input
Date: Wed, 22 Mar 2017 08:13:05 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

On 03/22/2017 01:47 AM, Markus Armbruster wrote:
> Eric Blake <address@hidden> writes:
> 
>> An off-by-one in commit 15c2f669e meant that we were failing to
>> check for unparsed input in all QemuOpts visitors.  Recent testsuite
>> additions show that fixing the obvious bug with bogus fields will
>> also fix the case of an incomplete list visit; update the tests to
>> match the new behavior.
>>

>> @@ -276,8 +276,8 @@ static void
>>  opts_check_list(Visitor *v, Error **errp)
>>  {
>>      /*
>> -     * FIXME should set error when unvisited elements remain.  Mostly
>> -     * harmless, as the generated visits always visit all elements.
>> +     * Unvisited list elements will be reported later when checking if
>> +     * unvisited struct members remain.
> 
> Non-native speaker question: if or whether?
> 

Both work to my ear, but whether sounds a bit more formal. I can switch,
since...


>> -    visit_check_list(v, &error_abort); /* BUG: unvisited tail not reported 
>> */
>> +    visit_check_list(v, &error_abort); /* unvisited tail ignored until... */
>>      visit_end_list(v, (void **)&list);
>>
>> -    visit_check_struct(v, &error_abort);
>> +    visit_check_struct(v, &err); /* ...here */
>> +    error_free_or_abort(&err);
>>      visit_end_struct(v, NULL);
>>
>>      qapi_free_intList(list);
> 
> How come unvisited tails are diagnosed late?

Because opts_check_list() is still a no-op, and I didn't want to muck
with how to make it work to catch things earlier.  The late catch is by
virtue of the fact that we track complete coverage by whether the clone
of the QemuOpts still has the key, and the key is not removed until the
list is fully parsed.

> 
>> @@ -239,7 +241,7 @@ test_opts_range_beyond(void)
>>      error_free_or_abort(&err);
>>      visit_end_list(v, (void **)&list);
>>
>> -    visit_check_struct(v, &error_abort);
>> +    visit_check_struct(v, &err);
> 
> This looks wrong.  Either you expect an error or not.  If you do,
> error_free_or_abort() seems missing.  If you don't, the hunk needs to be
> dropped.
> 

...you are correct that this is a spurious hunk, and removing it does
not change the testsuite. v3 coming up.

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