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

Anthony Liguori
2009-07-02T12:52:24Z

Kevin Wolf wrote:
> Ram Pai schrieb:
>
>> Problem: It is impossible to feed filenames with the character colon because
>> qemu interprets such names as a protocol. For example filename scsi:0, is
>> interpreted as a protocol by name "scsi".
>>
>> This patch allows user to escape colon characters. For example the above
>> filename can now be expressed either as 'scsi\:0' or as file:scsi:0
>>
>> anything following the "file:" tag is interpreted verbatim. However if "file:"
>> tag is omitted then any colon characters in the string must be escaped using
>> backslash.
>>
>
> Anthony has already committed version 2 of the patch, so this one
> doesn't apply any more.
>
> By the way, I'm still not convinced that this use of backslashes gives
> us anything but yet another special character that worked just fine
> before. I guess this is going to be annoying for Windows users.
>

It ends up working out for Windows users because colons are invalid in
Windows file names.

What's the solution to this problem is we don't escape?

>> fat:c:\path\to\dir\:floppy\: is a fat file by name \path\to\dir:floppy:
>> NOTE:The above example cannot be expressed using the "file:" protocol.
>>
>
> And it doesn't need to. It's already expressed using the "fat:"
> protocol, so we won't accidentally mistake c for the protocol name.
>
> You might have a point with a directory named :floppy: or so.
>

For 0.12, maybe we should take a hard look at refactoring -drive and
completely splitting this stuff. I think we ought to come up with a
syntax where we can pass file names as independent arguments so that no
special escaping is required.

Regards,

Anthony Liguori