X-Recipient: archive-cygwin@delorie.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:message-id:date:from:mime-version:to:subject
	:references:in-reply-to:content-type:content-transfer-encoding;
	 q=dns; s=default; b=TwFM9nBYcYskuT3k2GlaXp9AhIAt3eodK1138qefIZl
	5fjI8Xv3jNsVfDlVnwFl8/p17bT8QoulylLve2P6zfbIHJW6WPHIyYsuye/eJAgH
	EmHhacg4CkqM7t2Pcw4K5rIZvlAV14YRCXXy30hYcXxLeLkCUOnoO5dEfkBD8CTw
	=
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:message-id:date:from:mime-version:to:subject
	:references:in-reply-to:content-type:content-transfer-encoding;
	 s=default; bh=cF5Gx9J3NaoUS60KHMH5+bsTl8M=; b=HgXE1z/4/54OlacQX
	Qhf1sXb4QCRo7jdG08Vs4t7uUjSaNDXpiFOFHMuR5gDO7huVhTKmvUVUtyXfD+vR
	w3vpI4fiLQorPm/ngpiVoVd8m8KU2/aXdQgG8n6XJgCH3moRQbYtEGWfgAD+9orH
	mVjjiQwOndEd6/37nP9hWoaKfg=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=AWL,BAYES_20,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2
X-HELO: mail.lysator.liu.se
Message-ID: <54F0316B.8060108@lysator.liu.se>
Date: Fri, 27 Feb 2015 09:57:15 +0100
From: Peter Rosin <peda@lysator.liu.se>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0
MIME-Version: 1.0
To: cygwin@cygwin.com
Subject: Re: Why does CYGWIN double the backslash in execvp()?
References: <CAKVG1_qOJ2W4f8F_Sz7xh_Ee0uqo3odWr=iSmTzOg+R_Pi5t-A@mail.gmail.com>
In-Reply-To: <CAKVG1_qOJ2W4f8F_Sz7xh_Ee0uqo3odWr=iSmTzOg+R_Pi5t-A@mail.gmail.com>
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit

On 2015-02-27 06:03, A L wrote:
> Thank you for your response.  It may sound plausible but:
> 
>> you tell Cygwin that you want posix semantics
> 
> I can't remember seeing that posix semantics require a C library call
> to modify arguments in the way the shell does;  since when cygwin a
> shell?

E.g. windows processes does not expect the shell to handle wildcards.

>> split arg 2 into two args: "DIR" and "C:\\"
> 
> and why does it make a difference, all of a sudden?  (posix rules no
> longer apply to more than 2 arguments?)  also, if "\\" is followed by
> an additional space, "DIR C:\\ ", then it begins to work as well.

It makes a difference because cmd has non-posixy handling of its command
line, like most windows tools. 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.

On top of that, cmd command line handling is not like other Windows
tools and while I didn't think there were any exceptions to how Cygwin
handled windows processes, apparently there was this exception.

>> Cygwin cannot make exceptions for individual applications
> 
> right!  because cygwin does already know a lot about cmd.exe and
> command.com and treats them very specially in case of a "/c" switch
> followed by exactly one argument!  take a look at spawn.cc.

Oh, you're looking at the code. Then you are ahead of me. I thought
you wanted suggestions for why it didn't work.

I think the code you are looking at is probably sidestepped when you
say /cygdrive/c/.../cmd.exe (posix). If you instead say
c:/.../cmd.exe (windows) the code is in the loop (and it works too).

> btw, on linux, strace for execl() shows no substitution of a lone
> backslash passed in an argument... not posix complying, too?

Do get ridiculous. Linux doesn't have to cope with the insanities
of Windows.

Cheers,
Peter


--
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

