Opened 4 years ago

Closed 4 years ago

#4072 closed bug (fixed)

Local package DB doesn't take preference over global DB

Reported by: tibbe Owned by: simonmar
Priority: normal Milestone: 6.12.3
Component: Package system Version: 6.12.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Difficulty:
Test Case: Blocked By:
Blocking: Related Tickets:

Description

I sometime find myself wanting to compile some small test program (say Test.hs) against a locally built Cabal package. Here's what I do:

ghc -c Test.hs -package-conf dist/package.conf.inplace

This doesn't work

Test.hs:4:0:
    Failed to load interface for `Data.Text.Lazy.Builder':
      Use -v to see a list of the files searched for.

The global version of text gets picked instead of the local one (and in this case the global version lacks the Data.Text.Lazy.Builder module). I expect the package given on the command line to take preference.

Workaround: Bump the version number of the local package.

Change History (9)

comment:1 follow-up: Changed 4 years ago by duncan

The culprit here is the way ghc currently handles package database, specifically how it merges them.

Currently, in ghc's package database, packages are identified by a package id (which included the hash), however there is a constraint that each package name/version pair be unique. That is, although we can distinguish different instances of the same version of a package, ghc does not allow more than one instance in each package db at once.

The problem arises when merging two package databases and are multiple instances of a package version between the two dbs being merged. Merging dbs is what happens when you specify -package-conf; you're merging the global, user and the given specific package dbs.

The algorithm that ghc currently uses guarantees that the way packages shadow each other gives a consistent package db, however it does not guarantee that the shadowing happens in the order that users would expect. That's what is happening in this instance.

The solution is to allow multiple instances of a package version in a package db at once. However then we need a new mechanism to map flags "-package foo" to a particular package instance. This needs more thought and discussion. Possible solutions might involve selecting a "current" instance of package, eg when installing/uninstalling. They would have to be selected in such a way that guarantees consistency.

We discussed some possibilities before the release of ghc-6.12 but could not come up with something obvious and simple in time for the release. What we have now in 6.12 is an improvement but does have some undesirable properties such as the one illustrated in this bug report.

comment:2 Changed 4 years ago by simonmar

  • Component changed from Compiler to Package system
  • Status changed from new to infoneeded

While Duncan has obviously grasped exactly what's going on, I'm a bit slow on the uptake :-) Showing the output from ghc-pkg list -v would help a great deal...

comment:3 Changed 4 years ago by tibbe

  • Status changed from infoneeded to new

As far as I understand it the problem is that the local package DB (as given by --package-conf) contains a package with the same version and name as in the global and user package DBs. Here's the output you requested:

$ ghc-pkg list -v
using cache: /home/tibell/.ghc/x86_64-linux-6.12.2/package.conf.d/package.cache
using cache: /home/tibell/lib/ghc-6.12.2/package.conf.d/package.cache
/home/tibell/lib/ghc-6.12.2/package.conf.d
   Cabal-1.8.0.4 (Cabal-1.8.0.4-2ca0b54de31e7c6e2bf5bdd1d294fd8d)
   array-0.3.0.0 (array-0.3.0.0-d9af0944cfaff6e31a60b739d6d47c7e)
   base-3.0.3.2 (base-3.0.3.2-33c49b5f57a891ca80151e2f4f33f82c)
   base-4.2.0.1 (base-4.2.0.1-c940d2a54839812fa8d9282ba8a04d97)
   bin-package-db-0.0.0.0 (bin-package-db-0.0.0.0-b60c3890a93c0e84992e4667fae10b36)
   bytestring-0.9.1.6 (bytestring-0.9.1.6-3efaf1cf13176910a8fe21aaa93dd52f)
   containers-0.3.0.0 (containers-0.3.0.0-f7a8eb7985c3ceb30e259aeffe8acb2e)
   directory-1.0.1.1 (directory-1.0.1.1-81da781295a0f481dc84f3aceebed6e1)
   dph-base-0.4.0 (dph-base-0.4.0-16c7be48d8f613872e1ab52cdc72dbd8)
   dph-par-0.4.0 (dph-par-0.4.0-8b5bb633ae873c4353c98adb62f7307e)
   dph-prim-interface-0.4.0 (dph-prim-interface-0.4.0-9e88ad99b0f092cf6fc514f5c29dc010)
   dph-prim-par-0.4.0 (dph-prim-par-0.4.0-b4dd59c80b0c180128950f6cb1e7b9ea)
   dph-prim-seq-0.4.0 (dph-prim-seq-0.4.0-35632563a8a22a6ed4f5108f8cee712f)
   dph-seq-0.4.0 (dph-seq-0.4.0-beb9865134d3d32dcbd91f4f4e4d18cf)
   extensible-exceptions-0.1.1.1 (extensible-exceptions-0.1.1.1-28a83091e117b2e719d4a1c4a320a1c8)
   ffi-1.0 (builtin_ffi)
   filepath-1.1.0.4 (filepath-1.1.0.4-1425f312faf5b8e9f4babf887e252326)
   ghc-6.12.2 (ghc-6.12.2-42b9205304708195bb810ce0efe91c67)
   ghc-binary-0.5.0.2 (ghc-binary-0.5.0.2-ab1951a3cdcc71a778a5b71d32a0ac82)
   ghc-prim-0.2.0.0 (ghc-prim-0.2.0.0-5da421112969a971aa3433fdf154b37a)
   haskell98-1.0.1.1 (haskell98-1.0.1.1-64d0d2445dbab2ae6f4c0ef4dd5acffb)
   hpc-0.5.0.5 (hpc-0.5.0.5-b6985a307d62ee1ed124a6dd89bb983c)
   integer-gmp-0.2.0.1 (integer-gmp-0.2.0.1-67f3940ec8fd509683668f40451c9ca1)
   old-locale-1.0.0.2 (old-locale-1.0.0.2-0c1a4b40f2d3b9f6b725f54c00fe0923)
   old-time-1.0.0.4 (old-time-1.0.0.4-822971e14a3962dc5100f8d184d86e17)
   pretty-1.0.1.1 (pretty-1.0.1.1-b6652d4fb1f996119a76dcaa986e9d70)
   process-1.0.1.2 (process-1.0.1.2-0c055170be2e835c5f6ae3f2604fdf39)
   random-1.0.0.2 (random-1.0.0.2-a4bf29bbfd08ec91d43a4c919e9253f8)
   rts-1.0 (builtin_rts)
   syb-0.1.0.2 (syb-0.1.0.2-de132fee12fc0d855087b9b238b4565a)
   template-haskell-2.4.0.1 (template-haskell-2.4.0.1-e9e9c63092746bd4a3f64cc37ddb1e06)
   time-1.1.4 (time-1.1.4-668ce7f110e803952c4ceda6e172096c)
   unix-2.4.0.1 (unix-2.4.0.1-2b0b5b03649c4a1de993dc31207c5ff7)
/home/tibell/.ghc/x86_64-linux-6.12.2/package.conf.d
   HTTP-4000.0.9 (HTTP-4000.0.9-972661e5536b4092b64da20c52f61612)
   HUnit-1.2.2.1 (HUnit-1.2.2.1-d35431fff52a1f91c4acc421023743e7)
   ListLike-1.0.1 (ListLike-1.0.1-f5400115ed118ccdf2bb8fd5656ad5f5)
   MonadCatchIO-transformers-0.2.2.0 (MonadCatchIO-transformers-0.2.2.0-2f29616558987a7d7eed29310fd8bf1a)
   QuickCheck-1.2.0.0 (QuickCheck-1.2.0.0-ee5d098db953518f791659b618ecb726)
   ansi-terminal-0.5.0 (ansi-terminal-0.5.0-44de05d7ced544a3dcb4f8c3c7ed69ce)
   ansi-wl-pprint-0.5.1 (ansi-wl-pprint-0.5.1-ea5fb065aa0a892907d99fce370658f1)
   attoparsec-0.8.0.2 (attoparsec-0.8.0.2-c983acfc734cf9f692254afe211c2172)
   attoparsec-iteratee-0.1 (attoparsec-iteratee-0.1-286cb78f6db1b8426878a7584a3c49c0)
   binary-0.5.0.2 (binary-0.5.0.2-114aafd6be4c69911a13814716c1a1ff)
   bytestring-mmap-0.2.1 (bytestring-mmap-0.2.1-b70c3176c819b04b19f4cda31dde8989)
   bytestring-nums-0.3.1 (bytestring-nums-0.3.1-3466195f4521bcb558a0d09fb364a91c)
   bytestring-show-0.3.3 (bytestring-show-0.3.3-1b6240d206a1c31bd8fae969b5514ed4)
   cereal-0.2 (cereal-0.2-896c8696cecede96e0b73efdec9d02e4)
   cpphs-1.11 (cpphs-1.11-dc4ed5972565ec04edf7c8afa652366e)
   criterion-0.5.0.0 (criterion-0.5.0.0-0537bc2eef1340077e93001e1869334b)
   darcs-2.4.1 (darcs-2.4.1-9c7e6ed0316492adaa048098481e843f)
   dataenc-0.13.0.2 (dataenc-0.13.0.2-326308bda43e226979ca4ec57b5a8ecc)
   deepseq-1.1.0.0 (deepseq-1.1.0.0-996c7e4d83de94a039c29582abddb80c)
   directory-tree-0.1.1 (directory-tree-0.1.1-0dc1c6ec83a9180c11d21b60d3be95c9)
   dlist-0.5 (dlist-0.5-a386e34fa917b02efe60bdec59cb50f8)
   erf-1.0.0.0 (erf-1.0.0.0-a5561059617bd2ff465e382c3c189eb0)
   hashed-storage-0.4.11 (hashed-storage-0.4.11-2f4d7c10b9c9b021a5383135ad60ee5c)
   haskeline-0.6.2.2 (haskeline-0.6.2.2-b39eb86da35184afbe4e404af604b050)
   haskell-src-exts-1.8.2 (haskell-src-exts-1.8.2-518a72725ef9c7e07d0bc0261933fc22)
   hlint-1.6.21 (hlint-1.6.21-3e387d96c6b5a6ceffb5134e579674f8)
   hscolour-1.16 (hscolour-1.16-0c11ad9a00f1dcf3f9cde0a1386ac868)
   html-1.0.1.2 (html-1.0.1.2-9df9e817033241284f64034c2478a7d3)
   iteratee-0.3.5 (iteratee-0.3.5-ac2a065d9222fdcd8436e5381c352ff2)
   mmap-0.4.1 (mmap-0.4.1-d061032c04761f84e3f5e6bafcb728f9)
   monads-fd-0.1.0.0 (monads-fd-0.1.0.0-f92ca4a992ff0c7884d701f0a2ad3f9c)
   mtl-1.1.0.2 (mtl-1.1.0.2-174e84f60f8c2192a4ee7d2ff2833953)
   mwc-random-0.5.0.0 (mwc-random-0.5.0.0-1c1dd213ed3d9235683cb3a737e101ce)
   network-2.2.1.7 (network-2.2.1.7-c873d333afa36ee1d496acf30a14dc9d)
   network-bytestring-0.1.3 (network-bytestring-0.1.3-18648acd4e4fc71693664002cf22a7e6)
   parallel-2.2.0.1 (parallel-2.2.0.1-2b656b5454562b671f82c8688fb3ed1b)
   parsec-2.1.0.1 (parsec-2.1.0.1-4cd811cd4f9f11963baec3918d510464)
   parsec-3.1.0 (parsec-3.1.0-4fa4103140b3319f30edb8cfb8530edd)
   primitive-0.2.1 (primitive-0.2.1-73ba566598d33b9d9b7aafd5bf50ea23)
   primitive-0.3 (primitive-0.3-2392312a00fc66bd269e6fe78f357e28)
   regex-base-0.93.1 (regex-base-0.93.1-acb7fffd78c9f1aa057306a8f26ac604)
   regex-compat-0.92 (regex-compat-0.92-ebef22654be4dca41f9c13b54d2a8d1a)
   regex-posix-0.94.1 (regex-posix-0.94.1-d7254566b76812d99812ff1803b88e62)
   sendfile-0.6.1 (sendfile-0.6.1-2a63f4c1a811909a5050846dbedbdc72)
   statistics-0.5.1.0 (statistics-0.5.1.0-dc60a4f05c371937865433d7e5b8ae30)
   stm-2.1.2.0 (stm-2.1.2.0-40208614796ae6e7aa3666d871ef78ec)
   terminfo-0.3.1.2 (terminfo-0.3.1.2-2b386f85f4cd28e4ca3429a7aeef5a44)
   test-framework-0.2.4 (test-framework-0.2.4-4ee3cb49520a4c7995ff695e85be2dca)
   test-framework-hunit-0.2.4 (test-framework-hunit-0.2.4-1aa7ebb5bec91b3b6bde6f7aeebb66e8)
   test-framework-quickcheck-0.2.4 (test-framework-quickcheck-0.2.4-b74a148c1b228c606068cbd53116b4f1)
   text-0.7.1.0 (text-0.7.1.0-4f2f4fb4a4165e8bf419afe19e3f9ce6)
   transformers-0.2.1.0 (transformers-0.2.1.0-83bd04c7d756a68d4480a7c48ea90dcc)
   uniplate-1.5.1 (uniplate-1.5.1-a9ad7487aefd86d65a1d31d4ce4097b3)
   utf8-string-0.3.6 (utf8-string-0.3.6-2731b60ace897a8daec9b50d3d5b65f9)
   vector-0.5 (vector-0.5-67c88965ddc5442e42e944452800f87b)
   vector-0.6.0.1 (vector-0.6.0.1-12dcd3f12bf46b05354edd21f0b0a520)
   vector-algorithms-0.3.1 (vector-algorithms-0.3.1-fa6ae76ed70c00227a6fe5d40fbf3e09)
   zlib-0.5.2.0 (zlib-0.5.2.0-72f71bad4ead56a811556885b3e4b848)
$ cat dist/package.conf.inplace 
[InstalledPackageInfo {installedPackageId = InstalledPackageId "text-0.7.1.0-inplace", sourcePackageId = PackageIdentifier {pkgName = PackageName "text", pkgVersion = Version {versionBranch = [0,7,1,0], versionTags = []}}, license = BSD3, copyright = "2008-2009 Tom Harper, 2009 Bryan O'Sullivan", maintainer = "Bryan O'Sullivan <bos@serpentine.com>\nTom Harper <rtharper@aftereternity.co.uk>\nDuncan Coutts <duncan@haskell.org>", author = "Tom Harper <rtharper@aftereternity.co.uk>", stability = "", homepage = "", pkgUrl = "", description = "An efficient packed Unicode text type.", category = "Data, Text", exposed = True, exposedModules = ["Data.Text","Data.Text.Encoding","Data.Text.Encoding.Error","Data.Text.Foreign","Data.Text.IO","Data.Text.Lazy","Data.Text.Lazy.Encoding","Data.Text.Lazy.IO"], hiddenModules = ["Data.Text.Array","Data.Text.Encoding.Fusion","Data.Text.Encoding.Fusion.Common","Data.Text.Encoding.Utf16","Data.Text.Encoding.Utf32","Data.Text.Encoding.Utf8","Data.Text.Fusion","Data.Text.Fusion.CaseMapping","Data.Text.Fusion.Common","Data.Text.Fusion.Internal","Data.Text.Fusion.Size","Data.Text.IO.Internal","Data.Text.Internal","Data.Text.Lazy.Builder","Data.Text.Lazy.Encoding.Fusion","Data.Text.Lazy.Fusion","Data.Text.Lazy.Internal","Data.Text.Lazy.Search","Data.Text.Search","Data.Text.Unsafe","Data.Text.UnsafeChar","Data.Text.UnsafeShift"], importDirs = ["/tmp/text/dist/build"], libraryDirs = ["/tmp/text/dist/build"], hsLibraries = ["HStext-0.7.1.0"], extraLibraries = [], extraGHCiLibraries = [], includeDirs = [], includes = [], depends = [InstalledPackageId "base-4.2.0.1-c940d2a54839812fa8d9282ba8a04d97",InstalledPackageId "bytestring-0.9.1.6-3efaf1cf13176910a8fe21aaa93dd52f",InstalledPackageId "deepseq-1.1.0.0-996c7e4d83de94a039c29582abddb80c",InstalledPackageId "ghc-prim-0.2.0.0-5da421112969a971aa3433fdf154b37a"], hugsOptions = [], ccOptions = [], ldOptions = [], frameworkDirs = [], frameworks = [], haddockInterfaces = ["/tmp/text/dist/doc/html/text/text.haddock"], haddockHTMLs = ["/tmp/text/dist/doc/html/text"]}

comment:4 Changed 4 years ago by simonmar

  • Status changed from new to infoneeded

Thanks, and could you paste the output you get from adding -v to your GHC command line?

comment:5 Changed 4 years ago by tibbe

  • Status changed from infoneeded to new
  • Version changed from 6.12.2 to 6.12.1

I reran everything on my Mac which uses GHC 6.12.1.

$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.12.1
$ ghc -v -c tests/Append.hs -package-conf dist/package.conf.inplace 
Glasgow Haskell Compiler, Version 6.12.1, for Haskell 98, stage 2 booted by GHC version 6.10.4
Using binary package database: /Users/tibell/lib/ghc-6.12.1/package.conf.d/package.cache
Using binary package database: /Users/tibell/.ghc/i386-darwin-6.12.1/package.conf.d/package.cache
Using package config file: dist/package.conf.inplace
package text-0.7.1.0-3478e6d457c09a360e09e1754b887004 is shadowed by package text-0.7.1.0-f3ff1e691f6e2bb2c224b14eb7333296
hiding package base-3.0.3.2 to avoid conflict with later version base-4.2.0.0
hiding package parsec-2.1.0.1 to avoid conflict with later version parsec-3.1.0
hiding package utf8-string-0.3.4 to avoid conflict with later version utf8-string-0.3.6
wired-in package ghc-prim mapped to ghc-prim-0.2.0.0-3fbcc20c802efcd7c82089ec77d92990
wired-in package integer-gmp mapped to integer-gmp-0.2.0.0-fa82a0df93dc30b4a7c5654dd7c68cf4
wired-in package base mapped to base-4.2.0.0-0120a3650a6376da8d1b6a4e48a2973a
wired-in package rts mapped to builtin_rts
wired-in package haskell98 mapped to haskell98-1.0.1.1-0fdaf3b26bc38c43ce8371edf538dbf6
wired-in package template-haskell mapped to template-haskell-2.4.0.0-6f9a3474dda67f558857ddda42966d27
wired-in package dph-seq mapped to dph-seq-0.4.0-1f5167ea371010387123b68e975177b2
wired-in package dph-par mapped to dph-par-0.4.0-4e569f28e047d67d87266113526bc6ec
Hsc static flags: -static
Created temporary directory: /var/folders/zz/zzzivhrRnAmviuee++0ZSk++dLg/-Tmp-//ghc32351_0
*** Checking old interface for main:Append:
*** Parser:
*** Renamer/typechecker:

tests/Append.hs:4:0:
    Failed to load interface for `Data.Text.Lazy.Builder':
      locations searched:
        Data/Text/Lazy/Builder.hi
        Data/Text/Lazy/Builder.hi-boot
