Using new Ver 4.5 cloud storage with multiple users

Dirk Hohndel dirk at hohndel.org
Wed Sep 16 10:44:55 PDT 2015


OK, let's move this from the User forum to the developer mailing list.

On Wed, Sep 16, 2015 at 10:37:46AM -0700, Linus Torvalds wrote:
> On Wed, Sep 16, 2015 at 10:23 AM, Dirk Hohndel <dirk at hohndel.org> wrote:
> >>
> >> However, more than that, we used to support the concept of giving dive
> >> computers "nicknames" based on that serial number exactly because
> >> we've been in the situation with Dirk that we have identical dive
> >> computers that we've passed back and forth (so I could see that the
> >> Uemis I was diving was "Dirk's Uemis"). I haven't used that in a
> >> while, though, and it was always fairly esoteric, so maybe the support
> >> for that has bit-rotted.
> >
> > I tested it recently and it still worked.
> 
> So I'm pretty certain there are situations where it screws up. In
> particular, I think "addDC()" ends up throwing away old nicknames and
> serial numbers if you load a new entry that doesn't have them.
> 
> We *used* to have the concept of a "struct device_info" that you could
> look up and create, and then update that to edit nicknames etc. But
> that went away, and now it's that "addDC()" thing - it's a simpler
> interface, but it's also fundamentally somewhat limited.
> 
> See commit 29b242c70349 ("Converting the device_info list into a Qt
> data structure") and in particular parse-xml.c and libdivecomputer.c.
> Notice how they went from "look up or create device, and then fill it
> in with more information if we have it" to "create device with the
> information we have".
> 
> And see how the "create the device with the information we have" will
> actually throw away the old device information, and replace it with
> the new one - even if the new one has less information.

Um, no, that's not what we should do.

> Now, imagine that you download from a dive computer - which obviously
> doesn't know about the nickname we gave it. It does a
> create_device_node() with an empty nickname. What happens to our old
> knowledge of nicknames?
> 
> I know it used to work, because I used it back when. And maybe it
> still does. But just looking at the code I suspect it no longer works.
> But it's possible I missed something.

I'll need to play with this but it seems you are right, this got broken.
Darn it. Lack of automated testing. Lack of solid, consistent, reliable
code review.

I'll add this to my todo list. Instead of investigating fun new features.

Thanks for pointing this out, Linus.

/D


More information about the subsurface mailing list