Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm 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 Date: Sun, 21 Jul 2002 19:43:07 -0400 From: Christopher Faylor To: cygwin AT cygwin DOT com Subject: Re: g++ (v.3.1.1-4) -mno-cygwin with a hello world sample crashes oddly Message-ID: <20020721234307.GC4030@redhat.com> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <20020721170010 DOT GB1183 AT redhat DOT com> <20020721185338 DOT 65304 DOT qmail AT web10105 DOT mail DOT yahoo DOT com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020721185338.65304.qmail@web10105.mail.yahoo.com> User-Agent: Mutt/1.3.23.1i On Sun, Jul 21, 2002 at 08:53:38PM +0200, Sylvain Petreolle wrote: >This thread is not dead. >The result of this shows that Cygwin can at the moment be told to >execute code without having a correct executable file (also COFF >format). > >Cygwin should have detected a non-executable file and >have refused to launch it. Actually if it was going to happen anywhere, it is ash that should have detected it, not cygwin. Since windows (without ntsec) has no concept of an executable bit, unrecognized files are passed directly to /bin/sh. This is similar to unix, except on unix there is the added protection of the executable bit. If the file doesn't have the executable bit set then it is actually never forwarded to /bin/sh by the OS. >What happens here on NT: >if you use incorrect syntax by appending .exe in g++ cmd : >$ g++ -mno-cygwin -c cpplus.cpp -o cpplus.exe ; g++ -mno-cygwin -c >cpplus.cpp -o cpplus >$ ls -l cpplus cpplus.exe >-rw-r--r-- 1 Nom 544 1855 Jul 21 20:38 cpplus >-rwxr-xr-x 1 Nom 544 1855 Jul 21 20:41 cpplus.exe >finally tring to launch it: >$ ./cpplus >BASH: ./cpplus: Permission denied I don't see this behavior on XP. Attempting to run the non-executable program (cpplus in this case) either hangs or gives strange messages. It's possible that, in your case, bash notices the lack of executable bit and never passes things on for execution. I don't know why your experience differs but I am not going to lose sleep over it. >$ ./cpplus.exe >runs and hangs. (note that under Windows ME it doesn't run,saying >permission denied though it's detected as executable by ls). > >two problems: >- ls should show non executable file (problem in cygwin filesystem /ls >excutable detection routine) If the file has a .exe extension, it is assumed to be executable. This is by design. We've had two threads in the last week complaining about cygwin being slow. Every time we open a file to check to see if it's executable we slow things down. >- incorrect code can be launched on NT systems. I've explained what is happening above. As usual, I'd welcome patches to ash to fix this behavior. I'm not concerned about this enough to devote any time to it myself. cgf -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/