[cctbxbb] Module versioning (was Re: Debian Package)

Luc Bourhis luc_j_bourhis at mac.com
Sat Sep 1 14:57:22 PDT 2012


Dear fellow developers,

we may have missed the crux of the matter here. 

Let's say we have a program prg written in C++ that links to a shared library lib.so also written in C++ because it uses a function
	int f(int)
provided by lib.so. Then the code of lib.so changes. Specifically the function interface becomes
	long f(long)
If prg is not built against the new version of lib.so, it will crash as the linker will fail to find "int f(int, int)". Hence the hard stance of Debian on so-versioning.

However, the situation in the cctbx is very different: we have a program prg written in Python that loads a shared library lib.so in which Boost Python magic has manufacture a function
	PyObject *wrapped(PyObject *)
that eventually calls 
	int f(int)	(1)
 after checking that the argument is convertible. Then, again, lib.so is modified as the signature of f becomes
	long f(long)	(2)
and Boost Python emits slightly different a code to check the argument is convertible.
But then the Python program prg won't see the difference at all: any call f(n) that succeeded with (1) will succeed with (2). No crash. Not even an incorrect result.

Since every single shared library built by the cctbx is of that Boost Python kind, with the exception of libboost_python.so, which would not be versioned by us anyway, I am getting seriously doubtful that we need so-versioning at all. I mean if we do not version our pure Python modules then I do not see a reason to version our Boost Python shared libraries which are just a different breed of Python module. The most lethal changes, such as changing the number of arguments of a function, happens in pure Python module as well as in Boost Python modules. In both cases they may lead to crashes at run time (note the may as it will only crash if the flow of the program passes through a call to the function that has changed, contrary to the C++ case above which will crash no matter what) but again why would we single out Boost Python modules? 

Have I missed something?

Best wishes,

Luc



More information about the cctbxbb mailing list