#16360: GHC fails when GHC_PACKAGE_PATH contains trailing slash

"GHC" <[email protected]>
Newsgroups gmane.comp.lang.haskell.glasgow.bugs
Message-ID <[email protected]>
#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>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.