Spurious(?) `opam is out of date` message

I just installed opam version 2.2.0 from Homebrew, and when I ran opam init, I received the following warning message:

<><> Fetching repository information ><><><><><><><><><><><><><><><><><><><>  🐫
[default] Initialised
default (at https://opam.ocaml.org):
    [WARNING] opam is out-of-date. Please consider updating it (https://opam.ocaml.org/doc/Install.html)

I had been under the impression that opam 2.2 was the latest version; the referenced opam - Install link does not indicate otherwise… Am I missing something?

That is very strange, given that Update the out-of-date opam warning after the release of opam 2.2.1 by kit-ty-kate · Pull Request #26393 · ocaml/opam-repository · GitHub is not yet merged. Maybe both an odd question, and impossible to check now, but are you absolutely certain the opam actually called by opam init was the opam 2.2.0 binary just installed by Homebrew? (no others in path from which -a opam, etc. or from a cached path entry prior to calling hash -r?)

It would also be helpful if this warning message prints the current version of opam and the version it thinks should be upgraded to.

1 Like

Already done in Update the out-of-date opam warning after the release of opam 2.2.1 by kit-ty-kate · Pull Request #26393 · ocaml/opam-repository · GitHub - at least for displaying the version of opam encountered. I’m not so sure about displaying the version it thinks it should be upgraded to - that can end up being out-of-date (e.g. with a pinned opam-repository).

2 Likes

Hi! That’s a good question. I think, but cannot confirm, that it was the correct binary. My (weak) evidence is the following:

  1. First, I got this message in a manually installed copy of opam. Because it was the latest version already, I was a bit confused, so I wiped out my entire OCaml ecosystem, deleting ~/.opam, as usual to start over, in case some subtle inconsistent state was causing this like so many other things.

  2. Then, after verifying that there were no OCaml-related binaries in my PATH, I installed opam using homebrew and ran opam init. Here, I received the same message.

Hmm - are you able to run it again, although rather than deleting ~/.opam, just renaming it temporarily? (i.e. mv ~/.opam ~/.opam.bak ; opam init and then subsequently rm -rf ~/.opam ; mv ~/.opam.bak ~/.opam).

Will check next week when I return to my office!