Opened 7 years ago

Closed 7 years ago

Last modified 12 months ago

#2521 closed bug (fixed)

Trailing colon on GHC_PACKAGE_PATH doesn't work with ghc-pkg.

Reported by: cjs Owned by: simonmar
Priority: normal Milestone:
Component: Compiler Version: 6.8.3
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


According to section of the Users' Guide, appending a colon to GHC_PACKAGE_PATH should include the system libraries, and this can be verified with ghc-pkg. While the colon does appear to work for ghci (as verified with -v), it does not appear to work for ghc-pkg.

$ echo '[]' > temp.conf
$ export GHC_PACKAGE_PATH=`pwd`/temp.conf:
ghc-pkg list

Change History (5)

comment:1 Changed 7 years ago by simonmar

  • difficulty set to Unknown
  • Owner set to simonmar

I'm in ghc-pkg at the moment...

comment:2 Changed 7 years ago by simonmar

  • Resolution set to fixed
  • Status changed from new to closed


Mon Aug 18 12:33:45 BST 2008  Simon Marlow <[email protected]>
  * FIX #2521: trailing colon in GHC_PACKAGE_PATH
  This was broken in the System.FilePath switchover, since filepath's
  splitSearchPath doesn't do what we want (it ignores empty
  components on Windows, and treats them as "." on Unix).  So we use our
  own hand-rolled version, just like GHC.

comment:3 Changed 7 years ago by simonmar

  • Architecture changed from Unknown to Unknown/Multiple

comment:4 Changed 7 years ago by simonmar

  • Operating System changed from Multiple to Unknown/Multiple

comment:5 Changed 12 months ago by Austin Seipp <austin@…>

In 6fc78fdfa1482a31ed7b586f20c9d7cb592ea944/ghc:

Refactor: use System.FilePath.splitSearchPath

To address #2521 ("Trailing colon on GHC_PACKAGE_PATH doesn't work with
ghc-pkg"), we were using a custom version of splitSearchPath (e4f46f5de). This
solution however caused issue #9698 ("GHC_PACKAGE_PATH should be more lenient
for empty paths").

This patch reverts back to System.FilePath.splitSearchPath (fixes #9698) and
adresses (#2521) by testing for a trailing search path separators explicitly
(instead of implicitly using empty search path elements).

Empty paths are now allowed (ignored on Windows, interpreted as current
directory on Posix systems), and trailing path separator still tack on the
user and system package databases.

Also update submodule filepath, which has a version of splitSearchPath which
handles quotes in the same way as our custom version did.

Test Plan:
$ GHC_PACKAGE_PATH=/::/home: ./ghc-pkg list
db stack: ["/",".","/home","<userdb>","<systemdb>"]

Reviewers: austin

Reviewed By: austin

Subscribers: thomie, carter, simonmar

Differential Revision:

GHC Trac Issues: #2521, #9698
Note: See TracTickets for help on using tickets.