#5848: Calling ghc without -o overwrites symbolic links
--------------------+-------------------------------------------------------
 Reporter:  Ptival  |          Owner:                                
     Type:  bug     |         Status:  new                           
 Priority:  normal  |      Component:  Compiler                      
  Version:  7.0.3   |       Keywords:  linker symbolic link overwrite
       Os:  Linux   |   Architecture:  x86_64 (amd64)                
  Failure:  Other   |       Testcase:                                
Blockedby:          |       Blocking:                                
  Related:          |  
--------------------+-------------------------------------------------------
 This might not be a bug (might even be a feature...) but I find it
 strange:

 When you call ghc name.hs, after compiling your .hs .o:

 - if you don't have a file "name", it creates the executable "name"

 - if you have a folder or a file called "name", it does nothing

 - if you have a symbolic link called "name", it is erased and replaced by
 the executable "name"

 This last one behavior is (not entirely) surprising. It sure is a good
 idea to provide a -o, but while dirty hacking a test.hs while I had a
 symlink to some test directory, it happened to me. Maybe for some reason
 we want this to happen.

 Steps to reproduce:


 {{{
 $ echo "FOO" > linked
 $ ln -s linked link
 $ echo "main = return ()" > link.hs
 $ ls -lh link
 lrwxrwxrwx 1 varobert 21134 6 Feb  6 14:25 link -> linked
 $ cat link
 FOO
 $ ghc link.hs
 [1 of 1] Compiling Main             ( link.hs, link.o )
 Linking link ...
 $ ls -lh link
 -rwxr-xr-x 1 varobert 21134 930K Feb  6 14:26 link
 }}}


 I'm not cat-ing link again but you get it.

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

_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to