From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36029) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZHYMd-0002NW-E6 for qemu-devel@nongnu.org; Tue, 21 Jul 2015 10:17:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZHYMa-0002Hc-6g for qemu-devel@nongnu.org; Tue, 21 Jul 2015 10:17:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45980) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZHYMa-0002HU-11 for qemu-devel@nongnu.org; Tue, 21 Jul 2015 10:17:44 -0400 References: <1435782155-31412-1-git-send-email-armbru@redhat.com> <1435782155-31412-16-git-send-email-armbru@redhat.com> From: Eric Blake Message-ID: <55AE5481.5090406@redhat.com> Date: Tue, 21 Jul 2015 08:17:37 -0600 MIME-Version: 1.0 In-Reply-To: <1435782155-31412-16-git-send-email-armbru@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Sl96Q0OIX8E7J21HACKK9Bsdv8j596hmV" Subject: Re: [Qemu-devel] [PATCH RFC v2 15/47] qapi: Fix to reject union command arguments List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster , qemu-devel@nongnu.org Cc: kwolf@redhat.com, berto@igalia.com, mdroth@linux.vnet.ibm.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Sl96Q0OIX8E7J21HACKK9Bsdv8j596hmV Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 07/01/2015 02:22 PM, Markus Armbruster wrote: > A command's 'data' must be a struct type, given either as a > dictionary, or as struct type name. >=20 > Commit dd883c6 tightened the checking there, but not enough: we still > accept 'union'. Fix to reject it. I was thinking that 'all dictionaries are okay' when I wrote that commit, and obviously missed thinking about 'how would we translate unions into a C prototype'. >=20 > We may want to support union types there, but we'll have to extend > qapi-commands.py for it. >=20 > Signed-off-by: Markus Armbruster > --- > scripts/qapi.py | 2 +- > tests/qapi-schema/args-union.err | 1 + > tests/qapi-schema/args-union.exit | 2 +- > tests/qapi-schema/args-union.json | 2 +- > tests/qapi-schema/args-union.out | 4 ---- > 5 files changed, 4 insertions(+), 7 deletions(-) Reviewed-by: Eric Blake >=20 > diff --git a/scripts/qapi.py b/scripts/qapi.py > index 99e04f6..bebaecc 100644 > --- a/scripts/qapi.py > +++ b/scripts/qapi.py > @@ -495,7 +495,7 @@ def check_command(expr, expr_info): > =20 > check_type(expr_info, "'data' for command '%s'" % name, > expr.get('data'), allow_dict=3DTrue, allow_optional=3DT= rue, > - allow_metas=3D['union', 'struct'], allow_star=3Dallow_s= tar) > + allow_metas=3D['struct'], allow_star=3Dallow_star) I'm still quite pleased at how my earlier work made this a one-liner fix - the check_type() interface turned out to be rather pleasant. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --Sl96Q0OIX8E7J21HACKK9Bsdv8j596hmV Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJVrlSBAAoJEKeha0olJ0Nq06sH/0c6ZfvzXmDfB0O+YAtYK6ie Yuv3SsE/FJ+VX89rSKXuHSjLvO/KcHKCWjd11hylOBUMHmyf5JGcMpppVwTqVG8Z fybWvknbfvLDD3e/f0mHC+ltnB+ei4gfeYWnPi6rdh/mZ+ONErwL6zZ3MJhbbHlR RM4C8pYA4jW4SK5rcuJI1bItq9khMVQAVrjUOEWLQwrIJMKkDb9YwgDpyZ1orGsX eIUOvCH1GMtit528vBbsVDMifdgc2o7rft90taFxULs0zq8PCn5emTI/PnNnt+NR WXJwCjCAoBTw5iwiXZnv0t2+f64G7Xe/7JgR9MEIIA5mvIS8zWtynN4J7k+oCRw= =mwEp -----END PGP SIGNATURE----- --Sl96Q0OIX8E7J21HACKK9Bsdv8j596hmV--