Calling ghc without -o overwrites symbolic links
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.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.0.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |