On Mon, 2021-09-27 at 19:09 +0200, Svante Signell wrote:
> Hello Andreas
> 
> Just for your info. I’m AFK for another week so i cannot test anything until
> then. However, some comments are inlined below.

I'm back and have now tested again on Linux, Hurd and kFreeBSD.

> > > The patch debian_control.diff adds a build dependency of
> > > libbsd0 for kFreeBSD and Hurd. 
> > 
> > That should be libbsd-dev instead of libbsd0, shouldn't it?
> > 
> Reasonably it should be, yes.

Now depending on libbsd-dev, see debian_control.diff. See also configure.ac.diff
(same as before) and an updated common_unix-peer.c.diff.

> > > Note that with the attached patches the patch,
> > > 41_kfreebsd_LOCAL_PEERCRED.diff, for kFreeBSD is no longer needed.
> > > The patches have been used to successfully build p11-kit on Linux,
> > > Hurd and kFreeBSD.
> > 
> > Afaict it does not change buildability on kFreeBSD though, should it?
> > 
> > ERROR: test-managed
> > ===================
> > 
> > ./build/litter/tap-driver.sh: line 145: 90190 Illegal instruction     "$@"
> > ERROR: test-managed - missing test plan
> > 
> > (Tested on on lemon.debian.net)
> > 
> I did not build in a chroot, i used an uptodate (sid) qemu image of k-a.
> Kernel 11.0.

This failing test confused me a long time, as it did build fine on a not yet
fully updated kfreebsd-amd64 image. The problem is libffi8 and libffi-dev:
3.4.2-2 in combination with autoconf 2.71-2. Downgrading to 3.3-6 the package
builds fine.

This problem is probably the same as 
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=995223 where it causes SIGILL
problems for powerpc and ppc64 in connection with autoconf 2.71-2.

Especially suspicious build log entries of libffi8  (3.4.2-2):
configure.ac:8: warning: The macro `AC_CANONICAL_SYSTEM' is obsolete.
configure.ac:41: warning: The macro `AC_PROG_LIBTOOL' is obsolete.
configure.ac:74: warning: The macro `AC_TRY_COMPILE' is obsolete.
configure.ac:91: warning: The macro `AC_HEADER_STDC' is obsolete.
configure.ac:122: warning: The macro `AC_TRY_LINK' is obsolete.
configure.ac:310: warning: The macro `AC_HELP_STRING' is obsolete.
configure.ac:310: warning: The macro `AC_HELP_STRING' is obsolete.
configure.ac:418: warning: The macro `AC_PROG_LD' is obsolete.
configure.ac:418: warning: The macro `AC_TRY_RUN' is obsolete.

The build of 3.4.2-1 did not show the above warnings with autoconf 2.69-14.

Index: p11-kit-0.24.0-2.3/common/unix-peer.c
===================================================================
--- p11-kit-0.24.0-2.3.orig/common/unix-peer.c
+++ p11-kit-0.24.0-2.3/common/unix-peer.c
@@ -36,7 +36,6 @@
 
 #include "unix-peer.h"
 
-#include <unistd.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/un.h>
@@ -47,6 +46,13 @@
 #  include <ucred.h>
 #endif
 
+#ifdef HAVE_GETPEEREID
+/* Declare getpeereid() */
+#include <bsd/unistd.h>
+#else
+#include <unistd.h>
+#endif
+
 /* Returns the unix domain socket peer information.
  * Returns zero on success.
  */
@@ -73,7 +79,8 @@ p11_get_upeer_id (int cfd, uid_t *uid, u
 		*pid = cr.pid;
 
 #elif defined(HAVE_GETPEEREID)
-	/* *BSD/MacOSX */
+	/* *BSD/MacOSX/kFreeBSD/Hurd */
+
 	uid_t euid;
 	gid_t egid;
 
Index: p11-kit-0.24.0-2.3/configure.ac
===================================================================
--- p11-kit-0.24.0-2.3.orig/configure.ac
+++ p11-kit-0.24.0-2.3/configure.ac
@@ -132,6 +132,16 @@ if test "$os_unix" = "yes"; then
 	AC_CHECK_FUNCS([getpeereid])
 	AC_CHECK_FUNCS([getpeerucred])
 	AC_CHECK_FUNCS([issetugid])
+	case "$host_os" in
+	kfreebsd*-gnu | gnu*)
+		have_getpeereid=no
+		AC_CHECK_LIB(bsd, getpeereid, have_getpeereid=yes)
+		if test "x$have_getpeereid" = "xyes"; then
+			AC_DEFINE([HAVE_GETPEEREID], [1], [have getpeereid])
+			AC_SEARCH_LIBS([getpeereid], [bsd])
+		fi
+	;;
+	esac
 
 	AC_CACHE_CHECK([for thread-local storage class],
 		[ac_cv_tls_keyword],
--- a/debian/control	2021-06-20 14:49:24.000000000 +0200
+++ b/debian/control	2021-10-04 17:44:48.000000000 +0200
@@ -7,7 +7,8 @@
  gtk-doc-tools,
  libffi-dev,
  libtasn1-6-dev,
- pkg-config
+ pkg-config,
+ libbsd-dev [kfreebsd-any hurd-any]
 Standards-Version: 4.5.1
 Rules-Requires-Root: no
 Section: libs

Reply via email to