sol / doctest

An implementation of Python's doctest for Haskell
https://hackage.haskell.org/package/doctest
MIT License
372 stars 72 forks source link

doctest-0.23 seems to look for ghc in hardwired path #459

Open andreasabel opened 6 days ago

andreasabel commented 6 days ago

Latest doctest seems to want to access /usr/local/bin/ghc-VERSION even though I reinstalled ghc with ghcup:

$ ghc -V
The Glorious Glasgow Haskell Compilation System, version 9.10.1

$ which ghc
/Users/abel/.ghcup/bin/ghc

$ cabal install doctest --ignore-project
Resolving dependencies...
Copying 'doctest' to '/Users/abel/.cabal/bin/doctest'

$ doctest -V
doctest: /usr/local/bin/ghc-9.10.1: getPermissions:getFileStatus: does not exist (No such file or directory)
HasCallStack backtrace:
  collectBacktraces, called at libraries/ghc-internal/src/GHC/Internal/Exception.hs:92:13 in ghc-internal:GHC.Internal.Exception
  toExceptionWithBacktrace, called at libraries/ghc-internal/src/GHC/Internal/IO.hs:260:11 in ghc-internal:GHC.Internal.IO
  throwIO, called at libraries/ghc-internal/src/GHC/Internal/IO/Exception.hs:315:19 in ghc-internal:GHC.Internal.IO.Exception
  ioException, called at libraries/ghc-internal/src/GHC/Internal/IO/Exception.hs:319:20 in ghc-internal:GHC.Internal.IO.Exception

The problem seems that doctest is relying on the ghc-paths to provide the path to GHC.
Cabal does not seem provision for the case that one removes GHC and installs it in another place; i.e. it is happy to reuse the .cabal/store/ghc-xyz database for a compiler that is in a different location. In combination with a ghc-paths library that fixes static paths at its own compile time, this crashes doctest.

Removing the build products for ghc-paths and doctest from the cabal store fixes the problem.

sol commented 1 day ago

I'm not sure if this issue is "actionable". This is how things have been working for 15 years. It's the same approach that haddock uses. I'm not exactly sure what doctest should do about it.

Any thoughts?