From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MR8zj-0005jl-QF for qemu-devel@nongnu.org; Wed, 15 Jul 2009 14:14:19 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MR8zf-0005jJ-5t for qemu-devel@nongnu.org; Wed, 15 Jul 2009 14:14:19 -0400 Received: from [199.232.76.173] (port=52489 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MR8zf-0005jC-1d for qemu-devel@nongnu.org; Wed, 15 Jul 2009 14:14:15 -0400 Received: from mail2.shareable.org ([80.68.89.115]:40034) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MR8ze-0003Nl-KQ for qemu-devel@nongnu.org; Wed, 15 Jul 2009 14:14:14 -0400 Date: Wed, 15 Jul 2009 19:14:05 +0100 From: Jamie Lokier Subject: Re: [Qemu-devel] [PATCH] rev3: support colon in filenames Message-ID: <20090715181405.GB3056@shareable.org> References: <1245862739.6278.7.camel@localhost> <1245866233.6278.17.camel@localhost> <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4A4CB39F.5070506@redhat.com> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: Anthony Liguori , linuxram@us.ibm.com, qemu-devel@nongnu.org, kvm-devel Kevin Wolf wrote: > Can we at least allow \, instead of ,, in parameter parsing, so that the > backslash has the practical benefit of being a single universal escape > character? Is there a good reason why we cannot simply use \ to escape _any_ character, in every context where a user-supplied string/name/path/file is used? I'm thinking of consistency here. Instead of special cases for filenames, why not a standard scheme for all the places in command lines _and_ the monitor where a name/path/file is needed? There are many examples where it would be useful if unusual characters didn't break things, they simply worked. Examples: -vnc unix: path, -net port: device path, -net script path, -net sock= path, -net group= groupname, tap and bt device names. \ is an obvious scheme to standardise on given QEMU's unix shell heritage. It would work equally well for command line options (which are often comma-separated) and for monitor commands (which are often space-separated). It would have the nice property of being easy for management programs/scripts to quote, without them having a special list of characters to quote, without needing to update them if QEMU needs to quote more characters in future for some reason. 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. 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 Same quoting applied when sending the monitor a command to change a CD-ROM file or add a USB disk, for example. -- Jamie