From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36654) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V2kNR-0007st-4w for qemu-devel@nongnu.org; Fri, 26 Jul 2013 11:56:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V2kNP-0004Ob-Vr for qemu-devel@nongnu.org; Fri, 26 Jul 2013 11:56:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:22294) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V2kNP-0004OX-NE for qemu-devel@nongnu.org; Fri, 26 Jul 2013 11:56:19 -0400 Message-ID: <51F29C20.3020006@redhat.com> Date: Fri, 26 Jul 2013 09:56:16 -0600 From: Eric Blake MIME-Version: 1.0 References: <1374842387-17146-1-git-send-email-armbru@redhat.com> <1374842387-17146-7-git-send-email-armbru@redhat.com> In-Reply-To: <1374842387-17146-7-git-send-email-armbru@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="oapJcI56bWvQGIxXEhXWToWALjD122uE8" Subject: Re: [Qemu-devel] [PATCH 6/9] qapi.py: Fix schema parser to check syntax systematically List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: aliguori@us.ibm.com, akong@redhat.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --oapJcI56bWvQGIxXEhXWToWALjD122uE8 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 07/26/2013 06:39 AM, Markus Armbruster wrote: > Fixes at least the following parser bugs: >=20 > * accepts any token in place of a colon >=20 > * treats comma as optional >=20 > * crashes when closing braces or brackets are missing >=20 > Signed-off-by: Markus Armbruster > --- > scripts/qapi.py | 40 ++++++++++++++++++++++++++-= -------- > tests/qapi-schema/missing-colon.err | 1 + > tests/qapi-schema/missing-colon.exit | 2 +- > tests/qapi-schema/missing-colon.out | 3 --- > tests/qapi-schema/missing-comma.err | 1 + > tests/qapi-schema/missing-comma.exit | 2 +- > tests/qapi-schema/missing-comma.out | 3 --- > tests/qapi-schema/unclosed-object.err | 2 +- > 8 files changed, 35 insertions(+), 19 deletions(-) >=20 > =20 > def get_values(self): > expr =3D [] > - while self.tok !=3D ']': > + if self.tok =3D=3D ']': > + self.accept() > + return expr > + if not self.tok in [ '{', '[', "'" ]: > + raise QAPISchemaError(self, 'Expected "{", "[", "]" or str= ing') JSON allows primitives here, as in [ 1 ]; but I agree that for the purposes of our schema we will always be taking a string or complex object whenever we have a list. Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --oapJcI56bWvQGIxXEhXWToWALjD122uE8 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.4.13 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJR8pwgAAoJEKeha0olJ0NqgR4IAJoxPwzKal4WCHZxg7yZdtPS XIQHEWdYtLX7lCC4/FlClrln9N5j4EyHeaw8M1/Yk7Hhdm+dsrvD7bO/al8mY6uU X95ap82yjLyfykHSSDUJvqDSLMSiEnejwHIwEp8piCgnxE6+V50WFvNtcTBdDEci ju6xgjOmuoKlqT2SqHb9fHfs7T7ajABNrfFUGKjbS7PTzj+iMqycsXAk2d0i6kJx DqlZb0p2nFjscjAoyZgTjdcxM5tpGxM2DnQ5FBcUP8MEd7u51Q5rlKij53/X0idS sQl2jLqU8e5yc8sfdn1bgYGtVc20raiA/ftaVwQt4ibt7nTYnxQ4Fg0/P6Z45hw= =CXE9 -----END PGP SIGNATURE----- --oapJcI56bWvQGIxXEhXWToWALjD122uE8--