qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] rev3: support colon in filenames


From: Jamie Lokier
Subject: Re: [Qemu-devel] [PATCH] rev3: support colon in filenames
Date: Wed, 15 Jul 2009 22:36:35 +0100
User-agent: Mutt/1.5.13 (2006-08-11)

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 <char> 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:
> > 
> >     \<char> where <char> 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]