Skip to content

Commit

Permalink
Nub exe_deps, fixes haskell#4986
Browse files Browse the repository at this point in the history
Previously, if you had:

  build-tool-depends: happy:happy
  build-tools: happy

This would cause an executable dependency to show up twice in exe_deps.
It turns out that this made its way all the way to cabal-install's
InstallPlan, and then broke an invariant in the install plan execution
engine.  This is the "correct" fix but the whole arrangement is a little
brittle.

Signed-off-by: Edward Z. Yang <[email protected]>
  • Loading branch information
ezyang committed Jan 3, 2018
1 parent b9a5bed commit 903fd2d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Cabal/Distribution/Backpack/ConfiguredComponent.hs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import Distribution.Simple.LocalBuildInfo
import Distribution.Version
import Distribution.Utils.LogProgress
import Distribution.Utils.MapAccum
import Distribution.Utils.Generic

import Control.Monad
import qualified Data.Set as Set
Expand Down Expand Up @@ -191,7 +192,11 @@ toConfiguredComponent pkg_descr this_cid dep_map component = do
, pn /= packageName pkg_descr
, (cn, e) <- Map.toList comp_map
, cn == CLibName ]
exe_deps =
-- We have to nub here, because 'getAllToolDependencies' may return
-- duplicates (see #4986). (NB: This is not needed for lib_deps,
-- since those elaborate into includes, for which there explicitly
-- may be multiple instances of a package)
exe_deps = ordNub $
[ exe
| ExeDependency pn cn _ <- getAllToolDependencies pkg_descr bi
-- The error suppression here is important, because in general
Expand Down

0 comments on commit 903fd2d

Please sign in to comment.