[commit: ghc] ghc-8.0: Error early when you register with too old a version of Cabal. (7fc4300)
git at git.haskell.org
git at git.haskell.org
Thu Feb 11 15:30:32 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : ghc-8.0
Link : http://ghc.haskell.org/trac/ghc/changeset/7fc4300200a9e287d693e2df936e0fc9549de0a3/ghc
>---------------------------------------------------------------
commit 7fc4300200a9e287d693e2df936e0fc9549de0a3
Author: Edward Z. Yang <ezyang at cs.stanford.edu>
Date: Wed Feb 10 11:09:53 2016 +0100
Error early when you register with too old a version of Cabal.
On the GHC 8.0 RCs, multiple users reported a very strange error
whereby GHC would complain that the symbols names recorded in interface
files did not match the expected name. The reason for this is
that they were using an old version of Cabal which chose symbol
names differently from the installed package ID ('id' field) which
the package was to be installed with; GHC 8.0 now mandates that
these coincides.
This change adds a test to ghc-pkg to make sure that 'id' and 'key'
(which is how Cabal previously reported what the symbol name
was supposed to be) match; if they don't match or key is missing,
we assume that the Cabal was too old.
Bikeshed points:
- Should we offer more information about how to upgrade
Cabal correctly (i.e. specify a version?)
- Should we allow for a missing 'key'? If we allow for
'key' to be missing, we lose the ability to detect
Cabal from GHC 7.8 or earlier being used. If we
require it to be specified, then it will not be possible
for Cabal to deprecate the (unused) field and remove it
without having BC for 8.0.
Signed-off-by: Edward Z. Yang <ezyang at cs.stanford.edu>
Test Plan: validate
Reviewers: austin, bgamari, hvr
Reviewed By: hvr
Subscribers: bergmark, thomie
Differential Revision: https://phabricator.haskell.org/D1892
GHC Trac Issues: #11558
(cherry picked from commit d80caca10d7c2fa1c9ee8ef6bcafac365d02ff3d)
>---------------------------------------------------------------
7fc4300200a9e287d693e2df936e0fc9549de0a3
testsuite/tests/cabal/T1750A.pkg | 1 +
testsuite/tests/cabal/T1750B.pkg | 1 +
testsuite/tests/ghci/linking/Makefile | 6 +++---
utils/ghc-pkg/Main.hs | 3 +++
4 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/testsuite/tests/cabal/T1750A.pkg b/testsuite/tests/cabal/T1750A.pkg
index 9bda51e..be290f2 100644
--- a/testsuite/tests/cabal/T1750A.pkg
+++ b/testsuite/tests/cabal/T1750A.pkg
@@ -1,4 +1,5 @@
name: T1750A
version: 1
id: T1750A-1-XXX
+key: T1750A-1-XXX
depends: T1750B-1-XXX
diff --git a/testsuite/tests/cabal/T1750B.pkg b/testsuite/tests/cabal/T1750B.pkg
index 479ce70..6fc7091 100644
--- a/testsuite/tests/cabal/T1750B.pkg
+++ b/testsuite/tests/cabal/T1750B.pkg
@@ -1,4 +1,5 @@
name: T1750B
version: 1
id: T1750B-1-XXX
+key: T1750B-1-XXX
depends: T1750A-1-XXX
diff --git a/testsuite/tests/ghci/linking/Makefile b/testsuite/tests/ghci/linking/Makefile
index c833454..1267650 100644
--- a/testsuite/tests/ghci/linking/Makefile
+++ b/testsuite/tests/ghci/linking/Makefile
@@ -64,7 +64,7 @@ ghcilink004 :
echo 'name: test' >>$(PKG004)
echo 'version: 1.0' >>$(PKG004)
echo 'id: test-XXX' >>$(PKG004)
- echo 'key: test-1.0' >>$(PKG004)
+ echo 'key: test-XXX' >>$(PKG004)
echo 'library-dirs: $${pkgroot}' >>$(PKG004)
echo 'extra-libraries: foo' >>$(PKG004)
'$(GHC_PKG)' init $(LOCAL_PKGCONF004)
@@ -92,7 +92,7 @@ ghcilink005 :
echo 'name: test' >>$(PKG005)
echo 'version: 1.0' >>$(PKG005)
echo 'id: test-XXX' >>$(PKG005)
- echo 'key: test-1.0' >>$(PKG005)
+ echo 'key: test-XXX' >>$(PKG005)
echo 'library-dirs: $${pkgroot}' >>$(PKG005)
echo 'extra-libraries: foo' >>$(PKG005)
'$(GHC_PKG)' init $(LOCAL_PKGCONF005)
@@ -117,7 +117,7 @@ ghcilink006 :
echo "name: test" >>$(PKG006)
echo "version: 1.0" >>$(PKG006)
echo "id: test-XXX" >>$(PKG006)
- echo "key: test-1.0" >>$(PKG006)
+ echo "key: test-XXX" >>$(PKG006)
ifeq "$(WINDOWS)" "YES"
echo "extra-libraries: stdc++-6" >>$(PKG006)
else
diff --git a/utils/ghc-pkg/Main.hs b/utils/ghc-pkg/Main.hs
index 31f6e53..af3032d 100644
--- a/utils/ghc-pkg/Main.hs
+++ b/utils/ghc-pkg/Main.hs
@@ -1612,6 +1612,9 @@ checkUnitId :: InstalledPackageInfo -> PackageDBStack -> Bool
checkUnitId ipi db_stack update = do
let uid = installedUnitId ipi
when (null (display uid)) $ verror CannotForce "missing id field"
+ when (display uid /= compatPackageKey ipi) $
+ verror CannotForce $ "installed package info from too old version of Cabal "
+ ++ "(key field does not match id field)"
let dups = [ p | p <- allPackagesInStack db_stack,
installedUnitId p == uid ]
when (not update && not (null dups)) $
More information about the ghc-commits
mailing list