NetBSD Problem Report #56500
From www@netbsd.org Mon Nov 15 12:55:40 2021
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 292A41A9239
for <gnats-bugs@gnats.NetBSD.org>; Mon, 15 Nov 2021 12:55:40 +0000 (UTC)
Message-Id: <20211115125538.855A71A923A@mollari.NetBSD.org>
Date: Mon, 15 Nov 2021 12:55:38 +0000 (UTC)
From: pekdon@gmail.com
Reply-To: pekdon@gmail.com
To: gnats-bugs@NetBSD.org
Subject: gnutls fails to build on Solaris 10 (pkcs11 test)
X-Send-Pr-Version: www-1.0
>Number: 56500
>Category: pkg
>Synopsis: gnutls fails to build on Solaris 10 (pkcs11 test)
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: pkg-manager
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Nov 15 13:00:00 +0000 2021
>Closed-Date: Sun Dec 26 23:11:55 +0000 2021
>Last-Modified: Sun Dec 26 23:20:01 +0000 2021
>Originator: Claes Nästén
>Release: trunk 2021-11-02
>Organization:
>Environment:
SunOS 5.10 sun4u sparc SUNW,Sun-Blade-1500
>Description:
Compiling security/gnutls using GCC 8.4.0 on Solaris 10 fails during the compilation of tests due two 2 things:
* Missing strndup (not compiled using gnulib)
* Compiler error due to recent _POSIX_C_SOURCE
There is an upstream issue for this:
https://gitlab.com/gnutls/gnutls/-/issues/1109
I did not fix the build to use gnulib strndup and instead just replaced the single call to strndup with inline code that should do the same hoping for an upstream fix of the build.
>How-To-Repeat:
Build security/gnutls
>Fix:
$NetBSD$
--- tests/pkcs11/pkcs11-mock.c.orig 2021-11-15 07:29:10.338541000 +0000
+++ tests/pkcs11/pkcs11-mock.c
@@ -1213,8 +1213,16 @@ CK_DEFINE_FUNCTION(CK_RV, C_FindObjectsI
if (CKA_LABEL == pTemplate[i].type)
{
+ char *end;
+ size_t n = pTemplate[i].ulValueLen;
free(mock_session->find_label);
- mock_session->find_label = strndup(pTemplate[i].pValue, pTemplate[i].ulValueLen);
+ end = memchr(pTemplate[i].pValue, '\0', n);
+ if (end != NULL) {
+ n = end - (char*) pTemplate[i].pValue;
+ }
+ mock_session->find_label = malloc(n + 1);
+ memcpy(mock_session->find_label, pTemplate[i].pValue, n);
+ mock_session->find_label[n] = '\0';
}
else if (CKA_CLASS == pTemplate[i].type)
{
--- tests/pkcs11/pkcs11-mock.h.orig 2021-11-15 08:28:55.694344000 +0000
+++ tests/pkcs11/pkcs11-mock.h
@@ -19,7 +19,7 @@
* Jaroslav IMRICH <jimrich@jimrich.sk>
*/
-#define _POSIX_C_SOURCE 200809
+#define _POSIX_C_SOURCE 200112L
#include <config.h>
#include <stdio.h>
#include <string.h>
>Release-Note:
>Audit-Trail:
From: nia <nia@NetBSD.org>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: pkg/56500: gnutls fails to build on Solaris 10 (pkcs11 test)
Date: Mon, 15 Nov 2021 13:08:14 +0000
On Mon, Nov 15, 2021 at 01:00:00PM +0000, pekdon@gmail.com wrote:
> I did not fix the build to use gnulib strndup and instead just replaced the single call to strndup with inline code that should do the same hoping for an upstream fix of the build.
In pkgsrc you can use USE_FEATURES to add strndup from libnbcompat.
Another option is to disable the tests if OPSYS is SunOS and
OPSYS_VERSION is 5.10.
I'd rather do either of these.
From: =?utf-8?q?Claes_N=C3=A4st=C3=A9n?= <pekdon@gmail.com>
To: gnats-bugs <gnats-bugs@netbsd.org>
Cc:
Subject: Re: pkg/56500: gnutls fails to build on Solaris 10 (pkcs11 test)
Date: Mon, 15 Nov 2021 14:14:22 +0100
Excerpts from nia's message of 2021-11-15 13:10:03 +0000:
> The following reply was made to PR pkg/56500; it has been noted by GNATS.
>
> From: nia <nia@NetBSD.org>
> To: gnats-bugs@netbsd.org
> Cc:
> Subject: Re: pkg/56500: gnutls fails to build on Solaris 10 (pkcs11 test)
> Date: Mon, 15 Nov 2021 13:08:14 +0000
>
> On Mon, Nov 15, 2021 at 01:00:00PM +0000, pekdon@gmail.com wrote:
> > I did not fix the build to use gnulib strndup and instead just replaced the single call to strndup with inline code that should do the same hoping for an upstream fix of the build.
>
> In pkgsrc you can use USE_FEATURES to add strndup from libnbcompat.
>
> Another option is to disable the tests if OPSYS is SunOS and
> OPSYS_VERSION is 5.10.
>
> I'd rather do either of these.
>
I've had varying degrees of success using USE_FEATURES to add missing
functions myself, might just be me.
But then, for now, I guess disabling tests on SunOS 5.10 should do the
trick and if upstream fixes that issue at some point they could be
re-enabled.
From: =?utf-8?q?Claes_N=C3=A4st=C3=A9n?= <pekdon@gmail.com>
To: gnats-bugs <gnats-bugs@netbsd.org>
Cc:
Subject: Re: pkg/56500: gnutls fails to build on Solaris 10 (pkcs11 test)
Date: Wed, 22 Dec 2021 17:13:43 +0000
To disable tests on Solaris < 5.11 I did this locally:
diff --git a/security/gnutls/Makefile b/security/gnutls/Makefile
index a853dfe42b2..aa995dffb9f 100644
--- a/security/gnutls/Makefile
+++ b/security/gnutls/Makefile
@@ -91,6 +91,11 @@ CONFIGURE_ARGS+= --disable-hardware-acceleration
. endif
.endif
+# tests fails on missing strndup for Solaris < 5.11, disable
+.if ${OPSYS} == "SunOS" && ${OS_VARIANT} == "Solaris" && ${OS_VERSION} != "5.11"
+CONFIGURE_ARGS.SunOS+= --disable-tests
+.endif
+
post-install:
cd ${WRKSRC}/doc/examples && ${INSTALL_DATA} *.c ${DESTDIR}${EGDIR}
--
Claes Nästén
From: Jonathan Perkin <jperkin@joyent.com>
To: gnats-bugs@netbsd.org
Cc: pkg-manager@netbsd.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org,
pekdon@gmail.com
Subject: Re: pkg/56500: gnutls fails to build on Solaris 10 (pkcs11 test)
Date: Thu, 23 Dec 2021 13:16:00 +0000
* On 2021-12-22 at 17:15 GMT, Claes Nästén wrote:
> +# tests fails on missing strndup for Solaris < 5.11, disable
> +.if ${OPSYS} == "SunOS" && ${OS_VARIANT} == "Solaris" && ${OS_VERSION} != "5.11"
> +CONFIGURE_ARGS.SunOS+= --disable-tests
> +.endif
A few improvements:
* The OPSYS test here is superfluous as CONFIGURE_ARGS is already
using OPSYSVARS to limit its setting to SunOS.
* The OS_VARIANT test is superfluous as there are only Solaris releases
for 5.10 or older, illumos and its distributions are for 5.11 only.
* The OS_VERSION test can be improved by using OPSYS_VERSION which I
recently introduced.
So I'd write it like this:
.if ${OPSYS_VERSION} < 051100
CONFIGURE_ARGS.SunOS+= --disable-tests
.endif
Hope that's helpful,
--
Jonathan Perkin - Joyent, Inc. - www.joyent.com
From: =?utf-8?q?Claes_N=C3=A4st=C3=A9n?= <pekdon@gmail.com>
To: gnats-bugs <gnats-bugs@netbsd.org>
Cc:
Subject: Re: pkg/56500: gnutls fails to build on Solaris 10 (pkcs11 test)
Date: Fri, 24 Dec 2021 08:00:04 +0000
Excerpts from Jonathan Perkin's message of 2021-12-23 13:20:01 +0000:
>
> * The OS_VERSION test can be improved by using OPSYS_VERSION which I
> recently introduced.
>
> So I'd write it like this:
>
> .if ${OPSYS_VERSION} < 051100
> CONFIGURE_ARGS.SunOS+= --disable-tests
> .endif
>
> Hope that's helpful,
>
Helpful indeed, OPSYS_VERSION is a nice addition.
Verified that your short version works just fine too, would be nice to have
it added and then close this issue?
--
Claes Nästén
State-Changed-From-To: open->closed
State-Changed-By: gutteridge@NetBSD.org
State-Changed-When: Sun, 26 Dec 2021 23:11:55 +0000
State-Changed-Why:
Patch applied, thanks. (I feel OS_VERSION should only be evaluated for SunOS.)
From: "David H. Gutteridge" <gutteridge@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/56500 CVS commit: pkgsrc/security/gnutls
Date: Sun, 26 Dec 2021 23:03:54 +0000
Module Name: pkgsrc
Committed By: gutteridge
Date: Sun Dec 26 23:03:54 UTC 2021
Modified Files:
pkgsrc/security/gnutls: Makefile
Log Message:
gnutls: fix builds on Solaris 10
Addresses PR pkg/56500 from Claes Nästén.
To generate a diff of this commit:
cvs rdiff -u -r1.224 -r1.225 pkgsrc/security/gnutls/Makefile
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.