Resolution of the library-path mess
Eric S. Raymond
esr at thyrsus.com
Mon Oct 2 19:30:32 UTC 2017
Hal Murray <hmurray at megapathdsl.net>:
> >> Do we need a way to check that we are using the right library?
>
> >> I think that means we need the version string or time stamp in both the
> >> library and the code that uses the library with a simple sanity check at
> the
> >> top of the uses code.
>
> > It's not normal practice to do this in Python. GPSD never has.
>
> > I think the reason is that when you do have such a mismatch, the Python
> > stack trace it generally produces is likely to be more informative than
> > a version-mismatch message.
>
> Given the confusion we have had in this area, it seemed like a simple and low
> cost way to avoid what might turn into a long chase. Sure, if you get a
> messy backtrace you can probably figure out that you have the wrong library.
> But what if it doesn't crash and just gives the wrong answer?
It is rather unusual to be able to address that effectively with a
version check. I say this as a person who has written more than his
share of service libraries and clients for them.
Yes, in theory one would think this is a common case (error discovered without
API change). But thinking back I can only remember one time *I* ever did this -
that was when I discovered that the error-bounds computation in GPSD had been
slightly wrong for years because of a duplicated variable in a nested loop.
I bumped the library version, sure, but it didn't matter. As with our
Python libraries, libgpsd is never updated separately from its client code.
I deduce that my experience is representative from the fact that Python
library version checks are not routine in other peoples' code. They're
not nonexistent - GTK clients commonly do this - so people do know it
is possible.
So, think through the cases. If a library is always shipped coupled with
its client code, you can't get the kind of skew a version check would
notice. And...how is a third-party client to know when it should bump
the floor to check for?
--
<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>
My work is funded by the Internet Civil Engineering Institute: https://icei.org
Please visit their site and donate: the civilization you save might be your own.
More information about the devel
mailing list