diff options
| author | Kevin Buhr <buhr@asaurus.net> | 2019-05-03 18:15:44 -0500 | 
|---|---|---|
| committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-06-09 18:42:57 -0400 | 
| commit | 9d238791862e8b128d397a1c0317986ea82ed000 (patch) | |
| tree | a1dd2557a5be4ea1d2548638f7d4cdd785e8b335 /compiler/main/Packages.hs | |
| parent | b9fe91fce5cf5ab233ab48a64e6a49caf1beced3 (diff) | |
| download | haskell-9d238791862e8b128d397a1c0317986ea82ed000.tar.gz | |
Handle trailing path separator in package DB names (#16360)
Package DB directories with trailing separator (provided via
GHC_PACKAGE_PATH or via -package-db) resulted in incorrect calculation of
${pkgroot} substitution variable.  Keep the trailing separator while
resolving as directory or file, but remove it before dropping the last
path component with takeDirectory.
Closes #16360.
Diffstat (limited to 'compiler/main/Packages.hs')
| -rw-r--r-- | compiler/main/Packages.hs | 6 | 
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/main/Packages.hs b/compiler/main/Packages.hs index cdb4f9ba71..64e012c57f 100644 --- a/compiler/main/Packages.hs +++ b/compiler/main/Packages.hs @@ -559,13 +559,15 @@ readPackageConfig dflags conf_file = do                        "can't find a package database at " ++ conf_file    let +      -- Fix #16360: remove trailing slash from conf_file before calculting pkgroot +      conf_file' = dropTrailingPathSeparator conf_file        top_dir = topDir dflags -      pkgroot = takeDirectory conf_file +      pkgroot = takeDirectory conf_file'        pkg_configs1 = map (mungePackageConfig top_dir pkgroot)                           proto_pkg_configs        pkg_configs2 = setBatchPackageFlags dflags pkg_configs1    -- -  return (conf_file, pkg_configs2) +  return (conf_file', pkg_configs2)    where      readDirStylePackageConfig conf_dir = do        let filename = conf_dir </> "package.cache"  | 
