haskell / haskell/cabal

`cabal repl app/Main.hs` fails if Main.hs is a symlink

Open
#10,627 2 comments 0 reactions 0 assignees View on GitHub
needs triage type: bug
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

**Describe the bug**
See https://github.com/haskell/haskell-language-server/issues/4462, which I will copy here in full (changing relevant details)

### Your environment

Which OS do you use?
**NixOS 24.05.6966.190c31a89e5e (Uakari)**

Which version of GHC do you use and how did you install it?
**The Glorious Glasgow Haskell Compilation System, version 9.6.5** from OS package

How is your project built (alternative: link to the project)?
**cabal build**

### Steps to reproduce

```
cabal init --simple --exe
mv app/Main.hs app/Real.hs
ln -sr app/Real.hs ap/Main.hs
cabal repl app/Main.hs
```

### Expected behaviour

```
[b@kuusi:~/tmp/symlinkmain]$ cabal repl app/Main.hs
Build profile: -w ghc-9.6.5 -O1
In order, the following will be built (use -v for more details):
- symlinkmain-0.1.0.0 (exe:symlinkmain) (first run)
Preprocessing executable 'symlinkmain' for symlinkmain-0.1.0.0..
GHCi, version 9.6.5: https://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/b/Projects/dotfiles/ghci
[1 of 2] Compiling Main ( app/Main.hs, interpreted )
Ok, one module loaded.
|*Main|
λ
Leaving GHCi.
```

Note that this works fine if the repl is called with no arguments, e.g. as `cabal repl`!

### Actual behaviour

```
[b@kuusi:~/tmp/symlinkmain]$ cabal repl app/Main.hs
Error: cabal: Failed extracting script block: `{- cabal:` start marker not
found
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.