[commit: ghc] ghc-8.2: Fix #13703 by correctly using munged names in ghc-pkg. (8054a74)

git at git.haskell.org git at git.haskell.org
Sat May 20 16:42:33 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : ghc-8.2
Link       : http://ghc.haskell.org/trac/ghc/changeset/8054a7435dc15bc45c04adabe098a78ff6d6a7eb/ghc

>---------------------------------------------------------------

commit 8054a7435dc15bc45c04adabe098a78ff6d6a7eb
Author: Edward Z. Yang <ezyang at cs.stanford.edu>
Date:   Mon May 15 21:17:45 2017 -0700

    Fix #13703 by correctly using munged names in ghc-pkg.
    
    Summary:
    Cabal internal libraries are implemented using a trick, where the 'name'
    field in ghc-pkg registration file is munged into a new form to keep
    each internal library looking like a distinct package to ghc-pkg and
    other tools; e.g. the internal library q from package p is named
    z-p-z-q.
    
    Later, Cabal library got refactored so that we made a closer distinction
    between these "munged" package names and the true package name of a
    package.  Unfortunately, this is an example of a refactor for clarity in
    the source code which ends up causing problems downstream, because the
    point of "munging" the package name was to make it so that ghc-pkg and
    similar tools transparently used MungedPackageName whereever they
    previously used PackageName (in preparation for them learning proper
    syntax for package name + component name).  Failing to do this meant
    that internal libraries from the same package (but with different
    names) clobber each other.
    
    This commit search-replaces most occurrences of PackageName in
    ghc-pkg and turns them into MungedPackageName. Otherwise there
    shouldn't be any functional differenes.
    
    Signed-off-by: Edward Z. Yang <ezyang at cs.stanford.edu>
    
    Test Plan: validate
    
    Reviewers: bgamari, austin
    
    Subscribers: rwbarton, thomie
    
    GHC Trac Issues: #13703
    
    Differential Revision: https://phabricator.haskell.org/D3590
    
    (cherry picked from commit d9e9a9b3016a05e6153de3803998877f91c6cdf4)


>---------------------------------------------------------------

8054a7435dc15bc45c04adabe098a78ff6d6a7eb
 testsuite/.gitignore                 |  1 +
 testsuite/tests/cabal/Makefile       |  8 +++++
 testsuite/tests/cabal/T13703.stdout  |  4 +++
 testsuite/tests/cabal/all.T          |  2 ++
 testsuite/tests/cabal/test13703a.pkg | 20 +++++++++++
 testsuite/tests/cabal/test13703b.pkg | 20 +++++++++++
 utils/ghc-pkg/Main.hs                | 66 +++++++++++++++++++-----------------
 7 files changed, 89 insertions(+), 32 deletions(-)

Diff suppressed because of size. To see it, use:

    git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 8054a7435dc15bc45c04adabe098a78ff6d6a7eb


More information about the ghc-commits mailing list