Opened 9 years ago

Closed 9 years ago

Last modified 3 years 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: None/Unknown 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 9 years ago by simonmar

difficulty: Unknown
Owner: set to simonmar

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

comment:2 Changed 9 years ago by simonmar

Resolution: fixed
Status: newclosed


Mon Aug 18 12:33:45 BST 2008  Simon Marlow <>
  * 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 9 years ago by simonmar

Architecture: UnknownUnknown/Multiple

comment:4 Changed 9 years ago by simonmar

Operating System: MultipleUnknown/Multiple

comment:5 Changed 3 years 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.