GHC fails when GHC_PACKAGE_PATH contains trailing slash
When the directory given in GHC_PACKAGE_PATH
contains a trailing slash, GHC stops working completely.
For example, this works:
env GHC_PACKAGE_PATH=/raid/src/ghc/ghc-atomic-writes/_build/stage1/lib/package.conf.d /raid/src/ghc/ghc-atomic-writes/_build/stage1/bin/ghc "--make" "-outputdir" "example-programs-build/" "example-programs/Hello.hs" "-o" "example-programs-build/haskell-hello"
but adding a trailing /
like GHC_PACKAGE_PATH=/path/to/package.conf.d/
fails:
env GHC_PACKAGE_PATH=/raid/src/ghc/ghc-atomic-writes/_build/stage1/lib/package.conf.d/ /raid/src/ghc/ghc-atomic-writes/_build/stage1/bin/ghc "--make" "-outputdir" "example-programs-build/" "example-programs/Hello.hs" "-o" "example-programs-build/haskell-hello"
[1 of 1] Compiling Main ( example-programs/Hello.hs, example-programs-build/Main.o ) [Prelude changed]
example-programs/Hello.hs:1:1: error:
Could not find module ‘Prelude’
There are files missing in the ‘base-4.12.0.0’ package,
try running 'ghc-pkg check'.
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
1 | main :: IO ()
| ^
This is surprising; most programs accept trailing slashes where directories are expected, and shells ofthen TAB-complete directories this way. It wastes developer time when they don't notice.
Trac metadata
Trac field | Value |
---|---|
Version | 8.6.3 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | nh2 |
Operating system | |
Architecture |