X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Message-ID: <47DCF4D4.7C1061BB@dessent.net> Date: Sun, 16 Mar 2008 03:22:12 -0700 From: Brian Dessent X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U) MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: compiling C w/cygwin vs. -mno-cygwin; inconsistent "C" behavior References: <47DCE267 DOT 5060508 AT tlinx DOT org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Reply-To: cygwin AT cygwin DOT com Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: 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 Linda Walsh wrote: > When I use the "no-cygwin" version, filenames with spaces in them get split into > separate arguments, but if I run the "cygwin" version, the file name isn't split > on space boundaries. > > I'm 'guessing', but shouldn't the breaking of apart of arguments behave > the same whether I compile with cygwin or -mno-cygwin? No, what you're seeing is totally expected behavior. In native windows if you want to support filenames with spaces, you have to include physical quote characters in the command line. That's because CreateProcess does not actually have an argv, there is no such thing as an argv in windows -- a process gets created with a monolithic command line. If it wants that command line in the form of individual arguments, it has to parse it (or ask the system/CRT to parse it for it.) That means that the only way to make arguments with spaces survive intact is by quoting. And Cygwin does that quoting for you. The native runtime MSVCRT does not, which is what is executing when you're using -mno-cygwin. If you don't like its behavior then take it up with Microsoft, it's out of our hands. There is no guarantee of consistency whatsoever, because -mno-cygwin literally means "don't use any Cygwin, use the Microsoft runtime (MinGW)". For what it's worth the MinGW project has a set of exec() wrappers that help to sanitize the situation a little. Brian -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/