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

Fix some of the unhelpful conflict messages by merging formulas that include each other #5210

Closed
wants to merge 2 commits into from

Conversation

kit-ty-kate
Copy link
Member

@kit-ty-kate kit-ty-kate commented Aug 1, 2022

I spent today trying to fix one of the issue mentionned in the first comment of #4373 reproduced (somewhat) by:

FROM ocaml/opam:debian-ocaml-4.12
RUN sudo ln -f /usr/bin/opam-dev /usr/bin/opam
RUN git -C ~/opam-repository reset --hard 143dd2a2f59f5befbf3cb90bb2667f911737fbf8
RUN opam update
RUN opam pin ocaml-base-compiler --current
RUN opam pin ocaml-options-vanilla --current
RUN opam pin ocaml --current
RUN opam pin ocaml-config --current
RUN opam install expect.0.0.6

which gives:

Step 9/9 : RUN opam install expect.0.0.6
 ---> Running in 3845d2fd821b
[ERROR] Package conflict!
No solution found, exiting
  * Missing dependency:
    - expect >= 0.0.6 -> batteries -> ocaml < 4.00.0
    not available because the package is pinned to version 4.12.1
  * Missing dependency:
    - expect >= 0.0.6 -> batteries -> ocaml < 4.01.0
    not available because the package is pinned to version 4.12.1
  * Missing dependency:
    - expect >= 0.0.6 -> batteries -> ocaml < 4.02.0
    not available because the package is pinned to version 4.12.1
  * Missing dependency:
    - expect >= 0.0.6 -> batteries -> ocaml < 4.03.0
    not available because the package is pinned to version 4.12.1
  * Missing dependency:
    - expect >= 0.0.6 -> batteries -> ocaml < 4.04.0
    not available because the package is pinned to version 4.12.1
  * Missing dependency:
    - expect >= 0.0.6 -> batteries -> ocaml < 4.05.0
    not available because the package is pinned to version 4.12.1
  * Missing dependency:
    - expect >= 0.0.6 -> batteries -> ocaml < 4.06.0
    not available because the package is pinned to version 4.12.1
  * Missing dependency:
    - expect >= 0.0.6 -> batteries -> ocaml < 4.07.0
    not available because the package is pinned to version 4.12.1
  * Missing dependency:
    - expect >= 0.0.6 -> batteries -> ocaml < 4.08.0
    not available because the package is pinned to version 4.12.1
  * Missing dependency:
    - expect >= 0.0.6 -> batteries -> ocaml < 4.10.0
    not available because the package is pinned to version 4.12.1
  * Missing dependency:
    - expect >= 0.0.6 -> batteries -> ocaml < 4.11.0
    not available because the package is pinned to version 4.12.1
  * Missing dependency:
    - expect >= 0.0.6 -> batteries -> ocaml < 4.12.0
    not available because the package is pinned to version 4.12.1

The command '/bin/sh -c opam install expect.0.0.6' returned a non-zero code: 20

for some reason this is a bit different than the comment mentionned in #4373 but I suppose this is caused by the the multiple pins --current. In any case this sort of issue happens all the time on macOS/arm64 as shown by #4373 (comment)

The goal of the change is to merge similar Missing cases. I know @AltGr mentioned that the code already filters something but I couldn’t find that part of the code and figured it would be fine to duplicate this, even if just for debugging purpose.

With this change opam install expect.0.0.6 shows the expected:

[ERROR] Package conflict!
  * Missing dependency:
    - expect >= 0.0.6 -> batteries -> ocaml < 4.12.0
    not available because the package is pinned to version 4.12.1

No solution found, exiting

@kit-ty-kate kit-ty-kate added the PR: WIP Not for merge at this stage label Aug 31, 2022
@kit-ty-kate kit-ty-kate changed the title [Draft] Try to fix some of the unhelpful conflict messages Fix some of the unhelpful conflict messages by merging formulas that include each other Jul 17, 2024
@kit-ty-kate kit-ty-kate added AREA: SOLVER AREA: ENGINE and removed PR: WIP Not for merge at this stage labels Jul 17, 2024
@kit-ty-kate kit-ty-kate added this to the 2.3.0~alpha milestone Jul 17, 2024
# Return code 50 #
### opam install --show ppx_expect.v0.14.0
[ERROR] No switch is currently set. Please use 'opam switch' to set or install a switch
# Return code 50 #
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note for developers: this test was included in #4504 for the same purpose but has never tested anything

Copy link
Collaborator

@rjbou rjbou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

not available because the package is pinned to version 4.12.0
* Missing dependency:
- expect >= 0.0.6 -> batteries -> ocaml < 4.12.0
- ocaml < 4.12.0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For these conflict message tests, it can be helpful to know what is the "intended output". I'm not sure if it is always simple to know in advance.
Here if we know that it is ocaml < 4.12.0 the conflict that we want to highlight (i suppose that from the pin above), a comment may help to know that the fix is good (and not a simplification that outputs the wrong message).
This case is simple thought to determine thought.

@@ -1024,6 +1022,7 @@ let extract_explanations packages cudfnv2opam reasons : explanation list =
not (List.exists (function `Conflict (_,_,has_invariant) -> has_invariant | _ -> false) explanations)
in
let msg = `Conflict (msg1, msg2, msg3) in
(* TODO: remove this List.mem *)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
(* TODO: remove this List.mem *)
(* TODO: remove this List.mem, cf [explanations] below *)

@kit-ty-kate kit-ty-kate marked this pull request as draft August 8, 2024 20:24
@kit-ty-kate
Copy link
Member Author

The review highlighted a small issue i would like to fix and understand first so I'm closing this one in favor of #6106

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.

2 participants