Skip to content

Commit

Permalink
Merge pull request #65 from behrmann/caretcomparison
Browse files Browse the repository at this point in the history
Caret comparison
  • Loading branch information
bluca committed Jul 12, 2023
2 parents 3077c14 + d8d04f1 commit 5a0799d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion specs/version_format_specification.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ strings are found to compare as different. In a loop:
the string with `-` compares lower. Otherwise, both minus characters are skipped.
5. If the remaining part of one of strings starts with `^`:
if the other remaining part does not start with `^`,
the string with `^` compares higher. Otherwise, both caret characters are skipped.
the string with `^` compares lower. Otherwise, both caret characters are skipped.
6. If the remaining part of one of strings starts with `.`:
if the other remaining part does not start with `.`,
the string with `.` compares lower. Otherwise, both dot characters are skipped.
Expand Down Expand Up @@ -119,6 +119,11 @@ Note how in the `1_2_3` > `1.3.3` and `1+2+3` > `1.3.3` cases, the underscore an
separators between components, so we first compare `1` with `1.3.3` as numerical version strings, and
`1` < `1.3.3`. The remainder of the first string is not used in the comparison.

* `122.1` < `123~rc1-1` < `123` < `123-a` < `123-a.1` < `123-1` < `123-1.1` < `123^post1` < `123.a-1` < `123.1-1` < `123a-1` < `124-1`

In the above example each entry compares smaller than every entry to its right and equal only to itself,
conversely each entry compares larger to every entry to its left and compares unequal to all except itself.

## Notes
[systemd-analyze](https://www.freedesktop.org/software/systemd/man/systemd-analyze.html)
implements this version comparison algorithm as
Expand Down

0 comments on commit 5a0799d

Please sign in to comment.