Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
chreekat opened this issue Dec 9, 2024 · 2 comments
Open

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

chreekat opened this issue Dec 9, 2024 · 2 comments

Comments

@chreekat
Copy link
Collaborator

chreekat commented Dec 9, 2024

Describe the bug
See haskell/haskell-language-server#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
@chreekat
Copy link
Collaborator Author

chreekat commented Dec 9, 2024

Another thing that does work as expected is ghci app/Main.hs.

@chreekat
Copy link
Collaborator Author

chreekat commented Dec 9, 2024

More data:

[b@kuusi:~/tmp/symlinkmain]$ cabal repl --verbose app/Main.hs
this build was affected by the following (project) config files:
creating
/home/b/.cabal/script-builds/0b6a959fceab84b0f3ec6d32f707d450612c92c9525feeb03ca5
creating
/home/b/.cabal/script-builds/0b6a959fceab84b0f3ec6d32f707d450612c92c9525feeb03ca5
creating
/home/b/.cabal/script-builds/0b6a959fceab84b0f3ec6d32f707d450612c92c9525feeb03ca5/cache
CallStack (from HasCallStack):
  withMetadata, called at src/Distribution/Simple/Utils.hs:368:14 in Cabal-3.10.3.0-1vhmrBuGLi1Io7h0G4FK7T:Distribution.Simple.Utils
Error: cabal: Failed extracting script block: `{- cabal:` start marker not
found


[b@kuusi:~/tmp/symlinkmain]$ cat ~/.cabal/script-builds/0b6a959fceab84b0f3ec6d32f707d450612c92c9525feeb03ca5/scriptlocation
/home/b/tmp/symlinkmain/app/Real.hs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant