Should I install branch versions of Erlang? Or just the newest patch version?

Hello, this is probably a very obvious and basic question, I just would like to see it specified unambiguously so I don’t have to guess.

I’m doing some research into pinning dependencies across a variety of my Elixir projects (to keep all repos on the same version). I use asdf and I will be specifying the pinned version in a file called .tool-versions in the root project directory of the repo.

I’m trying to figure out whether I should, as a best practice, be pinning a patch version (e.g. 25.3.2) or the branch version (e.g. 25.3.2.10).

Here is a relevant line from the documentation:

In general, versions can have more than three parts. The versions are then only partially ordered. Such versions are only used when branching off from another branch. When an extra part (out of the normal three parts) is added to a version number, a new branch of versions is made. The new branch has a linear order against the base version. However, versions on different branches have no order, and therefore one can only conclude that they all include what is included in their closest common ancestor. When branching multiple times from the same base version, 0 parts are added between the base version and the least significant 1 part until a unique version is found. Versions that have an order can be compared as described in the previous paragraph.

Since the branch versions are not a linear succession of each other (but are only guaranteed to have the specified patch version (e.g. 25.3.2) as a common ancestor), that means that all I’m doing is pinning an unnecessarily-specific bugfix as a dependency, right?

The version 6.0.2.1 will include all changes in 6.0.2. However, 6.0.3 will most likely not include all changes in 6.0.2.1 (note that these versions have no order)

Reading this, I’m totally at a loss. Please tell me what makes more sense: Pin the patch, or pin the branched version?

Thanks

1 Like

The documentation links to the OTP Versions Tree which I find to be very useful when reasoning about which versions inlude what.

The green path is the latest and gratest and the later versions include all fixes in the previous green versions.

The blue paths are the branched of versions of major releases and the latest version in those blue paths contain all fixes of the same blue path and the green path where it was branched out.

The grey paths are special fixes for special problems normally made for a specific user of Erlang and should be ignored by anyone that don’t know that it is made for them specifically.

So from this information I would say that you want to pin the 25.3.2.10 version as it includes 25.3.2 and all fixes in 25.3.2.1-9.

5 Likes

Thanks for the info. I misread the docs and assumed the branches only shared the most recent patch as a common ancestor, but that version tree is very helpful in understanding what’s really going on. (I didn’t notice the little graphical arrows at first.)

1 Like