[commit: ghc] master: Correctly account for -package-db ordering when picking packages. (e0eaea9)

git at git.haskell.org git at git.haskell.org
Tue Mar 21 01:18:25 UTC 2017


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/e0eaea918c32b3aa445708656876d1e2aef94a13/ghc

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

commit e0eaea918c32b3aa445708656876d1e2aef94a13
Author: Edward Z. Yang <ezyang at cs.stanford.edu>
Date:   Sun Mar 19 16:07:49 2017 -0700

    Correctly account for -package-db ordering when picking packages.
    
    Summary:
    When I originally implemented ABI-based shadowing as per
    ee4e1654c31b9c6f6ad9b19ece25f040bbbcbd72, I switched our strategy
    from pasting together lists to creating a map of all units first,
    and then selecting packages from this.  However, what I did
    not realize when doing this was that we actually depended
    on the *ordering* of these lists later, when we selected
    a preferred package to use.
    
    The crux is if I have -package-db db1 -package-db db2 -package p-0.1,
    and p-0.1 is provided by both db1 and db2, which one does the
    -package flag select?  Previously, this was undetermined; now
    we always select the instance from the LATEST package database.
    (If p-0.1 shows up multiple times in the same database, once again
    the chosen package is undefined.)
    
    The reason why cabal08 intermittently failed was that, in practice,
    we were sorting on the UnitId, so when we bumped version numbers,
    that often wibbled the UnitIds so that they compared oppositely.
    I've extended the test so that we check that the relation is
    antisymmetric.
    
    Fixes #13313
    
    Signed-off-by: Edward Z. Yang <ezyang at cs.stanford.edu>
    
    Test Plan: validate
    
    Reviewers: bgamari, austin
    
    Subscribers: rwbarton, thomie
    
    Differential Revision: https://phabricator.haskell.org/D3369


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

e0eaea918c32b3aa445708656876d1e2aef94a13
 compiler/main/Packages.hs                    | 111 +++++++++++++++++++--------
 testsuite/tests/cabal/cabal08/Makefile       |   8 +-
 testsuite/tests/cabal/cabal08/all.T          |   3 +-
 testsuite/tests/cabal/cabal08/cabal08.stdout |   6 ++
 4 files changed, 93 insertions(+), 35 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 e0eaea918c32b3aa445708656876d1e2aef94a13


More information about the ghc-commits mailing list