Skip to content

Fix construction of conflict sets during check for single instance restriction (maybe) #3221

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

Closed
wants to merge 2 commits into from
Closed

Conversation

edsko
Copy link
Contributor

@edsko edsko commented Mar 12, 2016

If correct, this fixes #2843; the first commit is basically @grayjay 's detailed test case (for which many thanks!). However, this needs review by @kosmikus ; have sent a detailed email.

grayjay and others added 2 commits March 12, 2016 12:44
@dcoutts
Copy link
Contributor

dcoutts commented Mar 16, 2016

So I thought I had an "in the wild" test case for this. My notes were in cabal-install.cabal:

-- TODO: bug in linking, this fails, doesn't try text with the same flags as the main one
custom-setup
  setup-depends: text == 1.2.0.6

That is, adding a custom setup section to cabal-install and claiming it has a dep on that version of text. The solver log I saw made me think it was a problem with linking. It would consider some version of text with one set of flags, fail (legitimately) but then never try text with the different set of flags or with tests disabled. So in retrospect my suspicion is that it's not a linking bug but this bug about not having the right conflict sets so that backtracking does not let it consider the choice that would have worked.

However I now cannot reproduce the solver failure. I may be able to with a much older revision. I may find time to try that. The stash I had mentions commit ad6eed5, so that may be worth trying.

@dcoutts
Copy link
Contributor

dcoutts commented Mar 16, 2016

@grayjay BTW, well done on identifying this bug and isolating the test case.

@grayjay
Copy link
Collaborator

grayjay commented Mar 16, 2016

Thanks!

@grayjay
Copy link
Collaborator

grayjay commented Mar 17, 2016

@dcoutts The bug that you described sounds like #2834.

@23Skidoo
Copy link
Member

If @kosmikus won't have time to review this before the 1.24 release, this PR will have to wait until the next point release of cabal-install from the 1.24 branch (either 1.24.0.1 or 1.24.1). Same applies to the other three solver patches assigned to the 1.24 milestone.

@kosmikus
Copy link
Contributor

@23Skidoo What is my current deadline for the 1.24 release?

@23Skidoo
Copy link
Member

@kosmikus I plan to make the 1.24 release simultaneously with GHC 8 final, which will be released around the end of March/beginning of April (I think).

@kosmikus
Copy link
Contributor

@23Skidoo Ok, then I'm still somewhat hopeful that I will make it.

@kosmikus
Copy link
Contributor

So I think this is a step in the right direction. The original code is clearly wrong. The new construction does still look strange, though.

In an SIR-disabled choice, there are two variables that contribute to the conflict, which is reflected by the original code. They're called qpn and qpn' in this scenario. The qpn variable is the direct parent, the qpn' describes the link target.

Now we cannot just add the two variables on their own, but we have to add their goal reason chains as well (because changing something that lead up to the introduction of a goal may mean the goal never gets introduced, and therefore may allow progress). The current PR adds qpn with its goal reason chain, but drops qpn' completely. I think we should add qpn' with its goal reason chain as well.

Unfortunately, it's probably quite tricky (or even impossible) to come up with a test case where the omission of qpn' and its goal reason chain fails, as long as everything else about the solver works ok. The reason is that an SIR-disabled choice only ever appears if there's a sibling that corresponds to the linking choice. These two options are closely related, and will typically fail for similar reasons, with similar conflict sets.

edsko added a commit that referenced this pull request Apr 17, 2016
In the original implemented we recorded only the two conflicting packages; in
the "fix" in #3221 we include the GRC for one of the two packages, but not the
other. This is also wrong, although slightly less so and @kosmikus tells me
that it's actually rather difficult to find an example that exposes the
remaining inaccuracy. I'll have to take him at his word on that :) In this
commit we use the GRC for both goals instead.
@edsko
Copy link
Contributor Author

edsko commented Apr 23, 2016

This has been merged into and subsumed by #3357 .

@edsko edsko closed this Apr 23, 2016
@edsko edsko deleted the pr/SirConflictSets branch April 23, 2016 03:28
23Skidoo pushed a commit that referenced this pull request Apr 23, 2016
In the original implemented we recorded only the two conflicting packages; in
the "fix" in #3221 we include the GRC for one of the two packages, but not the
other. This is also wrong, although slightly less so and @kosmikus tells me
that it's actually rather difficult to find an example that exposes the
remaining inaccuracy. I'll have to take him at his word on that :) In this
commit we use the GRC for both goals instead.

(cherry picked from commit 3bc157a)
23Skidoo pushed a commit to 23Skidoo/cabal that referenced this pull request Apr 23, 2016
In the original implemented we recorded only the two conflicting packages; in
the "fix" in haskell#3221 we include the GRC for one of the two packages, but not the
other. This is also wrong, although slightly less so and @kosmikus tells me
that it's actually rather difficult to find an example that exposes the
remaining inaccuracy. I'll have to take him at his word on that :) In this
commit we use the GRC for both goals instead.

(cherry picked from commit 3bc157a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Conflict set is too small when solver enforces the single instance restriction
5 participants