Skip to content

--independent-goals can produce an invalid install plan #2842

Closed

Description

@sebright

Here is a test case. It is very fragile, because the failure completely depends on the order that the solver chooses to solve for variables.
sebright@bca1eda

targets: D, E, F
constraints: 
  stanzas A test (unknown source)
  stanzas B test (unknown source)
  stanzas C test (unknown source)
  stanzas C test (unknown source)
  stanzas D test (unknown source)
  stanzas E test (unknown source)
  stanzas F test (unknown source)
preferences: 
strategy: PreferLatestForSelected
[__0] trying: 0.D-1.0.0 (user goal)
[__1] next goal: 0.C (dependency of 0.D-1.0.0)
[__1] rejecting: 0.C-2.0.0 (conflict: 0.D => 0.C==1.0.0)
[__1] trying: 0.C-1.0.0
[__2] trying: 0.A-1.0.0 (dependency of 0.D-1.0.0)
[__3] trying: 1.E-1.0.0 (user goal)
[__4] next goal: 1.C (dependency of 1.E-1.0.0)
[__4] rejecting: 1.C~>0.C-1.0.0 (conflict: 1.E => 1.C==2.0.0)
[__4] trying: 1.C-2.0.0
[__5] trying: 1.B-1.0.0 (dependency of 1.E-1.0.0)
[__6] trying: 2.F-1.0.0 (user goal)
[__7] trying: 2.B~>1.B-1.0.0 (dependency of 2.F-1.0.0)
[__8] trying: 2.C~>1.C-2.0.0 (dependency of 2.B-1.0.0)
[__9] next goal: 2.A (dependency of 2.F-1.0.0)
[__9] rejecting: 2.A~>0.A-1.0.0 (dependencies not linked: cannot merge {*1.C-2.0.0,2.C-2.0.0} and {*0.C-1.0.0}; conflict set: 0.C, 1.C, 2.A, 2.B, 2.C)
[__9] rejecting: 2.A-1.0.0 (multiple instances)
[__9] fail (backjumping, conflict set: 0.A, 0.C, 1.C, 2.A, 2.B, 2.C)
[__8] trying: 2.C~>0.C-1.0.0
[__9] next goal: 2.A (dependency of 2.F-1.0.0)
[__9] trying: 2.A~>0.A-1.0.0
[_10] done
FAIL
        message threw an exception: internal error: could not construct a valid install plan.
        The proposed (invalid) plan contained the following problems:
        Package C is required by several packages, but they require inconsistent versions:
          package A-1.0.0 requires C-1.0.0
          package B-1.0.0 requires C-2.0.0

        Proposed plan:
        Configured A-1.0.0 (.fake.A-1.0.0)
        Configured B-1.0.0 (.fake.B-1.0.0)
        Configured C-1.0.0 (.fake.C-1.0.0)
        Configured C-2.0.0 (.fake.C-2.0.0)
        Configured D-1.0.0 (.fake.D-1.0.0)
        Configured E-1.0.0 (.fake.E-1.0.0)
        Configured F-1.0.0 (.fake.F-1.0.0)

When 2.B is linked to 1.B, it adds its dependency 2.C to 1.C's link group. Then 2.C is linked to 0.C without a check for an existing link group. Since 0.C and 1.C have different versions, the install plan is invalid.

As far as I can tell, this could be fixed in D.C.Dependency.Modular.Linking.pickLink. If package 1.A is being linked with 0.A, the solver should backtrack if 1.A is already in a link group that cannot be merged with 0.A's link group.

Activity

  1. 23Skidoo commented on Sep 27, 2015

    @23Skidoo
    Member
  2. kosmikus commented on Oct 12, 2015

    @kosmikus
    Contributor

    /cc @edsko

  3. edsko commented on Mar 19, 2016

    @edsko
    Contributor

    Looking at this now.

  4. added a commit that references this issue on Mar 28, 2016
    0439bbc
  5. ezyang commented on Mar 31, 2016

    @ezyang
    Contributor

    For those playing along at home, this behavior would be toggled by the --independent-goals flag, but this flag is currently disabled because this feature does not really work.

  6. sebright commented on Mar 31, 2016

    @sebright
    CollaboratorAuthor

    @ezyang I was wondering why --independent-goals wasn't exposed. What doesn't work? I thought it was very similar to setup dependencies, except that it applies to top-level goals instead of setup scripts.

  7. ezyang commented on Mar 31, 2016

    @ezyang
    Contributor

    According to git blame, it was disabled in this commit:

    commit d89fedd
    Author: Andres Loeh [email protected] Mon Apr 16 05:30:24 2012
    Committer: Andres Loeh [email protected] Mon Apr 16 05:30:24 2012

    handling the solver options properly in config file

    Other than that, I don't know.

  8. added a commit that references this issue on Apr 21, 2016
    34bfdf8
  9. added 2 commits that reference this issue on Apr 23, 2016
    cd99108
    8474308
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions