This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Why does CYGWIN double the backslash in execvp()?


> What I think happens is that since you
> specify a full posix path to cmd, you get posix semantics and none of
> the Windows compatibilty crap kicks in.

that may be, if your very own suggestion to split the last arg in two worked
just fine with the full posix path, i.e. while this set of arguments:

"/cygdrive/c/windows/system32/cmd.exe" "/c" "DIR C:\\"

does not work correctly (supposedly because of invoking posix behavior)
and results in a command line with the trailing backslash doubled:
"C:\\windows\\system32\\cmd.exe /c DIR C:\\\\"; this one:

"/cygdrive/c/windows/system32/cmd.exe" "/c" "DIR" "C:\\"

works just fine (the resultant command line looks like this,
"C:\\windows\\system32\\cmd.exe /c DIR C:\\"; and obviously whatever
doubled the backslash in the above, does not kick in here);

but: the posix path in argv[0] is the same in both; so it must not be
the reason!

two probable causes are: special treatment of the magic three-argument
windows shell; or special-handling of an argument containing a space:

In order to be preserved the arg gets enveloped in double quotes, so
the trailing
backslash there would have caused a runaway string (the ending quote escaping)
and so it must be doubled for safety!

The latter also explains why "DIR C:\\ " (a trailing space) magically
works, too.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]