From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:52323) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SoCkx-0006hR-Cx for qemu-devel@nongnu.org; Mon, 09 Jul 2012 08:08:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SoCks-0007Ma-8i for qemu-devel@nongnu.org; Mon, 09 Jul 2012 08:07:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:22951) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SoCks-0007MO-0A for qemu-devel@nongnu.org; Mon, 09 Jul 2012 08:07:54 -0400 Message-ID: <4FFAC994.4060804@redhat.com> Date: Mon, 09 Jul 2012 06:07:48 -0600 From: Eric Blake MIME-Version: 1.0 References: <1341834742-28654-1-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1341834742-28654-1-git-send-email-peter.maydell@linaro.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enig62CE2673CD586CE4526524E6" Subject: Re: [Qemu-devel] [PATCH] Support 'help' as a synonym for '?' in command line options List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Blue Swirl , Anthony Liguori , Michael Tokarev , qemu-devel@nongnu.org, patches@linaro.org This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig62CE2673CD586CE4526524E6 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 07/09/2012 05:52 AM, Peter Maydell wrote: > For command line options which permit '?' meaning 'please list the > permitted values', add support for 'help' as a synonym, by abstracting > the check out into a helper function. >=20 > Update the documentation to use 'help' rather than '?', since '?' > is a shell metacharacter and thus prone to fail confusingly if there > is a single character filename in the current working directory and > the '?' has not been escaped. It's therefore better to steer users > towards 'help', though '?' is retained for backwards compatibility. I like the idea, but this may cause grief for libvirt, which basically do= es: const char *help; // =3D output of 'qemu -h' if (strstr(help, "-device driver,?")) { /* Cram together all device-related queries into one invocation; * the output format makes it possible to distinguish what we * need. With qemu 0.13.0 and later, unrecognized '-device * bogus,?' cause an error in isolation, but are silently ignored * in combination with '-device ?'. Upstream qemu 0.12.x doesn't * understand '-device name,?', and always exits with status 1 for * the simpler '-device ?', so this function is really only useful * if -help includes "device driver,?". */ cmd =3D virCommandNewArgList(qemu, "-device", "?", "-device", "pci-assign,?", "-device", "virtio-blk-pci,?", "-device", "virtio-net-pci,?", "-device", "scsi-disk,?", NULL); } That is, we are filtering based on the explicit presence of a literal '?' in the help output to determine whether we can further filter based on '-device device,?' queries without confusing qemu or libvirt; changing the 'help' output means that old libvirt with new qemu won't run the extra queries (as if it had been targeting qemu 0.12.x), even though the older spelling of the query would still work. If that is not a concern (that is, if you are willing to state that use of newer qemu is intended to be coupled with newer libvirt that has been taught to use 'help' instead of '?'), then this patch is probably fine. The alternative is to update 'qemu -h' output to mention both forms, rather than completely eradicating the ? form from documentation. --=20 Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --------------enig62CE2673CD586CE4526524E6 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.12 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBCAAGBQJP+smUAAoJEKeha0olJ0Nq048H/2e9yhopg2GneMeFFaSGyt5d j/uHsHLvQ2L3tmVd7zUu2CWXc8gZaJVAhcNJbLVnajSYvJJPo9UOP1+en/7wMtMi /uMhIykP+bAO6Upo8X5zJQK+bXybXT2IAW7cRoP8Yy0A+5+Cy/F76FybmQ9T0VWI DR3CqTLwhsVcHeST+sEaj4NkbtcHAqWDgtglQk76M4gSYAEQEyPkdvRblAo37M5A XKZWe2dvAFUrkhIy3Wt73rwvIAw+JUCyYdXEN7nzC3+e5vZ5V51TKjHUDzYi39el TjwocTizk19JEglP37dAQtgAfCvVQTEoPP8E+xJY2bV7I5T2ymHsTBGSsdRosRw= =Dkgf -----END PGP SIGNATURE----- --------------enig62CE2673CD586CE4526524E6--