From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JCf7L-0001SR-TN for qemu-devel@nongnu.org; Wed, 09 Jan 2008 12:53:31 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JCf7K-0001Qk-Tu for qemu-devel@nongnu.org; Wed, 09 Jan 2008 12:53:31 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JCf7K-0001QQ-OX for qemu-devel@nongnu.org; Wed, 09 Jan 2008 12:53:30 -0500 Received: from nz-out-0506.google.com ([64.233.162.225]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JCf7K-0003dC-Bp for qemu-devel@nongnu.org; Wed, 09 Jan 2008 12:53:30 -0500 Received: by nz-out-0506.google.com with SMTP id f1so738610nzc.37 for ; Wed, 09 Jan 2008 09:53:28 -0800 (PST) Message-ID: <47850A1B.1040200@codemonkey.ws> Date: Wed, 09 Jan 2008 11:53:31 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] Fix double backslash problem in Windows References: <1199871092.4337.4.camel@frecb07144> <1199873069.4337.20.camel@frecb07144> <1199880481.4337.31.camel@frecb07144> In-Reply-To: <1199880481.4337.31.camel@frecb07144> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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 Cc: =?UTF-8?B?SGVydsOpIFBvdXNzaW5lYXU=?= Laurent Vivier wrote: > Le mercredi 09 janvier 2008 à 11:40 +0100, andrzej zaborowski a écrit : > >> On 09/01/2008, Laurent Vivier wrote: >> >>> Le mercredi 09 janvier 2008 à 10:31 +0100, Laurent Vivier a écrit : >>> >>>> Le mardi 08 janvier 2008 à 17:17 +0100, Hervé Poussineau a écrit : >>>> >>>>> Hi, >>>>> >>>>> On Windows, since December 2nd, files names provided in command line >>>>> have to double their backslash to work correctly, for example: "-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 behaviour >>>>> >>>>> Hervé >>>>> >>>>> >>>> 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 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 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="%s",index=%d,media=disk". > > So when you type "qemu -hda 2\"file", > it becomes "qemu -drive file="2"file",index=0,media=disk" > which gives filename equal to "2file,index=0,media=disk" instead of > filename equal to 2"file with option index and media. > The proper solution is to escape the files before doing the snprintf(). Regards, Anthony Liguori > So the '\' is needed, and you must have "qemu -hda 2\\\"file" to > have "qemu -drive file="2\"file",index=0,media=disk" and then can > extract filename to 2"file > > In the alias, file="%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=my file,index=0,media=disk > and thus filename is "my"... > > >> I mean, some characters do need special handling but reimplementing >> full escaping logic like in the shell is imho not needed and leads to >> typing things like \\\" and forces GUIs to learn the new rules too. >> And doesn't justify making unix and ms-windows behaviour different. >> > > I totally agree with you, but I didn't find any other solution to manage > this. > > Regards, > Laurent >