Subsurface deco calculations

Linus Torvalds torvalds at
Sat Feb 4 10:31:42 PST 2017

On Sat, Feb 4, 2017 at 4:07 AM, Anton Lundin <glance at> wrote:
> Linus did change the gasmix / gaschange code not to long ago, there
> might be a bug there.
> Verify that your libdivecomputer and subsurface code are in sync, there
> where some incompabilities around that code from what I remembered.

Well, the incompatibilities should eb fixed as long as you upgraded
libdivecomputer and subsurface in sync. And honestly, if you don't, at
worst I think you'd just see doubled-up cylinder change events. So it
shouldn't cause the problems Miika sees.

But quite aside from the incompatibility, the big change was that
upstream libdivecomputer got rid of the deprecated events entirely,
and we now use the DC_SAMPLE_GASMIX sample data instead.

And the DC_SAMPLE_GASMIX data has obviously never been tested before.
In particular, the 'gasmix' data is *supposed to be zero-based (ie in
the range 0..ngasmixes-1), but I could easily see that some
libdivecomputer backend would end up using a 1-based index (ie

Before, we just got the gas mix itself, not the cylinder number, and
we then figured it out from that. That sucked in other ways (ie
multiple cylinders with the same gas were ambiguous), but it was less
likely to have _this_ particular problem.

The OSTC parser seems to be correctly zero-based, though, both for the
initial index (which is a special case) and for the other ones.

Miika, can you do a re-download of that dive just from the OSTC into
an empty xml file, just to see whether the index comes from the actual
download, or from some merging issue?


More information about the subsurface mailing list