[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v5 21/28] qapi: Require valid names
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v5 21/28] qapi: Require valid names |
Date: |
Fri, 27 Mar 2015 14:17:23 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 |
On 03/27/2015 11:14 AM, Markus Armbruster wrote:
> Eric Blake <address@hidden> writes:
>
>> Previous commits demonstrated that the generator overlooked various
>> bad naming situations:
>> - types, commands, and events need a valid name
>> - union and alternate branches cannot be marked optional
>>
>> The set of valid names includes [a-zA-Z0-9._-] (where '.' is
>> useful only in downstream extensions).
>>
>>
>> +valid_characters = set(string.ascii_letters + string.digits + '.' + '-' +
>> '_')
>> +def check_name(expr_info, source, name, allow_optional = False):
>> + membername = name
>> +
>> + if not isinstance(name, str):
>> + raise QAPIExprError(expr_info,
>> + "%s requires a string name" % source)
>> + if name == '**':
>> + return
>
> I'm afraid this conditional is superfluous or wrong. Our schemata don't
> trigger it.
Hmm, you're right. Given a 'name':'type' pair in a dictionary,
check_name is used on the 'name' portion; but we only use 'name':'**'
(and NOT '**':'type') in the schemata. I'll drop it in the respin.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- Re: [Qemu-devel] [PATCH v5 16/28] qapi: Better error messages for duplicated expressions, (continued)
[Qemu-devel] [PATCH v5 20/28] qapi: More rigourous checking of types, Eric Blake, 2015/03/24
[Qemu-devel] [PATCH v5 21/28] qapi: Require valid names, Eric Blake, 2015/03/24
[Qemu-devel] [PATCH v5 27/28] qapi: Drop inline nested types in query-pci, Eric Blake, 2015/03/24
[Qemu-devel] [PATCH v5 28/28] qapi: Drop support for inline nested types, Eric Blake, 2015/03/24
[Qemu-devel] [PATCH v5 24/28] qapi: Merge UserDefTwo and UserDefNested in tests, Eric Blake, 2015/03/24
[Qemu-devel] [PATCH v5 25/28] qapi: Drop tests for inline nested structs, Eric Blake, 2015/03/24