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

Kevin Wolf
2009-07-16T08:03:15Z

Jamie Lokier schrieb:
> 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 \<char> 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?

I absolutely agree with your intention here (maybe except Windows,
haven't thought about that a lot).

But from an implementation POV, this would need a major rework of the
parsing code. The problem is that to do this universally you need to
have one central place where everything is parsed. We currently don't
have that.

We have the command line parser that needs comma and equals for its
parsing. We have the block code that needs the colon for protocols. We
have block drivers that again separate options by colons. And so on.

So currently we can't handle backslashes when parsing command line
options. They would be missing in the block code for escaping colons. We
can't handle all colons in the generic block code, the stripped
backslashes would be missing in vvfat and nbd.

Once we have decided what the solution should look like (including
Windows and other problems), it might be worth the effort. But I can
promise that it's going to be much more than just one patch.

Kevin