Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 512510

Summary: =net-fs/samba-4.1.8 automagical dependency on sys-apps/systemd
Product: Gentoo Linux Reporter: Eugene Shalygin <eugene.shalygin>
Component: Current packagesAssignee: Gentoo's SAMBA Team <samba>
Status: RESOLVED FIXED    
Severity: normal CC: systemd
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://bugzilla.samba.org/show_bug.cgi?id=10672
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 489762    
Attachments: Patch against samba-4.1.8.ebuild to honor systemd use flag
Fix systemd vs systemd-daemon library check

Description Eugene Shalygin 2014-06-05 12:34:42 UTC
if samba configure script finds installed systemd, it tries to link against it. With the ebuild that is in three right now, compilation fails: it uses  sd_notify() from libsystemd.so. 

Reproducible: Always

Steps to Reproduce:
1. emerge -1 systemd
2. emerge -1 =net-fs/samba-4.1.8
Comment 1 Tom Wijsman (TomWij) (RETIRED) gentoo-dev 2014-06-05 13:00:02 UTC
(wscript:191)
>   if conf.CONFIG_SET('HAVE_SYSTEMD_SD_DAEMON_H'):
>        conf.DEFINE('HAVE_SYSTEMD', '1')
>        conf.env['ENABLE_SYSTEMD'] = True

There are --with{,out}-systemd flags; but, the above check ignores that.
Comment 2 Maxim Prokhorov 2014-06-09 18:36:25 UTC
waf script from git checks for missing library
"https://git.samba.org/?p=samba.git;a=blob;f=wscript;h=cf4e93b1c07c5cf9474c5cbddefc43b9db517383;hb=HEAD#l201"
(wscript: 207)
>    if (conf.CONFIG_SET('HAVE_SYSTEMD_SD_DAEMON_H') and
>        conf.CONFIG_SET('HAVE_LIBSYSTEMD_DAEMON')):
>        conf.DEFINE('HAVE_SYSTEMD', '1')
>        conf.env['ENABLE_SYSTEMD'] = True

But another problem is
(wscript: 205)
>    conf.CHECK_LIB('systemd-daemon', shlib=True)
will not work with most recent gentoo's systemd-213 because there are no longer any 'libsystemd-daemon'. pkg-config files provided with systemd map 'libsystemd-daemon' to the new 'libsystemd', but wscript doesn't use library name discovered with it (check_cfg function)

Still works for earlier versions though
systemd-208 - library is still there
systemd-212 - ebuild manually sets compatibility symlinks
Comment 3 Martin Cyr 2014-06-20 17:08:11 UTC
Created attachment 379326 [details, diff]
Patch against samba-4.1.8.ebuild to honor systemd use flag

Shouldn't the ebuild also honor the systemd use flag?

It doesn't fix the samba/waf/systemd-daemon issue, but builds cleanly.
On systems using OpenRC, it seems like a reasonable option.
Comment 4 Tony Murray 2014-06-24 16:45:04 UTC
Reported upstream: https://bugzilla.samba.org/show_bug.cgi?id=10672

But we should probably apply the patch for users that have systemd installed, but are using OpenRC.
Comment 5 Martin Cyr 2014-07-16 19:13:09 UTC
Created attachment 380842 [details, diff]
Fix systemd vs systemd-daemon library check

Adaptation of Tony Murray's patch for samba-4.1.9.
Comment 6 Tony Murray 2014-10-17 16:14:14 UTC
FYI, it shouldn't matter about the systemd use flag.
If the systemd library is present, it will link against it.  The library was designed to be init agnostic. The resulting build function on openrc or systemd init, but get extra fanciness on systemd.
Comment 7 Mike Gilbert gentoo-dev 2014-10-17 16:16:25 UTC
(In reply to Tony Murray from comment #6)
> FYI, it shouldn't matter about the systemd use flag.
> If the systemd library is present, it will link against it.

What if I build a binpkg and install it on a system without systemd?

It either needs a hard-dep, or a use-conditional dep, and it must be disabled if the use flag is not enabled.
Comment 8 Mike Gilbert gentoo-dev 2014-10-17 16:27:58 UTC
Also, you might want to point out that upstream systemd no longer installs libsystemd-daemon.pc; that's a Gentoo-specifc hack we created to prevent mass breakage. Only libsystemd.pc is installed by default.

I tried adding a comment on the upstream bug, but I don't have an account and I haven't gotten my account creation email yet.
Comment 9 Richard Freeman gentoo-dev 2014-10-17 17:12:10 UTC
(In reply to Mike Gilbert from comment #7)
> (In reply to Tony Murray from comment #6)
> > FYI, it shouldn't matter about the systemd use flag.
> > If the systemd library is present, it will link against it.
> 
> What if I build a binpkg and install it on a system without systemd?
> 
> It either needs a hard-dep, or a use-conditional dep, and it must be
> disabled if the use flag is not enabled.

++

That is just Gentoo policy.  Obviously getting there can take some work/time/etc, and lots of packages have these kinds of problems.  It is still a valid bug when we discover them.  

Anything that gets linked is a dependency (ideally a slot operator dep).  If the linkage can be made conditional (ie USE flag), then the dependency can be made conditional.  I imagine we don't want a hard-dep on systemd for samba, so the USE flag is the way to go.

By all means try to get upstream to go along.
Comment 10 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2015-01-03 17:28:25 UTC
+  03 Jan 2015; Michał Górny <mgorny@gentoo.org> samba-4.1.14.ebuild:
+  Make systemd library support optional, bug #512510.

I'll fix the systemd support itself in the next commit ;).