Skip to content
  • Thomas Miedema's avatar
    Refactor: use System.FilePath.splitSearchPath · 6fc78fdf
    Thomas Miedema authored
    Summary:
    To address #2521 ("Trailing colon on GHC_PACKAGE_PATH doesn't work with
    ghc-pkg"), we were using a custom version of splitSearchPath (e4f46f5d). 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: https://phabricator.haskell.org/D414
    
    GHC Trac Issues: #2521, #9698
    6fc78fdf