pkgsrc-Bugs archive

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

pkg/56500: gnutls fails to build on Solaris 10 (pkcs11 test)



>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:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Nov 15 13:00:00 +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@localhost>
  */
 
-#define _POSIX_C_SOURCE 200809
+#define _POSIX_C_SOURCE 200112L
 #include <config.h>
 #include <stdio.h>
 #include <string.h>



Home | Main Index | Thread Index | Old Index