"#!..." (Re[2]: cabal configure screw-up)

Frederik Eaton frederik at a5.repetae.net
Sun Aug 28 14:42:01 EDT 2005

On Sat, Aug 27, 2005 at 10:38:42AM +0100, Duncan Coutts wrote:
> On Fri, 2005-08-26 at 18:36 -0700, Frederik Eaton wrote:
> > On Fri, Aug 26, 2005 at 09:37:20AM +0300, Krasimir Angelov wrote:
> > > It isn't so easy to simulate #! behaviour in rawSystem because the
> > > file path after #! is in Unix style. Cygwin keeps the mapping between
> > > Unix style paths and the native Windows paths. Usually /usr/bin/sh is
> > > mapped to something like c:\cygwin\bin\sh.exe. All executables which
> > > are compiled with cygwin.dll runtime library are working with Unix
> > > paths which are silently mapped to native paths. All GHC compiled
> > > executables are linked to the native msvcrt.dll runtime library  so
> > > they understands only the native paths. I don't think that rawSystem
> > > should try to emulate Unix behaviour.
> > 
> > Then maybe Cabal needs to be linked to cygwin.dll? I don't know
> > anything about Cygwin, or MinGW, or what the difference is between the
> > two, but if a program written in Haskell running *within* Cygwin can't
> > execute a #! script using rawSystem then something is wrong.
> GHC on windows is now a native application and it compiles native
> windows applications. That is it doesn't link with any unix emulation
> libraries. For the vast majority of windows users this is a good thing.
> (GHC has become vastly more popular amongst windows users since it
> stopped depending on cygwin.)
> I think we just have to accept that windows doesn't understand the #!
> thing.

It seems that it should be possible for the same installation of ghc
to behave both ways depending on the environment in which it is run.
If ghc running in unix recognizes "#!", then it seems that ghc running
in a unix emulation environment inside Windows should do the same
thing, for compatibility, even if the default behavior in the DOS
prompt or whatever it is called is different.



More information about the Libraries mailing list