From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MRC9d-0000Je-0L for qemu-devel@nongnu.org; Wed, 15 Jul 2009 17:36:45 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MRC9Y-0000F8-D9 for qemu-devel@nongnu.org; Wed, 15 Jul 2009 17:36:44 -0400 Received: from [199.232.76.173] (port=47163 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MRC9Y-0000Et-7q for qemu-devel@nongnu.org; Wed, 15 Jul 2009 17:36:40 -0400 Received: from mail2.shareable.org ([80.68.89.115]:48619) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MRC9X-0002RD-Nf for qemu-devel@nongnu.org; Wed, 15 Jul 2009 17:36:40 -0400 Date: Wed, 15 Jul 2009 22:36:35 +0100 From: Jamie Lokier Subject: Re: [Qemu-devel] [PATCH] rev3: support colon in filenames Message-ID: <20090715213635.GN3056@shareable.org> References: <4A434009.5010009@redhat.com> <1245998284.6278.99.camel@localhost> <4A447C8D.5000104@kevin-wolf.de> <1246063310.6278.115.camel@localhost> <1246511321.6429.31.camel@localhost> <4A4C754D.10109@redhat.com> <4A4CAD86.9020607@us.ibm.com> <4A4CB39F.5070506@redhat.com> <20090715181405.GB3056@shareable.org> <4A5E4206.20602@web.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4A5E4206.20602@web.de> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jan Kiszka Cc: Kevin Wolf , Anthony Liguori , linuxram@us.ibm.com, qemu-devel@nongnu.org, kvm-devel Jan Kiszka wrote: > > Now, I see one significant hurdle with that: it's quite inconvenient > > for Windows users, typing paths like c:\path\to\dir\file, if those > > backslashes are stipped. > > We could exclude Windows from this (I think to remember that filenames > are more restricted there anyway) or define a different, Windows-only > escape character. I think both of those are bad ideas, because the same management scripts can run on Windows, and for consistency it's not just file names. Even Windows has block devices and network devices :-) Fortunately "where is not ASCII alphanumeric" solves the practical cases where the user types an ordinary pathname. Or the user can type forward slashes just like they do in unix. > > So I propose this as a universal quoting scheme: > > > > \ where is not ASCII alphanumeric. > > > > Shell quoting is easy: > > > > qfile=`printf %s "$file" | sed 's/[^0-9a-zA-Z]/\\\\&/g'` > > > > qemu -drive file="$qfile",if=scsi,media=disk I forgot a very obscure corner case, where the last character of the filename is a newline character. To do the right thing (with Bash at least), it should say '%s\n' instead of %s. Sue me :-) > > Same quoting applied when sending the monitor a command to change a > > CD-ROM file or add a USB disk, for example. > > To me this direction looks more promising than any other proposal so far. I wondered if it was just me... -- Jamie