[GHC] #9930: By default, a source code would get overwritten by executable on *nix

GHC ghc-devs at haskell.org
Sat Dec 27 13:15:50 UTC 2014


#9930: By default, a source code would get overwritten by executable on *nix
-------------------------------------+-------------------------------------
       Reporter:  Rufflewind         |                   Owner:
           Type:  bug                |                  Status:  new
       Priority:  normal             |               Milestone:
      Component:  Compiler           |                 Version:  7.8.4
       Keywords:                     |        Operating System:
   Architecture:  Unknown/Multiple   |  Unknown/Multiple
     Difficulty:  Unknown            |         Type of failure:  Other
     Blocked By:                     |               Test Case:
Related Tickets:                     |                Blocking:
                                     |  Differential Revisions:
-------------------------------------+-------------------------------------
 If I have a source code without an extension, say `foo`, and I forget to
 specify the output file via `-o`, GHC will overwrite it with the
 executable itself after compilation.  This occurs only on *nix-like
 operating systems.  Presumably something similar could happen on Windows –
 fortunately, those who use `.exe` for source code are probably among the
 minority.

 Minimum example:

 {{{#!sh
 #!/bin/sh
 echo >foo 'main=undefined'
 ghc -x hs foo
 less foo     # 'foo' now contains binary data
 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9930>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list