Subject: Re: g++ (v.3.1.1-4) -mno-cygwin with a hello world sample crashes oddly
From: "Dylan Cuthbert" <[email-masked]>
To: [email-masked]
Date: Mon, 22 Jul 2002 12:37:22 +0900
Newsgroups: gmane.os.cygwin

Sorry about the wild goose chase but it was very odd behaviour.

In 10 years of using gcc I've never come across the "trying to execute an
.obj file causes crash" problem before, but I was using linux and as you
say, the executable bit wouldn't have got set and I'd have noticed
immediately.

It seems strange that in this day and age, a .exe wouldn't have any info in
it to prevent something that is not an .exe from being run.  To this extent,
any user can rename any file a .exe and cause his/her machine to do very
unstable things, that's just bad all round.  Good old windows strikes again.

Thanks for tracking it down.

---------------------------------
Q-Games, Dylan Cuthbert.
http://www.q-games.com

"Christopher Faylor" <[email-masked]> wrote in message
news:[email-masked]...
> 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/
>
>

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