Skip to content

Solver sometimes filters out relevant lines in the summarized log. #4792

Closed

Description

@sebright

Here is an example of an incomplete summarized log:

$ cabal install --dry-run thorn --max-backjumps -1
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: base-4.9.1.0/installed-4.9... (dependency of thorn-0.2)
next goal: profunctors (dependency of thorn-0.2)
rejecting: profunctors-5.2.1, profunctors-5.2, profunctors-5.1.2,
profunctors-5.1.1, profunctors-5.1, profunctors-5.0.1, profunctors-5.0.0.1,
profunctors-5 (conflict: thorn => profunctors<5)
trying: profunctors-4.4.1
next goal: transformers (dependency of profunctors-4.4.1)
rejecting: transformers-0.5.2.0/installed-0.5..., transformers-0.5.4.0,
transformers-0.5.2.0, transformers-0.5.1.0, transformers-0.5.0.1,
transformers-0.5.0.0 (conflict: profunctors => transformers>=0.2 && <0.5)
rejecting: transformers-0.4.3.0, transformers-0.4.2.0 (conflict:
base==4.9.1.0/installed-4.9..., transformers => base>=2 && <4.9)
rejecting: transformers-0.4.1.0, transformers-0.3.0.0, transformers-0.2.2.1
(conflict: base==4.9.1.0/installed-4.9..., transformers +/-applicativeinbase
=> base>=2 && <4.8 || >=1.0 && <2)
rejecting: transformers-0.2.1.0, transformers-0.2.0.0 (conflict:
base==4.9.1.0/installed-4.9..., transformers +/-applicativeinbase => base>=2
&& <4.3 || >=1.0 && <2)
rejecting: transformers-0.1.4.0, transformers-0.1.3.0, transformers-0.1.1.0,
transformers-0.1.0.1, transformers-0.0.1.0, transformers-0.0.0.0,
transformers-0.5.3.1, transformers-0.5.3.0, transformers-0.5.0.2 (conflict:
profunctors => transformers>=0.2 && <0.5)
rejecting: transformers-0.4.0.0 (conflict: base==4.9.1.0/installed-4.9...,
transformers +/-applicativeinbase => base>=2 && <4.8 || >=1.0 && <2)
rejecting: transformers-0.2.2.0 (conflict: base==4.9.1.0/installed-4.9...,
transformers +/-applicativeinbase => base>=2 && <4.6 || >=1.0 && <2)
rejecting: transformers-0.1.0.0 (conflict: profunctors => transformers>=0.2 &&
<0.5)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: semigroupoids, comonad, transformers,
profunctors, bifunctors, base, base-orphans, transformers-compat,
distributive, thorn, comonad-5.0.2:distributive, semigroupoids-4.0.4:comonad,
semigroupoids-4.0.3:comonad, semigroupoids-4.2:comonad

It is missing the line where the solver chooses thorn. thorn is relevant to the conflict, because it introduces base and profunctors, which directly conflict with transformers.

The first line of the full log shows the choice for thorn:

[__0] trying: thorn-0.2 (user goal)
[__1] trying: base-4.9.1.0/installed-4.9... (dependency of thorn-0.2)
[__2] trying: rts-1.0/installedrts (dependency of base-4.9.1.0/installed-4.9...)
[__3] trying: integer-gmp-1.0.0.1/installed-1.0... (dependency of base-4.9.1.0/installed-4.9...)
[__4] trying: ghc-prim-0.5.0.0/installed-0.5... (dependency of base-4.9.1.0/installed-4.9...)
[__5] next goal: profunctors (dependency of thorn-0.2)
[__5] rejecting: profunctors-5.2.1, profunctors-5.2, profunctors-5.1.2, profunctors-5.1.1, profunctors-5.1, profunctors-5.0.1, profunctors-5.0.0.1, profunctors-5 (conflict: thorn => profunctors<5)
[__5] trying: profunctors-4.4.1
[__6] next goal: transformers (dependency of profunctors-4.4.1)
[__6] rejecting: transformers-0.5.2.0/installed-0.5..., transformers-0.5.4.0, transformers-0.5.2.0, transformers-0.5.1.0, transformers-0.5.0.1, transformers-0.5.0.0 (conflict: profunctors => transformers>=0.2 && <0.5)
[__6] rejecting: transformers-0.4.3.0, transformers-0.4.2.0 (conflict: base==4.9.1.0/installed-4.9..., transformers => base>=2 && <4.9)
[__6] rejecting: transformers-0.4.1.0, transformers-0.3.0.0, transformers-0.2.2.1 (conflict: base==4.9.1.0/installed-4.9..., transformers +/-applicativeinbase => base>=2 && <4.8 || >=1.0 && <2)
[__6] rejecting: transformers-0.2.1.0, transformers-0.2.0.0 (conflict: base==4.9.1.0/installed-4.9..., transformers +/-applicativeinbase => base>=2 && <4.3 || >=1.0 && <2)
[__6] rejecting: transformers-0.1.4.0, transformers-0.1.3.0, transformers-0.1.1.0, transformers-0.1.0.1, transformers-0.0.1.0, transformers-0.0.0.0, transformers-0.5.3.1, transformers-0.5.3.0, transformers-0.5.0.2 (conflict: profunctors => transformers>=0.2 && <0.5)
[__6] rejecting: transformers-0.4.0.0 (conflict: base==4.9.1.0/installed-4.9..., transformers +/-applicativeinbase => base>=2 && <4.8 || >=1.0 && <2)
[__6] rejecting: transformers-0.2.2.0 (conflict: base==4.9.1.0/installed-4.9..., transformers +/-applicativeinbase => base>=2 && <4.6 || >=1.0 && <2)
[__6] rejecting: transformers-0.1.0.0 (conflict: profunctors => transformers>=0.2 && <0.5)
[__6] fail (backjumping, conflict set: base, profunctors, transformers)
[...]

I think that thorn was filtered out of the summary because the solver only shows lines that relate to variables that are in the conflict set located at the first backjump (implemented in Log.hs). In this case, the conflict set only contains base, profunctors, and transformers.

The conflict set is small because the solver only adds the reason for each dependency to the conflict set as it ascends the tree. It would have added thorn later, when it backtracked back to base or profunctors.

I'm not sure how to calculate the appropriate conflict set for filtering the log, especially since we don't currently store the whole chain of dependencies in every package choice node. One possible solution is my comment in #941 (comment), because it doesn't require filtering the log; it uses the whole log from a second run of the solver.

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