Is libbsd worth the pain?

Jelmer Vernooij jelmer at samba.org
Fri Feb 3 06:21:09 MST 2012


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 02/03/2012 04:28 AM, Andrew Bartlett wrote:
> Regarding the recently introduced dependency on libbsd, I am wondering
> if optionally depending on another unix portability lib is really worth
> the pain.
(for those reading along, it's not a hard dependency but a soft
dependency.. only used when libbsd is present)
> The issue I have with libbsd is that we gain so little from using it -
> we cannot depend on it strictly existing, so we must provide our own
> replacement functions anyway, and we need extra code to optionally use
> it.
This is true for pretty much everything in libreplace. MD5Init is
apparently part of libc on OpenBSD (and that's why it's in libbsd), so
we would hit issues on OpenBSD anyway (but apparently nobody builds
Samba4 with gdb installed on OpenBSD).

> In any case, we have an issue:
> $ make quicktest
> WAF_MAKE=1 ./buildtools/bin/waf test --quick
> ...
> [3935/3962] symbol duplicate checking:
> Waf: Leaving directory `/data/samba-2/bin'
> Build failed:
> default/source3/lib/netapi/examples/localgroup/localgroup_setinfo:
> Symbol MD5Init linked in multiple libraries ['samba-util',
> '/usr/lib64/libbsd.so.0.2.0']
> make: *** [quicktest] Error 1
>
> Because libbsd also implements MD5Init (et al), we now have a symbol
> conflict. (Other projects which implement MD5Init internally may not
> have noticed this, as our symbol checking is a samba-only thing).
>
> A partial patch to fix the MD5 issue is attached, but the configure
> check to find bsd/md5.h needs to be written, and the result all tested
> to ensure that we never use the wrong md5.h.
>
> All this leads me to the question:
>
> That we can then have an empty libreplace is neat, but I wonder if it is
> really worth it to avoid having a local copy of strlcat and strlcpy?
The alternative is that I ship it as a patch for Debian/Ubuntu (I don't
really want to ship a libreplace0 package with just two trivial
functions in it), but that just moves the problem and means I have to
deal with conflicts further down the line.

I agree there is some sort of cost/benefit balance here. If we hit too
many issues I'm happy to talk about dropping this optional dependency.
The MD5Init name clash seems like a genuine issue though.

Cheers,

Jelmer
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJPK99FAAoJEACAbyvXKaRX7MwP/33JON9s3YWcDREMhFkWQT31
Hmbtp9a3JTDh+1DUE3K8ElgkvSumUSVPRel+vCgSR4D8wytK3kzVhF5JLPhmKuT+
9V6EzTccZiN3T8S8rN32b9U9MNRkMzdiVWHEBc+SdBLH+CYC8CUHH8caeHnVxvGi
WiXaGSZmTXhdl7ColK30VGRJSgdCeuA8JGEEriAYhqN+hT98tyIE39Mr7EpGuoeW
qRG+z2TR/MYuvZ3k0UbxUzTDGLhuZVU4dU2fEPqF//KMmIc9eGZpVfRnlr9vmtDh
yN/pv5OQOzW+R+5CncnUCu6K0A/WgcN/AcWi9qdo+5RIvomhrnFiYjCFFyaU95L2
sQ3ogAf0EMmZiJvAvYHTNNPSWi32sbC2KDUt3ojC+Jik80fMUMOguhCu7XNysGEn
+OiQNkBG1Kzgi58B36BN0SfMQkU91GcP9NhJ1ddPOOrnvKK7iv/RE+oOHhUYLajh
IwlYU3A9oLn/+7P6PTLVlP1TDbcE683GSpzDxRVDx2UsKS+Ovk/ZCKMCvH18Lxh+
LijSg5yF5ZnEwgXu69p4vrzpkhnav35ezn0GUqppmhBV+b4ONoJFJDXBiXUPRMKA
mXxPwLLthyKURSpiFqS9o+2Q1jQprboJaSQkNl4UFV+Q8Mj3ZqR3kPSV3gH814BQ
GMup9rWYuw+S5V3CwO18
=VbFa
-----END PGP SIGNATURE-----



More information about the samba-technical mailing list