*** Deleting temp files:
Deleting: /var/folders/zz/zzzivhrRnAmviuee++0ZSk++dLg/-Tmp-//ghc32351_0/ghc32351_0.s
Warning: deleting non-existent /var/folders/zz/zzzivhrRnAmviuee++0ZSk++dLg/-Tmp-//ghc32351_0/ghc32351_0.s
*** Deleting temp dirs:
Deleting: /var/folders/zz/zzzivhrRnAmviuee++0ZSk++dLg/-Tmp-//ghc32351_0
$ cat dist/package.conf.inplace 
[InstalledPackageInfo {installedPackageId = InstalledPackageId "text-0.7.1.0-3478e6d457c09a360e09e1754b887004", sourcePackageId = PackageIdentifier {pkgName = PackageName "text", pkgVersion = Version {versionBranch = [0,7,1,0], versionTags = []}}, license = BSD3, copyright = "2008-2009 Tom Harper, 2009 Bryan O'Sullivan", maintainer = "Bryan O'Sullivan <bos@serpentine.com>\nTom Harper <rtharper@aftereternity.co.uk>\nDuncan Coutts <duncan@haskell.org>", author = "Tom Harper <rtharper@aftereternity.co.uk>", stability = "", homepage = "", pkgUrl = "", description = "An efficient packed Unicode text type.", category = "Data, Text", exposed = True, exposedModules = ["Data.Text","Data.Text.Encoding","Data.Text.Encoding.Error","Data.Text.Foreign","Data.Text.IO","Data.Text.Lazy","Data.Text.Lazy.Builder","Data.Text.Lazy.Encoding","Data.Text.Lazy.IO"], hiddenModules = ["Data.Text.Array","Data.Text.Encoding.Fusion","Data.Text.Encoding.Fusion.Common","Data.Text.Encoding.Utf16","Data.Text.Encoding.Utf32","Data.Text.Encoding.Utf8","Data.Text.Fusion","Data.Text.Fusion.CaseMapping","Data.Text.Fusion.Common","Data.Text.Fusion.Internal","Data.Text.Fusion.Size","Data.Text.IO.Internal","Data.Text.Internal","Data.Text.Lazy.Encoding.Fusion","Data.Text.Lazy.Fusion","Data.Text.Lazy.Internal","Data.Text.Lazy.Search","Data.Text.Search","Data.Text.Unsafe","Data.Text.UnsafeChar","Data.Text.UnsafeShift"], importDirs = ["/Users/tibell/src/text/dist/build"], libraryDirs = ["/Users/tibell/src/text/dist/build"], hsLibraries = ["HStext-0.7.1.0"], extraLibraries = [], extraGHCiLibraries = [], includeDirs = [], includes = [], depends = [InstalledPackageId "base-4.2.0.0-0120a3650a6376da8d1b6a4e48a2973a",InstalledPackageId "bytestring-0.9.1.5-40bf742614570450dbe8c16aa8a1f22f",InstalledPackageId "deepseq-1.1.0.0-14fbf43e1c607f21a1eab1783c9c45d4",InstalledPackageId "ghc-prim-0.2.0.0-3fbcc20c802efcd7c82089ec77d92990"], hugsOptions = [], ccOptions = [], ldOptions = [], frameworkDirs = [], frameworks = [], haddockInterfaces = ["/Users/tibell/src/text/dist/doc/html/text/text.haddock"], haddockHTMLs = ["/Users/tibell/src/text/dist/doc/html/text"]}
$ ghc-pkg list -v
using cache: /Users/tibell/.ghc/i386-darwin-6.12.1/package.conf.d/package.cache
using cache: /Users/tibell/lib/ghc-6.12.1/package.conf.d/package.cache
/Users/tibell/lib/ghc-6.12.1/package.conf.d
   Cabal-1.8.0.2 (Cabal-1.8.0.2-a08510b9460f1b65f9dee06ed53f0650)
   array-0.3.0.0 (array-0.3.0.0-dbdf73710a5bd9a534e8bcb2d8c8ee98)
   base-3.0.3.2 (base-3.0.3.2-52acef427378232ec569bca0486ee48f)
   base-4.2.0.0 (base-4.2.0.0-0120a3650a6376da8d1b6a4e48a2973a)
   bin-package-db-0.0.0.0 (bin-package-db-0.0.0.0-0c559ebe951f9972c4e6dfe5ebd4ce6a)
   bytestring-0.9.1.5 (bytestring-0.9.1.5-40bf742614570450dbe8c16aa8a1f22f)
   containers-0.3.0.0 (containers-0.3.0.0-409fe3b8f0dda25b98e03716d26be411)
   directory-1.0.1.0 (directory-1.0.1.0-76dcb137db629447ae580c8e076170d0)
   dph-base-0.4.0 (dph-base-0.4.0-385a36312e9cc9bc5a672eb91d4e2be8)
   dph-par-0.4.0 (dph-par-0.4.0-4e569f28e047d67d87266113526bc6ec)
   dph-prim-interface-0.4.0 (dph-prim-interface-0.4.0-1badc74b9fa32117e97af15c908ef542)
   dph-prim-par-0.4.0 (dph-prim-par-0.4.0-e3a413f286eb1d5d727762c2087de132)
   dph-prim-seq-0.4.0 (dph-prim-seq-0.4.0-23150bc82f21bd4268b1551af7a32901)
   dph-seq-0.4.0 (dph-seq-0.4.0-1f5167ea371010387123b68e975177b2)
   extensible-exceptions-0.1.1.1 (extensible-exceptions-0.1.1.1-95db30aec4429ef77db437055a224b2f)
   ffi-1.0 (builtin_ffi)
   filepath-1.1.0.3 (filepath-1.1.0.3-07812de93a673f50011d47451bcaac87)
   ghc-6.12.1 (ghc-6.12.1-847ad37a64be24ef1f05076e1cc08822)
   ghc-binary-0.5.0.2 (ghc-binary-0.5.0.2-359d07c3fa596bee47da084cc306672c)
   ghc-prim-0.2.0.0 (ghc-prim-0.2.0.0-3fbcc20c802efcd7c82089ec77d92990)
   haskell98-1.0.1.1 (haskell98-1.0.1.1-0fdaf3b26bc38c43ce8371edf538dbf6)
   hpc-0.5.0.4 (hpc-0.5.0.4-dfca13f05bd06f4a5ebf115df50daf93)
   integer-gmp-0.2.0.0 (integer-gmp-0.2.0.0-fa82a0df93dc30b4a7c5654dd7c68cf4)
   old-locale-1.0.0.2 (old-locale-1.0.0.2-ef43da9d308528e2994f68a00a6ea03f)
   old-time-1.0.0.3 (old-time-1.0.0.3-c6cff546303cb0a62627341768f3fe9d)
   pretty-1.0.1.1 (pretty-1.0.1.1-2bfa34c699efff7eed4d6297a2dac12d)
   process-1.0.1.2 (process-1.0.1.2-9a5e262f816b13040046ceaaabf515b9)
   random-1.0.0.2 (random-1.0.0.2-156803737564049405b3380fdb96ac75)
   rts-1.0 (builtin_rts)
   syb-0.1.0.2 (syb-0.1.0.2-1e7e0c316929641cb3237a60e3b63680)
   template-haskell-2.4.0.0 (template-haskell-2.4.0.0-6f9a3474dda67f558857ddda42966d27)
   time-1.1.4 (time-1.1.4-74673f7d068def85b6a33c1cfba358a9)
   unix-2.4.0.0 (unix-2.4.0.0-b7e23656587457fe3b2d4527ca7a9d1e)
   utf8-string-0.3.4 (utf8-string-0.3.4-933a608a1f0fee8fdcb9c114521ed4a3)
/Users/tibell/.ghc/i386-darwin-6.12.1/package.conf.d
   HTTP-4000.0.9 (HTTP-4000.0.9-7e24b1122d18f0c24d4076c273b47984)
   HUnit-1.2.2.1 (HUnit-1.2.2.1-daec846a628edb1d64790c91b148ab44)
   QuickCheck-1.2.0.0 (QuickCheck-1.2.0.0-7b47a96dc3702c437a94e77520813983)
   ansi-terminal-0.5.0 (ansi-terminal-0.5.0-d4c3d4a136c6a0dfe948ddb7633ba5dd)
   ansi-wl-pprint-0.5.1 (ansi-wl-pprint-0.5.1-7c43bf81a40fe6173bb137159009f383)
   attoparsec-0.7.2 (attoparsec-0.7.2-3df9c4f6e52ca46d839552e08a9ff6db)
   binary-0.5.0.2 (binary-0.5.0.2-32d59ff8fdfc79aa888e82997612374d)
   bytestring-lexing-0.2 (bytestring-lexing-0.2-0ee9e2b0a9f2ec3a843c96347b6192c4)
   bytestring-show-0.3.3 (bytestring-show-0.3.3-36ce6f59debf73cbcebdbf5ee60a171b)
   colorize-haskell-1.0.0 (colorize-haskell-1.0.0-0ca99a6b5f9d408a0c6bbb8326f1a84e)
   cpphs-1.11 (cpphs-1.11-20b9349b60ba9e187ce20bacef8124a5)
   criterion-0.5.0.0 (criterion-0.5.0.0-c6b1d4bd37e572ceed8875b211c24c92)
   darcs-2.4 (darcs-2.4-30a2cd4bf8000b7363ab65978447ae28)
   dataenc-0.13.0.2 (dataenc-0.13.0.2-fff024fd1fa559f138783f4eadd3b089)
   deepseq-1.1.0.0 (deepseq-1.1.0.0-14fbf43e1c607f21a1eab1783c9c45d4)
   erf-1.0.0.0 (erf-1.0.0.0-5c7468e66e503f83b6c0b4bd9b5314dd)
   hashed-storage-0.4.10 (hashed-storage-0.4.10-8e589882af9c73ab9e24cd882cd5708f)
   haskeline-0.6.2.2 (haskeline-0.6.2.2-f765b66cae13743311de76fb1acd35a7)
   haskell-lexer-1.0 (haskell-lexer-1.0-7a0e661a587aa1e9470a503cd81427eb)
   haskell-src-exts-1.8.2 (haskell-src-exts-1.8.2-19290f2ea063bce22cc0a937480d79b5)
   hlint-1.6.20 (hlint-1.6.20-e4d2f201c8692737eac12f8a757caba2)
   hscolour-1.16 (hscolour-1.16-9f4f7ed84abf27a62d45f23aa0686fd6)
   html-1.0.1.2 (html-1.0.1.2-ec3ad8564598b5941cf8f41a6f9eb204)
   mmap-0.4.1 (mmap-0.4.1-2ea1377fda2570a2182e5c7742f6038c)
   mtl-1.1.0.2 (mtl-1.1.0.2-23ca4de7c573fd4df309067199a40634)
   mwc-random-0.5.0.0 (mwc-random-0.5.0.0-99a9ed4c70c333c803666d508c9398b2)
   network-2.2.1.7 (network-2.2.1.7-cfac5b30151913fe3c8caab5c51725b6)
   network-bytestring-0.1.2.1 (network-bytestring-0.1.2.1-9235782229d2af814e115cb792f4904f)
   parallel-2.2.0.1 (parallel-2.2.0.1-121beecc05d19b9beddc691b365930e6)
   parsec-2.1.0.1 (parsec-2.1.0.1-91f812a3d0afbf2623a0ac5e1bf5c025)
   parsec-3.1.0 (parsec-3.1.0-997f60fe0e1cf4b8713019c85ebc8146)
   pcre-light-0.3.1.1 (pcre-light-0.3.1.1-c087122a5102def827d619c8af005d9b)
   primitive-0.2.1 (primitive-0.2.1-86adcccf723ce701d68de64cd0cf1410)
   regex-base-0.93.1 (regex-base-0.93.1-a2ea37053977c710cec9c904296eec1c)
   regex-compat-0.92 (regex-compat-0.92-8c321f869d60c35efcefa7ef225e7f82)
   regex-posix-0.94.1 (regex-posix-0.94.1-bea45d760bb578221be6403b5dde30f9)
   statistics-0.5.1.0 (statistics-0.5.1.0-c5435bdc2c92e8d171ad9bdf44c93367)
   stm-2.1.1.2 (stm-2.1.1.2-9e44809d58563cca54113fa78642d02e)
   terminfo-0.3.1.2 (terminfo-0.3.1.2-9cb959a40a61a7a4757db167d74a2774)
   test-framework-0.2.4 (test-framework-0.2.4-98b13e0c8f750ff00fb35a629c39a575)
   test-framework-hunit-0.2.4 (test-framework-hunit-0.2.4-e4b61665bffcbb153db438b77f73935d)
   test-framework-quickcheck-0.2.4 (test-framework-quickcheck-0.2.4-370807581ed98f2bc4635eff1b3fbc0c)
   text-0.7.1.0 (text-0.7.1.0-f3ff1e691f6e2bb2c224b14eb7333296)
   transformers-0.2.0.0 (transformers-0.2.0.0-e234f3a655b5e4b193d3161e17c6eea7)
   uniplate-1.5.1 (uniplate-1.5.1-564e2c54fea53056149e275b3c099bd4)
   utf8-string-0.3.6 (utf8-string-0.3.6-d7797d712cca25670d7fb7363fca9348)
   vector-0.5 (vector-0.5-346bcf6ff59cfcf98b0b9a238d5a24f6)
   vector-algorithms-0.3 (vector-algorithms-0.3-1dedc94604d37aae1aaa11b4a71aec23)
   zlib-0.5.2.0 (zlib-0.5.2.0-b96bdf8b31c306d60b63dbb26a49d3a4)

comment:6 Changed 4 years ago by simonmar

  • Milestone set to 6.12.3
  • Owner set to simonmar

Thanks Johan. I think this is really a bug: GHC should be preferring the text package in the user DB, and instead it is shadowing the user one with the global one.

comment:7 in reply to: ↑ 1 Changed 4 years ago by simonmar

Replying to duncan:

The culprit here is the way ghc currently handles package database, specifically how it merges them.

Currently, in ghc's package database, packages are identified by a package id (which included the hash), however there is a constraint that each package name/version pair be unique. That is, although we can distinguish different instances of the same version of a package, ghc does not allow more than one instance in each package db at once.

The problem arises when merging two package databases and are multiple instances of a package version between the two dbs being merged. Merging dbs is what happens when you specify -package-conf; you're merging the global, user and the given specific package dbs.

Yes, all true.

The algorithm that ghc currently uses guarantees that the way packages shadow each other gives a consistent package db, however it does not guarantee that the shadowing happens in the order that users would expect. That's what is happening in this instance.

This isn't the case. The idea is supposed to be that packages from the user DB shadow packages from the system DB, and then we throw away any packages that are broken because their dependencies were shadowed. Unfortunately we broke the ordering at some point, so the shadowing was happening the wrong way around sometimes, and due to a quirk of fate our test case didn't pick it up.

The solution is to allow multiple instances of a package version in a package db at once. However then we need a new mechanism to map flags "-package foo" to a particular package instance. This needs more thought and discussion. Possible solutions might involve selecting a "current" instance of package, eg when installing/uninstalling. They would have to be selected in such a way that guarantees consistency.

We discussed some possibilities before the release of ghc-6.12 but could not come up with something obvious and simple in time for the release. What we have now in 6.12 is an improvement but does have some undesirable properties such as the one illustrated in this bug report.

It does have some undesirable properties, but this bug report is just a bug :-)

comment:8 Changed 4 years ago by simonmar

  • Status changed from new to merge

Fixed:

Wed May 19 03:46:17 PDT 2010  Simon Marlow <marlowsd@gmail.com>
  * Fix package shadowing order (#4072)
  
  Later packages are supposed to shadow earlier ones in the stack,
  unless the ordering is overriden with -package-id flags.
  Unfortunately an earlier fix for something else had sorted the list of
  packages so that it was in lexicographic order by installedPackageId,
  and sadly our test (cabal/shadow) didn't pick this up because the
  lexicographic ordering happened to work for the test.  I've now fixed
  the test so it tries both orderings.

comment:9 Changed 4 years ago by igloo

  • Resolution set to fixed
  • Status changed from merge to closed

Merged.

Note: See TracTickets for help on using tickets.