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: References: 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 To: cygwin AT cygwin DOT com, jojelino AT gmail DOT com Content-Type: text/plain; charset=GB2312 Content-Transfer-Encoding: quoted-printable Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , 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 > #include > 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