hexpm / hex

Package manager for the Erlang VM

Home Page:https://hex.pm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Infinite loop encountered in requirement solver

benjamin-brewer opened this issue · comments

I'm still trying to dig up an actual mix.exs and mix.lock that will reproduce this, as it's happening in a private repo for me.

Basically, I'm running into an infinite loop for a dependency (jason) when I hit this function

defp to_range(op1, version1, :~>, version2) do
with (:~>, {1, 3, nil, [], []}, :~>, {1, 2, nil, [], []}). As in the function just calls itself over and over again when the first and third args are the same.

Like I said, I'll try and come up with an example repo with a lock file that can force this to happen. Thanks!

Other details:

  • Mac OS 12.6 Intel
  • elixir 1.13.3-otp-24
  • erlang 24.2
  • archive install of hex main repo with some IO.inspects to track down the loop (cf5b231)

Here is a repo and mix file with an example of the problem. I narrowed it down to a private repo that has a dep spec that is {:jason, "~> 1.2 and ~> 1.3"}, which I honestly haven't read the docs enough to know if that's even legimate anymore/ever 😅 . We also found locations that were using or, so those may be a bit more practical? Ex. {:telemetry, "~> 0.4 or ~> 1.0"}

We'll fix those particular specs, but would it be possible to have a nice error message instead of an infinite loop, in this case?

https://github.com/benjamin-brewer/hex_loop_example/blob/main/mix.exs

Thanks for the report. This fix will be included in the next release.