From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58052) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ykvjc-0005ab-9x for qemu-devel@nongnu.org; Wed, 22 Apr 2015 10:34:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YkvjU-0006pt-Cx for qemu-devel@nongnu.org; Wed, 22 Apr 2015 10:34:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60214) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YkvjU-0006pX-7l for qemu-devel@nongnu.org; Wed, 22 Apr 2015 10:34:32 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id CFB26B5E6D for ; Wed, 22 Apr 2015 14:34:31 +0000 (UTC) Message-ID: <5537B176.9070508@redhat.com> Date: Wed, 22 Apr 2015 08:34:30 -0600 From: Eric Blake MIME-Version: 1.0 References: <1429668155-1606-1-git-send-email-jsnow@redhat.com> <1429668155-1606-4-git-send-email-jsnow@redhat.com> In-Reply-To: <1429668155-1606-4-git-send-email-jsnow@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="PR30IfKDDTGAfJlIlis0DbFtneDo0DUJ0" Subject: Re: [Qemu-devel] [PATCH 3/5] scripts: qmp-shell: allow single-quotes in JSON expressions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: John Snow , qemu-devel@nongnu.org Cc: kchamart@redhat.com, lcapitulino@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --PR30IfKDDTGAfJlIlis0DbFtneDo0DUJ0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 04/21/2015 08:02 PM, John Snow wrote: > As a convenience for the user, replace any single quotes given > with double quotes so that the data will deserialize correctly > via json.loads(). >=20 > Signed-off-by: John Snow > --- > scripts/qmp/qmp-shell | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/scripts/qmp/qmp-shell b/scripts/qmp/qmp-shell > index 5347f89..d7cb33d 100755 > --- a/scripts/qmp/qmp-shell > +++ b/scripts/qmp/qmp-shell > @@ -129,7 +129,7 @@ class QMPShell(qmp.QEMUMonitorProtocol): > =20 > < command-name > [ arg-name1=3Darg1 ] ... [ arg-nameN=3Dar= gN ] > """ > - cmdargs =3D cmdline.split() > + cmdargs =3D cmdline.replace("'", '"').split() This replaces ALL single quotes, even if they would otherwise be escaped. That is, if I pass foo=3D"a\'\"b", it will probably be corrupte= d. qmp-shell exists mainly as a convenience for testing, and I doubt testers are likely to want to use unbalanced quotes as contents of strings, so I can give a weak: Reviewed-by: Eric Blake But it's still worth thinking about whether there is a more robust solution to be used. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --PR30IfKDDTGAfJlIlis0DbFtneDo0DUJ0 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/ iQEcBAEBCAAGBQJVN7F2AAoJEKeha0olJ0NqldwIAKtRoEBg2ay9+j3ekvA4/mg6 zzhGqk1lNBvgHQGkKGREuEEcLzb3r6HSeBx28qkRJOv2zqYS9wPw0Tii23UJG5Kb Ablgp6QlRim5qR7ZVrWW5mm03zlGeRq6FCveUP12kxy90JeGzM55JOnhqPqMKs4Q n4srCJ5MOG+ANzeKWRtAGWUXMb618rRFXqqekfIYqdJtpJZ5I4Xoik36zu0eKQEW lNUXbXTAQrNxVvazETD0otyDhq+HqXZyJX5MReE3prrs1pYbclpCsRngIsjREk0E G+Vlnq7LipIqOnHm3ZWjZD/+EddWj9yOxK+uby24gvu6nExChUC8ps4F/qOBTXg= =zX/7 -----END PGP SIGNATURE----- --PR30IfKDDTGAfJlIlis0DbFtneDo0DUJ0--