From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48662) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XYbuC-0004PZ-7K for qemu-devel@nongnu.org; Mon, 29 Sep 2014 10:26:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XYbu7-0000vP-9E for qemu-devel@nongnu.org; Mon, 29 Sep 2014 10:26:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:22825) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XYbu7-0000u0-2p for qemu-devel@nongnu.org; Mon, 29 Sep 2014 10:26:19 -0400 Message-ID: <54296C03.7030803@redhat.com> Date: Mon, 29 Sep 2014 08:26:11 -0600 From: Eric Blake MIME-Version: 1.0 References: <1411165504-18198-1-git-send-email-eblake@redhat.com> <1411165504-18198-14-git-send-email-eblake@redhat.com> <87r3yyohpq.fsf@blackfin.pond.sub.org> <87vbo6sufk.fsf@blackfin.pond.sub.org> In-Reply-To: <87vbo6sufk.fsf@blackfin.pond.sub.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="gNGL8lW0fHqNG4Q64FsX0jNq9LftgQkSJ" Subject: Re: [Qemu-devel] [PATCH v4 13/19] qapi: More rigourous checking of types List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: Fam Zheng , qemu-devel@nongnu.org, wenchaoqemu@gmail.com, Luiz Capitulino This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --gNGL8lW0fHqNG4Q64FsX0jNq9LftgQkSJ Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 09/29/2014 02:27 AM, Markus Armbruster wrote: > Markus Armbruster writes: >=20 >> Eric Blake writes: >> >>> Now that we know every expression is valid with regards to >>> its keys, we can add further tests that those keys refer to >>> valid types. With this patch, all references to a type (the >>> 'data': of command, type, union, and event, and the 'returns': >>> of command) must resolve to a builtin or another type declared >>> by the current qapi parse; this includes recursing into each >>> member of a data dictionary. Dealing with '**' and nested >>> sub-structs will be done in later patches. >>> >>> Update the testsuite to match improved output. >>> >>> Signed-off-by: Eric Blake > [...] >>> @@ -262,6 +308,15 @@ def check_command(expr, expr_info): >>> raise QAPIExprError(expr_info, >>> "command '%s' is already defined" % name= ) >>> commands.append(name) >>> + check_type(expr_info, "'data' for command '%s'" % name, >>> + expr.get('data'), allow_array=3DTrue, >>> + allowed_names=3D['union', 'struct']) >>> + check_type(expr_info, "'base' for command '%s'" % name, >>> + expr.get('base'), allowed_names=3D['struct'], >>> + allow_dict=3DFalse) >> >> Nicely done. >=20 > Wait a sec! What's a command's 'base'? Blech. You're right - only 'union' and 'struct' have a base. And since an earlier patch already filtered out 'base' as a non-allowed key for 'command, this check_type is dead code. All the more reason for me to spin v5 :) --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --gNGL8lW0fHqNG4Q64FsX0jNq9LftgQkSJ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg iQEcBAEBCAAGBQJUKWwDAAoJEKeha0olJ0Nq6xwIAJ4Gb5aFuIQYOQ1xbmnkseDH 3hw8BIi7Jil0RZTcSKWCdu04P7z76TV9EPY3C2L6n2yvIQzz2wuqUc6MzUIkOR49 Bb6tCsDcuDE72ccqcAUKIn7kIQurlk4ryguMYYXPNsEN0I1i2UgcOiUePo46M+Nf Y9AdrAVbYfbN0TWO8EaHrvCn267f6HGEPrLUkA6kXzInieiUJv1o4bCwyNlRQhhu xva2UDT9BHjyWordZiijwVbDlNJm0bJaENMhNAP4Ju25tF0jcWxOTyBdBkqEqS3S GQ1x+GZfDN7mWMZBccYWVYmWODIaAy5PGPvRskfrzWQdaHSuSZUOXmvqJYHiTA4= =HIsj -----END PGP SIGNATURE----- --gNGL8lW0fHqNG4Q64FsX0jNq9LftgQkSJ--