On Thu, Mar 26, 2020 at 04:35:29PM -0500, Eric Blake wrote:
Should the test-public binary still be compiled from direct files
under lib/, or should it be linked against libnbdkit.so?
I will fix this in my copy.
I'm wondering if we want to add some sort of
'assert(is_initialized)' to all of our public entry functions to
ensure that no one is actually trying to use libnbdkit.so without
having first gone through nbdkit_private_init;[...]
So firstly I believe this can only be a problem if the server itself
uses __attribute__((constructor)), since plugins and filters are
always dlopened long after main() in the server has run. Is that
correct?
The only ((constructor)) currently used is in the OCaml plugin.
If the server does use a constructor and calls (eg) nbdkit_debug it
would indeed crash. However constructors would likely crash in the
pre-change nbdkit because nothing in the server is initialized
properly until main() is running.
Is it worth checking for this still, given it would have an overhead?
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html