Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependency solver allows cycles between packages and their setup scripts. #4161

Closed
grayjay opened this issue Dec 7, 2016 · 0 comments
Closed

Comments

@grayjay
Copy link
Collaborator

grayjay commented Dec 7, 2016

I noticed this while debugging #4154.

example.cabal:

name: example
version: 1
cabal-version: >= 1.2

custom-setup
  setup-depends:
    example

library
$ cabal new-build --dry-run -v3
[...]
Resolving dependencies...
targets: example
constraints: 
  base installed (non-upgradeable package)
  ghc-prim installed (non-upgradeable package)
  integer-gmp installed (non-upgradeable package)
  Cabal >=1.20 (new-build's support of Custom Setup (issue #3932))
  example ==1 (user target)
preferences: 
  example [TestStanzas,BenchStanzas]
  ADPfusion <0.4.0.0 || >0.4.0.0
  [...]
  yocto >=1
  zip-archive <0.2.3 || >0.2.3 && <0.2.3.1 || >0.2.3.1
strategy: PreferLatestForSelected
reorder goals: False
count conflicts: True
independent goals: False
avoid reinstalls: False
shadow packages: False
strong flags: False
max backjumps: 2000
[__0] trying: example-1 (user goal)
[__1] next goal: example-setup.example (dependency of example-1)
[__1] trying: example-setup.example~>example-1
[__2] done
internal error: could not construct a valid install plan.
The proposed (invalid) plan contained the following problems:
Package example-1 has an invalid configuration, in particular:
the package has a dependency example -any but no package has been selected to
satisfy it.

Proposed plan:
Configured example-1

CallStack (from HasCallStack):
error, called at ./Distribution/Client/Dependency.hs:705:33 in
main:Distribution.Client.Dependency

The solver should keep searching, because it might be able to avoid the cycle in some situations.

grayjay added a commit to grayjay/cabal that referenced this issue Jan 13, 2018
…askell#4161).

The solver already detected cycles involving more than one package, but it
allowed dependencies between components within a package.  This commit treats a
dependency between a package's setup script and library as a cycle in order to
allow the solver to backtrack and try to break the cycle.
grayjay added a commit to grayjay/cabal that referenced this issue Jan 13, 2018
…askell#4161).

The solver already detected cycles involving more than one package, but it
allowed dependencies between components within a package.  This commit treats a
dependency between a package's setup script and library as a cycle in order to
allow the solver to backtrack and try to break the cycle.  A more thorough
solution would involve tracking all dependencies between components, as in

This commit also fixes the internal error in issue haskell#4980.
grayjay added a commit to grayjay/cabal that referenced this issue Jan 13, 2018
…askell#4161).

The solver already detected cycles involving more than one package, but it
allowed dependencies between components within a package.  This commit treats a
dependency between a package's setup script and library as a cycle in order to
allow the solver to backtrack and try to break the cycle.  A more thorough
solution would involve tracking all dependencies between components, as in haskell#4087.

This commit also fixes the internal error in issue haskell#4980.
grayjay added a commit that referenced this issue Jan 21, 2018
Solver: Detect cycles between packages and their setup scripts (fixes #4161).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant