Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JCaua-0000qG-Oa for qemu-devel@nongnu.org; Wed, 09 Jan 2008 08:24:04 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JCauW-0000nv-RU for qemu-devel@nongnu.org; Wed, 09 Jan 2008 08:24:04 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JCauW-0000nl-NA for qemu-devel@nongnu.org; Wed, 09 Jan 2008 08:24:00 -0500 Received: from ecfrec.frec.bull.fr ([129.183.4.8]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JCauJ-00059C-8h for qemu-devel@nongnu.org; Wed, 09 Jan 2008 08:24:00 -0500 Received: from localhost (localhost [127.0.0.1]) by ecfrec.frec.bull.fr (Postfix) with ESMTP id 9176A19D943 for ; Wed, 9 Jan 2008 14:23:43 +0100 (CET) Received: from ecfrec.frec.bull.fr ([127.0.0.1]) by localhost (ecfrec.frec.bull.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 01682-02 for ; Wed, 9 Jan 2008 14:23:39 +0100 (CET) Received: from ecn002.frec.bull.fr (ecn002.frec.bull.fr [129.183.4.6]) by ecfrec.frec.bull.fr (Postfix) with ESMTP id 51C9C19D920 for ; Wed, 9 Jan 2008 14:23:39 +0100 (CET) Subject: Re: [Qemu-devel] [PATCH] Fix double backslash problem in Windows From: Laurent Vivier In-Reply-To: <80EE317F-D1D2-49A2-8CD2-CC10FA1B158D@web.de> References: <1199871092.4337.4.camel@frecb07144> <1199873069.4337.20.camel@frecb07144> <1199880481.4337.31.camel@frecb07144> <80EE317F-D1D2-49A2-8CD2-CC10FA1B158D@web.de> Date: Wed, 09 Jan 2008 14:24:03 +0100 Message-Id: <1199885043.4337.48.camel@frecb07144> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-smTc5mK+SMq0WN/U6L1E" Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org --=-smTc5mK+SMq0WN/U6L1E Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Le mercredi 09 janvier 2008 =C3=A0 13:27 +0100, Andreas F=C3=A4rber a =C3= =A9crit : > Am 09.01.2008 um 13:08 schrieb Laurent Vivier: >=20 > > Le mercredi 09 janvier 2008 =C3=A0 11:40 +0100, andrzej zaborowski a =20 > > =C3=A9crit : > >> On 09/01/2008, Laurent Vivier wrote: > >>> Le mercredi 09 janvier 2008 =C3=A0 10:31 +0100, Laurent Vivier a =C3= =A9crit : > >>>> Le mardi 08 janvier 2008 =C3=A0 17:17 +0100, Herv=C3=A9 Poussineau a= =C3=A9crit : > >>>>> Hi, > >>>>> > >>>>> On Windows, since December 2nd, files names provided in command =20 > >>>>> line > >>>>> have to double their backslash to work correctly, for example: "-=20 > >>>>> hda > >>>>> c:\\disks\\qemu.qcow" instead of -hda c:\disks\qemu.qcow" > >>>>> This patch removes this need and reverts back to Qemu 0.9.0 =20 > >>>>> behaviour > >>>>> > >>>>> Herv=C3=A9 > >>>>> > >>>> > >>>> I have introduced this behavior to be able to use command line like > >>>> "qemu -hda my\ file", IMHO your patch should be #ifdef for window =20 > >>>> only. > >>> > >>> In fact, this is a wrong example, this case is managed by the shell. > >>> A good example is when we have a filename with a '"' in it: > >>> > >>> qemu -hda 2\\\"file > >>> > >>> to open file 2"file > >> > >> And the correct behaviour for that would be to open the file =20 > >> 2\"file, while > >> > >> qemu -hda 2\"file > >> > >> should open 2"file. The only character that we may need to handle > >> specially should be the comma, I don't know if anyone cares. > > > > You're right... > > but "-hda" is an alias for "-drive file=3D"%s",index=3D%d,media=3Ddisk"= . > > > > So when you type "qemu -hda 2\"file", > > it becomes "qemu -drive file=3D"2"file",index=3D0,media=3Ddisk" > > which gives filename equal to "2file,index=3D0,media=3Ddisk" instead of > > filename equal to 2"file with option index and media. > > > > So the '\' is needed, and you must have "qemu -hda 2\\\"file" to > > have "qemu -drive file=3D"2\"file",index=3D0,media=3Ddisk" and then can > > extract filename to 2"file > > > > In the alias, file=3D"%s" is needed to be able to manage filenames with > > spaces. for instance, if you don't have '"", you will have: > > qemu -hda "my file" > > -> qemu -drive file=3Dmy file,index=3D0,media=3Ddisk > > and thus filename is "my"... >=20 > That's the classic SQL insertion problem. Can't you just have " =20 Yes, or when we use ssh to execute a command on a remote host. > replaced with \" before formatting it as "%s", like you'd do in PHP or =20 > elsewhere? Well, as the string is already parsed in drive_init() to extract options, it seems logic to manage quotes there...=20 Laurent --=20 ----------------- Laurent.Vivier@bull.net ------------------ "La perfection est atteinte non quand il ne reste rien =C3=A0 ajouter mais quand il ne reste rien =C3=A0 enlever." Saint Exup=C3=A9ry --=-smTc5mK+SMq0WN/U6L1E Content-Type: application/pgp-signature; name=signature.asc Content-Description: Ceci est une partie de message =?ISO-8859-1?Q?num=E9riquement?= =?ISO-8859-1?Q?_sign=E9e?= -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQBHhMrz9Kffa9pFVzwRAoiqAJ9UcqR6N/0HsZJG9kHaTRSWzqjPNQCfQ+qk OLWSwkdi7Hdr5ZO950ks7pM= =ILjp -----END PGP SIGNATURE----- --=-smTc5mK+SMq0WN/U6L1E--