ghc-pkg should drop trailing path separator when computing package database root
Reported on ghc-devs@,
Nicolas Dudebout <nicolas.dudebout@gmail.com> writes,
When passing a package database to ghc-pkg via
GHC_PACKAGE_PATHor--package-db,${pkgroot}does not get computed properly if the input path contains a trailing slash.Default behavior:
$ ghc-pkg describe base | grep pkgroot pkgroot: "/usr/lib/ghc-7.10.2"Correct behavior (no trailing slash):
$ ghc-pkg --package-db /usr/lib/ghc-7.10.2/package.conf.d describe base | grep pkgroot pkgroot: "/usr/lib/ghc-7.10.2" $ GHC_PACKAGE_PATH=/usr/lib/ghc-7.10.2/package.conf.d ghc-pkg describe base | grep pkgroot pkgroot: "/usr/lib/ghc-7.10.2"Incorrect behavior (with trailing slash):
$ ghc-pkg --package-db /usr/lib/ghc-7.10.2/package.conf.d/ describe base | grep pkgroot pkgroot: "/usr/lib/ghc-7.10.2/package.conf.d" $ GHC_PACKAGE_PATH=/usr/lib/ghc-7.10.2/package.conf.d/ ghc-pkg describe base | grep pkgroot pkgroot: "/usr/lib/ghc-7.10.2/package.conf.d"When this bug happens,
ghc-pkgcheck complains about missing files for packages using${pkgroot}.This bug happens because
${pkgroot}is computed usingtakeDirectory. It should instead use(takeDirectory . dropTrailingPathSeparator).
Trac metadata
| Trac field | Value |
|---|---|
| Version | 8.0.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Package system |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | nicolas.dudebout@gmail.com |
| Operating system | |
| Architecture |