delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2015/02/27/03:57:43

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: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 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=-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 AT lysator DOT liu DOT 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 AT cygwin DOT com
Subject: Re: Why does CYGWIN double the backslash in execvp()?
References: <CAKVG1_qOJ2W4f8F_Sz7xh_Ee0uqo3odWr=iSmTzOg+R_Pi5t-A AT mail DOT gmail DOT com>
In-Reply-To: <CAKVG1_qOJ2W4f8F_Sz7xh_Ee0uqo3odWr=iSmTzOg+R_Pi5t-A@mail.gmail.com>

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

- Raw text -


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