diff options
author | Kevin Buhr <buhr@asaurus.net> | 2019-05-03 18:15:44 -0500 |
---|---|---|
committer | Ben Gamari <ben@well-typed.com> | 2019-06-08 13:42:40 -0400 |
commit | 92bd7f1a8be80857fb679daf99e3d6cf7d9b63cd (patch) | |
tree | 5b94fadb9f970824c20305fb94e2e13ad3139b4f /compiler/main | |
parent | 709290b01c3c63137d863d6fdd97dabdfe47eb29 (diff) | |
download | haskell-wip/T16360.tar.gz |
Handle trailing path separator in package DB names (#16360)wip/T16360
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')
-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" |