[GHC] #16360: GHC fails when GHC_PACKAGE_PATH contains trailing slash

GHC ghc-devs at haskell.org
Sat Feb 23 23:46:41 UTC 2019


#16360: GHC fails when GHC_PACKAGE_PATH contains trailing slash
-------------------------------------+-------------------------------------
           Reporter:  nh2            |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.6.3
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  GHC doesn't work
  Unknown/Multiple                   |  at all
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 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.

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/16360>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list