From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47675) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ybak5-0002kS-3u for qemu-devel@nongnu.org; Fri, 27 Mar 2015 16:20:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ybak1-0001o5-KM for qemu-devel@nongnu.org; Fri, 27 Mar 2015 16:20:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36707) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ybak1-0001nq-Cl for qemu-devel@nongnu.org; Fri, 27 Mar 2015 16:20:29 -0400 Message-ID: <5515BB8A.8060909@redhat.com> Date: Fri, 27 Mar 2015 14:20:26 -0600 From: Eric Blake MIME-Version: 1.0 References: <1427227433-5030-1-git-send-email-eblake@redhat.com> <1427227433-5030-23-git-send-email-eblake@redhat.com> <871tkau7o9.fsf@blackfin.pond.sub.org> In-Reply-To: <871tkau7o9.fsf@blackfin.pond.sub.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="4fgu30Qd2QdxNhNQEcECl1xkQdgDjEFiJ" Subject: Re: [Qemu-devel] [PATCH v5 22/28] qapi: Whitelist commands that don't return dictionary List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: kwolf@redhat.com, lcapitulino@redhat.com, famz@redhat.com, qemu-devel@nongnu.org, wenchaoqemu@gmail.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --4fgu30Qd2QdxNhNQEcECl1xkQdgDjEFiJ Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 03/27/2015 03:11 AM, Markus Armbruster wrote: > Eric Blake writes: >=20 >> ...or an array of dictionaries. Although we have to cater to >> existing commands, returning a non-dictionary means the command >> is not extensible (no new name/value pairs can be added if more >> information must be returned in parallel). By making the >> whitelist explicit, any new command that falls foul of this >> practice will have to be self-documenting, which will encourage >> developers to either justify the action or rework the design to >> use a dictionary after all. >> >> Signed-off-by: Eric Blake >> --- > Since there's just one whitelist, all schemata share it, and that means= > it's too permissive for each of them. Sloppy, but good enough. >=20 > If the sloppiness bothers us, here are two alternatives: Doesn't bother me enough to use either alternative, but I _will_ update the commit message to at least remind someone of the potential for tightening things, should the need arise in the future. >=20 > * Program takes the whitelist as argument, say >=20 > scripts/qapi-commands.py --legacy-returns qmp-legacy-returns ... Early exit (generator fails if you don't whitelist), but noisy (have to touch a Makefile in addition to the .json schema). >=20 > * Leave enforcing to C >=20 > If a command 'frobnicate' returns a non-dictionary, generate somethin= g > like >=20 > #ifndef FROBNICATE_LEGACY_RETURN_OK > #error Command 'frobnicate' should return a dictionary > #endif >=20 > Then manually define the macros necessary to keep the current use > working in a suitable header. Late exit (failure does not occur at python generation time, but only at C compilation time) - and the point of this series was to promote several late exits into early exits. But slightly cleaner than having to touch Makefiles to add in the whitelist. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --4fgu30Qd2QdxNhNQEcECl1xkQdgDjEFiJ 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 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJVFbuKAAoJEKeha0olJ0NqZ2YH/3sUJFN8wDYRvaWcCcYmLlDE 6roFVjeB55u5oExzDvXyQmsOuzLeqb5ZY7rZQr5DikoUVnho9tj5xahFj1wEmTZL pXVxvO7sPPnoUz/id7CzCTMZtqZDDDyXWZwRHQU0E+9oTlo3Ybpzh8dlNtdirzAt +N/enNn9QLtNR0jL87+CvZ14N0F6lKD48ehzt3msUxXjRGncnmf/akY+Ij1QZkER TRg7n31cIwqFNdvDh4gioJO8dyQ0Gm3YNzXlgNirOjEkc89dgmSa33JdW5YY02c/ nZ084nyZzMxcKazuO4j5TfH9sgYSKCw1hVnrZypbqsAExdbfX2DG3XblDImP1b0= =aya9 -----END PGP SIGNATURE----- --4fgu30Qd2QdxNhNQEcECl1xkQdgDjEFiJ--