[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: start-commit.bat

From: Duncan Booth <duncan.booth_at_suttoncourtenay.org.uk>
Date: 2007-11-08 10:39:22 CET

Karl Fogel <kfogel@red-bean.com> wrote:

>> A comma works fine if the whole list is double-quoted, and we should
>> probably be quoting all parameters anyway to handle spaces in paths,
>> etc. if APR isn't already.
>
> Hmmm. But this isn't going through a shell. If we put double quotes
> around something, then the double quotes will actually be there in the
> argument, right? That is, if you write your hook program in C, then
> argv[3][0] == '"', no?

No

It doesn't matter on windows: the double quotes are handled by the
application not the shell. Windows respects the quote marks when it is
looking for things like command separators, but the entire string is
passed through unaltered to the application, and the application then
has to parse the string. If it is a C runtime then argv is generated by
the runtime, not by the shell.

e.g.

#include <stdio.h>

int main(int argc, char **argv) {
    int i;
    for (i = 0; i < argc; i++) {
        printf("arg %d: %s\n", i, argv[i]);
    };
    return 0;
}

... compiled to a.exe using MinGW or Microsoft C/C++, it doesn't matter
...

C:\Temp>\python25\python
Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit
(Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.spawnl(os.P_WAIT, 'a.exe', 'a.exe', '1', '2', '3,4,5')
arg 0: a.exe
arg 1: 1
arg 2: 2
arg 3: 3,4,5
0
>>> os.spawnl(os.P_WAIT, 'a.exe', 'a.exe', '1', '2', '"3,4,5"')
arg 0: a.exe
arg 1: 1
arg 2: 2
arg 3: 3,4,5
0
>>> os.spawnl(os.P_WAIT, 'a.exe', 'a.exe', '1 2 "3,4,5"')
arg 0: a.exe
arg 1: 1
arg 2: 2
arg 3: 3,4,5
0
>>>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Nov 8 10:41:26 2007

This is an archived mail posted to the Subversion Dev mailing list.