[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#883972: samba: FTBFS on kfreebsd: error: storage size of 'cr' isn't known

Hi, guys!

I've discussed https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=215202 issue with the iXsystems FreeBSD src committers, they are going to look into that. But even if that(or similar) fix will go into upstream it won't happen very soon. FreeBSD has longer release cycles than Linux, so meanwhile we need to find the workaround.

The relevant part of the failing code should use 'struct xucread' on FreeBSD and 'LOCAL_PEERCRED' option to the getsockopt(2), but as it is already mentioned in the bug report that won't provide you the PID of the remote peer.

I wonder, would it be possible to replace getsockopt(2) here with the sendmsg()/recvmsg() and 'SCM_CREDS' type of message, like described here, for ex:


This seems be less Linux-specific way of obtaining remote peer PID.

With regards,
Timur Bakeyev.

On Sun, Dec 10, 2017 at 2:47 AM, Andrew Bartlett <abartlet@samba.org> wrote:
On Sat, 2017-12-09 at 23:04 +0100, Andreas Beckmann wrote:
> Source: samba
> Version: 2:4.7.3+dfsg-1
> Severity: important
> User: debian-bsd@lists.debian.org
> Usertags: kfreebsd
> Hi,
> that 4.7.x uploads of samba FTBFS on kfreebsd:

> [2706/4004] Compiling ctdb/tests/src/ipalloc_read_known_ips.c
> 08:44:02 runner /usr/bin/gcc -g -O2 -fdebug-prefix-map=/«BUILDDIR»/samba-4.7.3+dfsg=. -fstack-protector-strong -Wformat -Werror=format-security -fPIE -fPIC -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DCTDB_HELPER_BINDIR="/usr/lib/x86_64-kfreebsd-gnu/ctdb" -DLOGDIR="/var/log/ctdb" -DCTDB_ETCDIR="/etc/ctdb" -DCTDB_VARDIR="/var/lib/ctdb" -DCTDB_RUNDIR="/var/run/ctdb" -fstack-protector -DSTATIC_fake_ctdbd_MODULES=NULL -DSTATIC_fake_ctdbd_MODULES_PROTO=extern void __fake_ctdbd_dummy_module_proto(void) -MD -Wdate-time -D_FORTIFY_SOURCE=2 -Idefault/ctdb -I../ctdb -Idefault/include/public -I../include/public -Idefault/source4 -I../source4 -Idefault/lib -I../lib -Idefault/source4/lib -I../source4/lib -Idefault/source4/include -I../source4/include -Idefault/include -I../include -Idefault/lib/replace -I../lib/replace -Idefault/ctdb/include -I../ctdb/include -Idefault -I.. -Idefault/lib/util/charset -I../lib/util/charset -Idefault/libcli/util -I../libcli/util -Idefault/lib/crypto -I../lib/crypto -Idefault/lib/async_req -I../lib/async_req -Idefault/dynconfig -I../dynconfig -I/usr/local/include -D_SAMBA_BUILD_=4 -DHAVE_CONFIG_H=1 -D_GNU_SOURCE=1 -D_XOPEN_SOURCE_EXTENDED=1 ../ctdb/tests/src/ipalloc_read_known_ips.c -c -o default/ctdb/tests/src/ipalloc_read_known_ips_134.o
> ../ctdb/tests/src/fake_ctdbd.c: In function 'client_send':
> ../ctdb/tests/src/fake_ctdbd.c:3081:15: error: storage size of 'cr' isn't known
>   struct ucred cr;
>                ^~
> ../ctdb/tests/src/fake_ctdbd.c:3082:25: error: invalid application of 'sizeof' to incomplete type 'struct ucred'
>   socklen_t crl = sizeof(struct ucred);
>                          ^~~~~~
> ../ctdb/tests/src/fake_ctdbd.c:3095:35: error: 'SO_PEERCRED' undeclared (first use in this function); did you mean 'SO_PEERLABEL'?
>   ret = getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &cr, &crl);
>                                    ^~~~~~~~~~~
>                                    SO_PEERLABEL
> ../ctdb/tests/src/fake_ctdbd.c:3095:35: note: each undeclared identifier is reported only once for each function it appears in
> [2707/4004] Compiling lib/pthreadpool/tests.c
> 08:44:02 runner /usr/bin/gcc -g -O2 -fdebug-prefix-map=/«BUILDDIR»/samba-4.7.3+dfsg=. -fstack-protector-strong -Wformat -Werror=format-security -fPIE -fPIC -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DCTDB_HELPER_BINDIR="/usr/lib/x86_64-kfreebsd-gnu/ctdb" -DLOGDIR="/var/log/ctdb" -DCTDB_ETCDIR="/etc/ctdb" -DCTDB_VARDIR="/var/lib/ctdb" -DCTDB_RUNDIR="/var/run/ctdb" -fstack-protector -DSTATIC_pthreadpooltest_MODULES=NULL -DSTATIC_pthreadpooltest_MODULES_PROTO=extern void __pthreadpooltest_dummy_module_proto(void) -MD -Wdate-time -D_FORTIFY_SOURCE=2 -Idefault/lib/pthreadpool -I../lib/pthreadpool -Idefault/include/public -I../include/public -Idefault/source4 -I../source4 -Idefault/lib -I../lib -Idefault/source4/lib -I../source4/lib -Idefault/source4/include -I../source4/include -Idefault/include -I../include -Idefault/lib/replace -I../lib/replace -Idefault/ctdb/include -I../ctdb/include -Idefault/ctdb -I../ctdb -Idefault -I.. -Idefault/libcli/util -I../libcli/util -I/usr/local/include -D_SAMBA_BUILD_=4 -DHAVE_CONFIG_H=1 -D_GNU_SOURCE=1 -D_XOPEN_SOURCE_EXTENDED=1 ../lib/pthreadpool/tests.c -c -o default/lib/pthreadpool/tests_2.o
> Waf: Leaving directory `/«BUILDDIR»/samba-4.7.3+dfsg/bin'
> Build failed:  -> task failed (err #1):
>       {task: cc fake_ctdbd.c -> fake_ctdbd_134.o}
> debian/rules:102: recipe for target 'override_dh_auto_build' failed
> make[1]: *** [override_dh_auto_build] Error 1

This was introduced in the fix for

Can you please take up the regression upstream?  There is interest in
fixing FreeBSD, talk to Timur I. Bakeyev (CC'ed) in particular.  

(There is very strong preference to not carry Debian-specific patches
unless they are already upstream.)

Lastly however, it looks like what is desired here is simply not


You may wish to disabled building CTDB on kfreebsd or find a way not to
build the tests.


Andrew Bartlett

Andrew Bartlett                       http://samba.org/~abartlet/
Authentication Developer, Samba Team  http://samba.org
Samba Developer, Catalyst IT          http://catalyst.net.nz/services/samba

Reply to: