[GHC] #12196: ghc-pkg should drop trailing path separator when computing package database root

When passing a package database to ghc-pkg via `GHC_PACKAGE_PATH` or `--package-db`, `${pkgroot}` does not get computed properly if the input
#12196: ghc-pkg should drop trailing path separator when computing package database
root
-------------------------------------+-------------------------------------
Reporter: bgamari | Owner:
Type: bug | Status: new
Priority: normal | Milestone: 8.0.2
Component: Package | Version: 8.0.1
system |
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: None/Unknown
Unknown/Multiple |
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
Reported on `ghc-devs@`,
Nicolas Dudebout
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-pkg` check complains about missing files for packages using `${pkgroot}`.
This bug happens because `${pkgroot}` is computed using `takeDirectory`. It should instead use `(takeDirectory . dropTrailingPathSeparator)`.
-- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12196 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12196: ghc-pkg should drop trailing path separator when computing package database root -------------------------------------+------------------------------------- Reporter: bgamari | Owner: Type: bug | Status: patch Priority: normal | Milestone: 8.0.2 Component: Package system | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2336 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: new => patch * differential: => Phab:D2336 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12196#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12196: ghc-pkg should drop trailing path separator when computing package database root -------------------------------------+------------------------------------- Reporter: bgamari | Owner: Type: bug | Status: closed Priority: normal | Milestone: 8.0.2 Component: Package system | Version: 8.0.1 Resolution: duplicate | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #12194 | Differential Rev(s): Phab:D2336 Wiki Page: | -------------------------------------+------------------------------------- Changes (by thomie): * status: patch => closed * resolution: => duplicate * related: => #12194 Comment: Nicolas already opened a ticket. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12196#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC