dbus-daemon statically linked with libdbus-1?

Daniel P. Berrange dan at berrange.com
Wed Jun 4 12:29:45 PDT 2014

On Wed, Jun 04, 2014 at 12:23:13PM -0700, Colin Walters wrote:
> > 1) make sure that the daemon can start even if you messed up your
> > libraries. 
> > If the system bus can't start, then your system is pretty much hosed.
> If your OS is using systemd there's already a huge amount of dynamic
> linking going
> on before dbus even starts.
> > This 
> > also allows for systems to ship just dbus-daemon and no library if they
> > have 
> > other non-libdus-1 bindings (like gdbus).
> Hmm, like if for your OS you want to whitelist the libraries exposed
> to applications or something, and so even if dbus-daemon uses
> libdbus-1 you'd want to hide it?  I think this type of thing is better
> solved by having distinct filesystem trees for apps (hardlinked or so)
> than static linking.
> > 2) the daemon uses the private API from libdbus-1, which is not exported.
> > It's 
> > simply not possible to link the daemon to the standard library.
> This however is quite a valid reason it's statically linked right now =)
> Alternatives though:
> 1) Split out a the private bits into /usr/lib64/dbus-1/dbus-private.so
> 2) Have the shared library export a single dbus__private() API which
> returns
>   a structure of function pointers. Like:
> https://git.gnome.org/browse/glib/commit/?id=9bf59d4a14b3fc4bb62f10c3665e99f9d8788bdc

3) Use symbol versioning and export the private functions with
   a versioned symbol postfix. eg dbus_foo at DBUS_PRIVATE_X.Y.Z.
   Makes it pretty clear to apps developers that they shouldn't
   use that symbol, and ensures that you must have a matching
   version of dbus-daemon + libdbus.so. To make it extra clever
   you could make use of a random hash generated at build time
   instead of version number, so you can only ever use exact
   matched dbus-daemon + libdbus.so from the same build
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

More information about the dbus mailing list