[GHC] #12194: ghc-pkg, package database path containing a trailing slash, and ${pkgroot}

#12194: ghc-pkg, package database path containing a trailing slash, and ${pkgroot} -------------------------------------+------------------------------------- Reporter: dudebout | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: ghc-pkg | Version: 8.0.1 Keywords: pkgroot | Operating System: Unknown/Multiple Architecture: | Type of failure: Incorrect result Unknown/Multiple | at runtime Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- 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. 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/12194 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12194: ghc-pkg, package database path containing a trailing slash, and ${pkgroot} -------------------------------------+------------------------------------- Reporter: dudebout | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: ghc-pkg | Version: 8.0.1 Resolution: | Keywords: pkgroot Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2336 Wiki Page: | -------------------------------------+------------------------------------- Changes (by thomie): * differential: => Phab:D2336 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12194#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12194: ghc-pkg, package database path containing a trailing slash, and ${pkgroot} -------------------------------------+------------------------------------- Reporter: dudebout | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: ghc-pkg | Version: 8.0.1 Resolution: | Keywords: pkgroot Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2336 Wiki Page: | -------------------------------------+------------------------------------- Comment (by dudebout): I am seeing the same issue in ghc. If I am not mistaken, the same fix applies in ghc/compiler/main/Packages.hs at line 419: https://github.com/ghc/ghc/blob/1937ef1c506b538f0f93cd290fa4a42fc85ab769/com... Reading line 355 to 449, it seems like the name is taken straight from the option or env var. See in particular lines 374/376/393 where the name comes from. I have not tried runghc. Would that share the ghc code? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12194#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12194: ghc-pkg, package database path containing a trailing slash, and ${pkgroot}
-------------------------------------+-------------------------------------
Reporter: dudebout | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: ghc-pkg | Version: 8.0.1
Resolution: | Keywords: pkgroot
Operating System: Unknown/Multiple | Architecture:
Type of failure: Incorrect result | Unknown/Multiple
at runtime | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D2336
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ben Gamari

#12194: ghc-pkg, package database path containing a trailing slash, and ${pkgroot} -------------------------------------+------------------------------------- Reporter: dudebout | Owner: Type: bug | Status: merge Priority: normal | Milestone: 8.0.2 Component: ghc-pkg | Version: 8.0.1 Resolution: | Keywords: pkgroot Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2336 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: new => merge * milestone: => 8.0.2 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12194#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12194: ghc-pkg, package database path containing a trailing slash, and ${pkgroot} -------------------------------------+------------------------------------- Reporter: dudebout | Owner: Type: bug | Status: closed Priority: normal | Milestone: 8.0.2 Component: ghc-pkg | Version: 8.0.1 Resolution: fixed | Keywords: pkgroot Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2336 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: merge => closed * resolution: => fixed Comment: Merged to `ghc-8.0` as f3bca8f124f0f2d5e26dac083b1fe2d3ad69242a. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12194#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC