Don't use single quotes as quotes in command-line parsing on windows?

John Arbash Meinel john at arbash-meinel.com
Sat Nov 7 16:19:48 GMT 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Philippe Lhoste wrote:
> On 06/11/2009 18:51, Alexander Belchenko wrote:
>> In my understanding this will break usual behavior of windows
>> programs, because standard windows shell and especially
>> CommandLineToArgv Win32 API function does not support single quotes in
>> this manner. Especially as Martin (gzlist) noted it will break work
>> with filenames which has single quote inside:
> 
> I agree. For better or worse, single quotes have no shell meaning in
> Windows, something like del 'ab cd' will be perceived as a command with
> two arguments.
> 
>> I've sent merge proposal to disable support for single quote:
>>
>> https://code.launchpad.net/~bialix/bzr/no-single-quote-on-win32/+merge/14537
> 
> 
> Not sure what I can do with this merge proposal, but well, I vocally
> give my two cents here...
> 

So the point is that it doesn't have to be interpreted that way. I've
stayed out of the debate for a bit to see what responses we would get.

Obviously I feel that "bzr foo 'ab cd'" should be treated as a single
string as it does elsewhere (otherwise I wouldn't have implemented it
that way.)

I certainly remember other people transitioning to bzr (back where I
worked before I was hired by Canonical), and trying to do:

 bzr commit -m 'this is some text'

was very confusing for them that it would fail with:

  No such file: is

I honestly feel that the number of files that will be versioned which
have an ' in them is very low. Mabye I'm wrong, but I'd like actual
evidence for that fact.


As for other issues raised, I think someone mentioned skipping the \"
escape, and simplifying the parser. However, I didn't add that escape
for filenames. That one is more about commit messages, and other such
free-form strings. (Most shells distinguish between "" and '' in that
the former allows you to use '\' as an escape character and the latter
does not do any escaping, it just terminates at the next ' character.)


Honestly, I'm much more concerned with whether this would effect
qbzr/bzr-explorer than the specific details of the command line. Which
is why it took so long for me to get around to doing something about it.
I think I was mostly motivated because we were getting a bunch of
requests for glob expansion that were being handled one-by-one.

Anyway, Alexander's patch looks fine for removing '' quoting. *I* prefer
'' quoting so I'm not going to vote approve. However, if the consensus
is that I'm wrong, then I can certainly be overridden.

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkr1niQACgkQJdeBCYSNAAMN7ACdFYt5+vGCVIL7U3fAGC75pFjc
aP8AnjvXpCS72/4KxIN38r0WJnE3HioB
=CBvG
-----END PGP SIGNATURE-----



More information about the bazaar mailing list