Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JCa3C-0001fz-16 for qemu-devel@nongnu.org; Wed, 09 Jan 2008 07:28:54 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JCa38-0001dQ-4h for qemu-devel@nongnu.org; Wed, 09 Jan 2008 07:28:53 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JCa37-0001dJ-W7 for qemu-devel@nongnu.org; Wed, 09 Jan 2008 07:28:50 -0500 Received: from fmmailgate03.web.de ([217.72.192.234]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JCa37-00008K-HZ for qemu-devel@nongnu.org; Wed, 09 Jan 2008 07:28:50 -0500 Received: from smtp06.web.de (fmsmtp06.dlan.cinetic.de [172.20.5.172]) by fmmailgate03.web.de (Postfix) with ESMTP id CA3C0C3F7EDA for ; Wed, 9 Jan 2008 13:28:12 +0100 (CET) Received: from [91.18.110.216] (helo=[10.0.1.1]) by smtp06.web.de with asmtp (TLSv1:AES128-SHA:128) (WEB.DE 4.109 #226) id 1JCa2W-0003z3-00 for qemu-devel@nongnu.org; Wed, 09 Jan 2008 13:28:12 +0100 Message-Id: <80EE317F-D1D2-49A2-8CD2-CC10FA1B158D@web.de> From: =?ISO-8859-1?Q?Andreas_F=E4rber?= In-Reply-To: <1199880481.4337.31.camel@frecb07144> Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Apple Message framework v915) Subject: Re: [Qemu-devel] [PATCH] Fix double backslash problem in Windows Date: Wed, 9 Jan 2008 13:27:51 +0100 References: <1199871092.4337.4.camel@frecb07144> <1199873069.4337.20.camel@frecb07144> <1199880481.4337.31.camel@frecb07144> Sender: andreas.faerber@web.de 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 Am 09.01.2008 um 13:08 schrieb Laurent Vivier: > Le mercredi 09 janvier 2008 =E0 11:40 +0100, andrzej zaborowski a =20 > =E9crit : >> On 09/01/2008, Laurent Vivier wrote: >>> Le mercredi 09 janvier 2008 =E0 10:31 +0100, Laurent Vivier a =E9crit = : >>>> Le mardi 08 janvier 2008 =E0 17:17 +0100, Herv=E9 Poussineau a = =E9crit : >>>>> 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=E9 >>>>> >>>> >>>> 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"... That's the classic SQL insertion problem. Can't you just have " =20 replaced with \" before formatting it as "%s", like you'd do in PHP or =20= elsewhere? Andreas=