This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: g++ (v.3.1.1-4) -mno-cygwin with a hello world sample crashes oddly


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]