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

Sandbox targets can prevent reinstallation of packages with setup dependencies #3203

Closed
grayjay opened this issue Mar 2, 2016 · 9 comments
Closed

Comments

@grayjay
Copy link
Collaborator

grayjay commented Mar 2, 2016

While experimenting with the custom-setup section, I was unable to reinstall a package that depended on two versions of another package. The list of targets in the -v3 log contained all of the installed packages, as well as a second occurrence of the main package. The extra target seemed to prevent the solver from choosing setup dependencies.

I wrote some tests that demonstrate the behavior. The unit tests show the effect of duplicate targets, and the integration test reproduces the problem in a sandbox. I'm not sure if this is a bug in sandboxes or the solver.

EDIT: The integration test installs the two dependencies in the sandbox, but I got a similar error when they were installed globally.

Tests: grayjay@42a8bd1
Log: https://ci.appveyor.com/project/grayjay/cabal/build/1.0.78

Unit test database:

  [
       Right $ exAv "A" 1 [ExAny "B"] `withSetupDeps` [ExFix "C" 1]
     , Right $ exAv "B" 1 []          `withSetupDeps` [ExFix "C" 2]
     , Right $ exAv "C" 1 []
     , Right $ exAv "C" 2 []
  ]

Installing A and B:

targets: A, B
[...]
[__0] trying: A-1.0.0 (user goal)
[__1] trying: B-1.0.0 (user goal)
[__2] next goal: A-setup.C (dependency of A-1.0.0)
[__2] rejecting: A-setup.C-2.0.0 (conflict: A => A-setup.C==1.0.0)
[__2] trying: A-setup.C-1.0.0
[__3] next goal: B-setup.C (dependency of B-1.0.0)
[__3] rejecting: B-setup.C~>A-setup.C-1.0.0 (conflict: B => B-setup.C==2.0.0)
[__3] trying: B-setup.C-2.0.0
[__4] done

Specifying each target twice:

targets: A, A, B, B
[...]
[__0] trying: A-1.0.0 (user goal)
[__1] trying: A~>A-1.0.0 (user goal)
[__2] trying: B-1.0.0 (user goal)
[__3] trying: B~>B-1.0.0 (user goal)
[__4] next goal: A-setup.C (dependency of A-1.0.0)
[__4] rejecting: A-setup.C-2.0.0 (conflict: A => A-setup.C==1.0.0)
[__4] trying: A-setup.C-1.0.0
[__5] next goal: B-setup.C (dependency of B-1.0.0)
[__5] rejecting: B-setup.C~>A-setup.C-1.0.0 (conflict: B => B-setup.C==2.0.0)
[__5] rejecting: B-setup.C-2.0.0 (dependencies not linked: cannot make B-setup.C canonical member of {*A-setup.C-1.0.0,B-setup.C-1.0.0,C-1.0.0}; conflict set: B-setup.C, A, B)
[__5] rejecting: B-setup.C-1.0.0 (multiple instances)
[__4] fail (backjumping, conflict set: A-setup.C, B-setup.C, A, B)
[__3] rejecting: B-1.0.0 (multiple instances)
[__2] fail (backjumping, conflict set: A-setup.C, B-setup.C, A, B)
[__1] rejecting: A-1.0.0 (multiple instances)
[__0] fail (backjumping, conflict set: A-setup.C, B-setup.C, A, B)
@23Skidoo
Copy link
Member

23Skidoo commented Mar 9, 2016

Can this be solved by simply deduplicating the list of targets?

@grayjay
Copy link
Collaborator Author

grayjay commented Mar 9, 2016

I don't know. I didn't understand why the solver linked the unqualified goals and rejected B-setup.C-2.0.0 in the second run.

@grayjay
Copy link
Collaborator Author

grayjay commented Apr 13, 2016

@23Skidoo It looks like the open solver pull requests allow the solver to handle duplicate targets.

@grayjay
Copy link
Collaborator Author

grayjay commented Jul 5, 2016

@23Skidoo Do you mind if I create a label for issues with build type Custom?

@23Skidoo
Copy link
Member

23Skidoo commented Jul 5, 2016

@grayjay Not at all, please go ahead.

@grayjay
Copy link
Collaborator Author

grayjay commented Jul 5, 2016

Thanks. How about "custom-setup"?

@23Skidoo
Copy link
Member

23Skidoo commented Jul 5, 2016

SGTM.

grayjay added a commit to grayjay/cabal that referenced this issue Sep 5, 2016
The solver can handle duplicate targets by linking them together, but the log
is more complex, and the result is the same as if the targets were deduplicated
beforehand.

Duplicate targets can occur in a sandbox (issue haskell#3203).
@grayjay
Copy link
Collaborator Author

grayjay commented Sep 5, 2016

The failure to find an install plan was fixed by #3357, and #3779 removes the duplicate targets.

grayjay added a commit to grayjay/cabal that referenced this issue Sep 5, 2016
The solver can handle duplicate targets by linking them together, but the log
is more complex, and the result is the same as if the targets were deduplicated
beforehand.

Duplicate targets can occur in a sandbox (issue haskell#3203).
@grayjay
Copy link
Collaborator Author

grayjay commented Sep 7, 2016

Fixed

@grayjay grayjay closed this as completed Sep 7, 2016
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

3 participants