-
Notifications
You must be signed in to change notification settings - Fork 371
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
Why is going from version ~x to version ~x~y an upgrade? #4272
Comments
Hi! What's happening here is that the algorithm from Debian that opam is using is interpreting dashes in version names very early. These version strings are parsed like this:
and
To compare these, upstream revisions are first compared, and it amounts to comparing the end of string in the first one to the first dash in the second one. So, the second one is greater. This is weird and confusing, but this is consistent with the behavior in
So I think you can fix this issue by removing dashes in version parts:
|
@emillon : thanks for shedding some light on this mystery - well actually a lot of light! The opam manual explicitly directs to the Debian definition but also gives its own definition (see link in initial post). Would you say that this behavior matches the opam documentation? I don't think so because hyphens are not mentioned as having a special meaning. So I would still say that it is a documentation bug. Either the opam manual should give a correct description of the Debian algorithm or just refer to the Debian definition and give some illustrative typical examples. |
The part in the opam manual seems correct to me, but it only describes how to compare two "revisions" (not an official name), not the whole strings with epoch and local revision. I agree that it's a documentation bug. |
Should I suggest a correction and you review it? |
Sure! |
I actually wasn't aware of this (or forgot 🙄), thanks @emillon. Maybe we should simplify the comparison to remove both the epoch and local revision parts, that would make more sense to me 🤔 No opam package that I am aware of uses the epoch or revisions. |
I am fine either way but agree that as is it is more complicated than necessary without giving much of an advantage. Either way the documentation should state this explicitly. Sorry for not following up on this as yet - I am quite busy with a largish opam based meta build project (https://github.com/MSoegtropIMC/coq-platform) and have quite a few loose threads right now. |
At least nocrypto does, it was updated to As for epochs, no packages seem to use them right now, but this should be useful when we reach a scale when some packages change their version format. |
Cross-referencing #4566 |
Put on the 2.2.0 spike for @AltGr - we should definitely sort the documentation but possibly also take the opportunity to simplify the version handling as suggested in #4272 (comment) |
As specified in the docs, and not as handled in Debian: we used to run the Debian comparison from Dose, which handled epoch prefixes and revision suffixes in an undocumented way (undocumented in opam, not blaming Dose here!). Closes ocaml#4272
During upgrade I saw these updates:
I wonder why going from
3.7~coq-platform
to3.7~coq-platform~open-source
is considered an upgrade. Shouldn't according to the documentation3.7~coq-platform~open-source
be smaller in the version ordering than3.7~coq-platform
since~
is smaller than any character, including end of line?See: (https://opam.ocaml.org/doc/Manual.html#Package-Formulas)
It looks like
~
is considered as smaller than end of line only at the beginning of a word, but not in the middle of a word.The text was updated successfully, but these errors were encountered: