delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2015/02/27/10:54:06

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:from:date:message-id:subject:to
:content-type; q=dns; s=default; b=KCsZuvTc6utLbZNqLwOUylw5tEIS3
nEo9ECrkAJIThOtQkJHFmfDpox//X6nMNwR492VFqvuK3W2d/P5TJYpdgtPsNWE1
VkL2OVrjcglhVr5ZaQthNzLDt4nMFdnoKfCR2UBr8w0oaxUPcA564nnQ9CQEKX7k
yzoXPWHicx/EWI=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:from:date:message-id:subject:to
:content-type; s=default; bh=bAVGu+y8Rg1/QMUCGxpGRqNirCs=; b=w8P
VrGfvhSbIyl3ldPm5OewWHmt4yy1lY0FW0bSXOlfEI7t9ELylDHUgTi6ms8T5Sph
v7oXKag7cnbCNepi1l7hC1h2VrchWUD+GyIU169Ivl0UH/DJxtAOMVNueNrc+uuq
sfA2gDyRO/7vzeyapg7QoZJLrtNYYbyE2To8dVNQ=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=3.9 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,KAM_FROM_URIBL_PCCC,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=no version=3.3.2
X-HELO: mail-lb0-f172.google.com
X-Received: by 10.152.27.232 with SMTP id w8mr8214368lag.51.1425052424398; Fri, 27 Feb 2015 07:53:44 -0800 (PST)
MIME-Version: 1.0
From: A L <al20878 AT gmail DOT com>
Date: Fri, 27 Feb 2015 10:53:23 -0500
Message-ID: <CAKVG1_qiRM-Qgnrp63auuptxBf+-xyP8su_bjt9S8S3u2XLObg@mail.gmail.com>
Subject: Re: Why does CYGWIN double the backslash in execvp()?
To: cygwin AT cygwin DOT com

> 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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019