<div dir="ltr"><div><div><div><div>When passing a package database to ghc-pkg via
GHC_PACKAGE_PATH or --package-db, ${pkgroot} does not get computed
properly if the input path contains a trailing slash.<br><br></div><div>Default behavior:<br></div> $ ghc-pkg describe base | grep pkgroot<br></div> pkgroot: "/usr/lib/ghc-7.10.2"<br><br>Correct behavior (no trailing slash):<br> $ ghc-pkg --package-db /usr/lib/ghc-7.10.2/package.conf.d describe base | grep pkgroot<br> pkgroot: "/usr/lib/ghc-7.10.2"<br><br> $ GHC_PACKAGE_PATH=/usr/lib/ghc-7.10.2/package.conf.d ghc-pkg describe base | grep pkgroot<br> pkgroot: "/usr/lib/ghc-7.10.2"<br><br>Incorrect behavior (with trailing slash):<br> $ ghc-pkg --package-db /usr/lib/ghc-7.10.2/package.conf.d/ describe base | grep pkgroot<br> pkgroot: "/usr/lib/ghc-7.10.2/package.conf.d"<br><br> $ GHC_PACKAGE_PATH=/usr/lib/ghc-7.10.2/package.conf.d/ ghc-pkg describe base | grep pkgroot<br> pkgroot: "/usr/lib/ghc-7.10.2/package.conf.d"<br><br></div>When this bug happens, ghc-pkg check complains about missing files for packages using ${pkgroot}.<br><br></div>This
bug happens because ${pkgroot} is computed using takeDirectory. It
should instead use (takeDirectory . dropTrailingPathSeparator)</div>