delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/12/31/08:42:47

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
In-Reply-To: <hhhlmo$68u$1@ger.gmane.org>
References: <hhhlmo$68u$1 AT ger DOT gmane DOT org>
Date: Thu, 31 Dec 2009 15:42:37 +0200
Message-ID: <1ef5a52f0912310542o7b81b938nc7efeb1582e1fa18@mail.gmail.com>
Subject: Re: cygwin passes argv with preserved (") quote. and it is undesired result.
From: Csaba Raduly <rcsaba AT gmail DOT com>
To: cygwin AT cygwin DOT com, jojelino AT gmail DOT com
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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

On Thu, Dec 31, 2009 at 10:00 AM, jojelino  wrote:
> hi
> here is testcase to reproduce the problem
>
> #include <stdio.h>
> #include <assert.h>
> int main(int argc, char**argv)
> {
> printf("argv %s",argv[1]);
> open(argv[1],"r");
> assert(fp);
> return 0;
> }
> build
> make =A4=B1.txt in directory.
> and run in cmd.exe
> type,
> a "=A4=B1.txt"
>
> and it complains file can't be opened.
> and you can see argv[1]  is passed with preserved quote (") although it is
> invoked in winshell
> it must be eliminted when it is transduced to cygwin environment.
>
> but when parent process is cygwin, it gives no complaint
>>strace a "=A4=B1.txt"
> in result, is it designed to do so?

Yes. "parent process is cygwin" probably means that a.exe was started
from bash. The quote character is special for bash; see for example
http://linux.about.com/od/bgb_guide/a/gdebgb30t03.htm

This means that when started from bash, a.exe gets what's inside the
quotes, without the quotes themselves. cmd.exe may behave differently.


Hope this helps,
Csaba
--=20
Life is complex, with real and imaginary parts

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