GNU bug report logs

#78176 [PATCH] gnu: cyrus-sasl: Fix time.h check

PackageSource(s)Maintainer(s)
guix-patches PTS Buildd Popcon
Reply or subscribe to this bug. View this bug as an mbox, status mbox, or maintainer mbox

Report forwarded to guix-patches@gnu.org:
bug#78176; Package guix-patches. (Thu, 01 May 2025 06:21:02 GMT) (full text, mbox, link).


Acknowledgement sent to aragaer <aragaer@gmail.com>:
New bug report received and forwarded. Copy sent to guix-patches@gnu.org. (Thu, 01 May 2025 06:21:02 GMT) (full text, mbox, link).


Message #5 received at submit@debbugs.gnu.org (full text, mbox, reply):

From: aragaer <aragaer@gmail.com>
To: guix-patches@gnu.org
Cc: aragaer <aragaer@gmail.com>
Subject: [PATCH] gnu: cyrus-sasl: Fix time.h check
Date: Wed, 30 Apr 2025 17:35:43 +0300
The code conditionally includes <time.h> in some places but configure script
never checks for time.h, so it is never included. This works most of the time
but fails when doing cross compilation.

The patch was submitted to cyrus-sasl repository shortly after the 2.1.28
release (https://github.com/cyrusimap/cyrus-sasl/commit/266f0acf7f5e029afbb3e263437039e50cd6c262).

The package itself is a dependency for over 2000 other packages, but the
change only affects the build process. It should not break anything, only fix
an existing build failure.

Change-Id: I46e3801d50758f79df0447dd3bd483b427277e12
---
 gnu/local.mk                                  |  1 +
 gnu/packages/cyrus-sasl.scm                   | 47 +++++++++------
 .../patches/cyrus-sasl-fix-time-h.patch       | 57 +++++++++++++++++++
 3 files changed, 88 insertions(+), 17 deletions(-)
 create mode 100644 gnu/packages/patches/cyrus-sasl-fix-time-h.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 3efe47fe17..b59315368b 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1163,6 +1163,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/curlftpfs-fix-no_verify_hostname.patch	\
   %D%/packages/patches/cursynth-wave-rand.patch			\
   %D%/packages/patches/cvs-CVE-2017-12836.patch		\
+  %D%/packages/patches/cyrus-sasl-fix-time-h.patch		\
   %D%/packages/patches/d-feet-drop-unused-meson-argument.patch	\
   %D%/packages/patches/dante-non-darwin.patch			\
   %D%/packages/patches/date-ignore-zonenow.patch	\
diff --git a/gnu/packages/cyrus-sasl.scm b/gnu/packages/cyrus-sasl.scm
index ef408f2dd7..e7a011c9e7 100644
--- a/gnu/packages/cyrus-sasl.scm
+++ b/gnu/packages/cyrus-sasl.scm
@@ -28,6 +28,8 @@ (define-module (gnu packages cyrus-sasl)
   #:use-module (gnu packages kerberos)
   #:use-module (gnu packages tls)
   #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (guix build utils)
+  #:use-module (guix build mix-build-system)
   #:use-module (guix gexp)
   #:use-module (guix packages)
   #:use-module (guix download)
@@ -37,27 +39,38 @@ (define-public cyrus-sasl
   (package
     (name "cyrus-sasl")
     (version "2.1.28")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append "https://github.com/cyrusimap/cyrus-sasl"
-                                  "/releases/download/cyrus-sasl-" version
-                                  "/cyrus-sasl-" version ".tar.gz"))
-              (sha256
-               (base32
-                "135kbgyfpa1mwqp5dm223yr6ddzi4vjm7cr414d7rmhys2mwdkvw"))))
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "https://github.com/cyrusimap/cyrus-sasl"
+                           "/releases/download/cyrus-sasl-"
+                           version
+                           "/cyrus-sasl-"
+                           version
+                           ".tar.gz"))
+       (sha256
+        (base32 "135kbgyfpa1mwqp5dm223yr6ddzi4vjm7cr414d7rmhys2mwdkvw"))
+       (patches (search-patches "cyrus-sasl-fix-time-h.patch"))))
     (build-system gnu-build-system)
     (inputs (list gdbm libxcrypt mit-krb5 openssl))
+    (native-inputs `(("autoconf" ,autoconf)
+                     ("automake" ,automake)
+                     ("libtool" ,libtool)))
     (arguments
      (list
-      #:configure-flags #~(list (string-append "--with-plugindir="
-                                               (assoc-ref %outputs "out")
-                                               "/lib/sasl2")
-                                ;; When cross-compiling the build system is
-                                ;; unable to determine whether SPNEGO is
-                                ;; supported; Kerberos does, so enable it.
-                                #$@(if (%current-target-system)
-                                       '("ac_cv_gssapi_supports_spnego=yes")
-                                       '()))
+      #:phases '(modify-phases %standard-phases
+                  (add-before 'configure 'autoreconf
+                    (lambda* (#:key system #:allow-other-keys)
+                      (invoke "autoreconf" "-vfi"))))
+      #:configure-flags
+      #~(list (string-append "--with-plugindir="
+                             (assoc-ref %outputs "out") "/lib/sasl2")
+              ;; When cross-compiling the build system is
+              ;; unable to determine whether SPNEGO is
+              ;; supported; Kerberos does, so enable it.
+              #$@(if (%current-target-system)
+                     '("ac_cv_gssapi_supports_spnego=yes")
+                     '()))
 
       ;; The 'plugins' directory has shared source files, such as
       ;; 'plugin_common.c'.  When building the shared libraries there, libtool
diff --git a/gnu/packages/patches/cyrus-sasl-fix-time-h.patch b/gnu/packages/patches/cyrus-sasl-fix-time-h.patch
new file mode 100644
index 0000000000..922c4cb322
--- /dev/null
+++ b/gnu/packages/patches/cyrus-sasl-fix-time-h.patch
@@ -0,0 +1,57 @@
+From 266f0acf7f5e029afbb3e263437039e50cd6c262 Mon Sep 17 00:00:00 2001
+From: Sam James <sam@gentoo.org>
+Date: Wed, 23 Feb 2022 00:45:15 +0000
+Subject: [PATCH] Fix <time.h> check
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+We're conditionally including based on HAVE_TIME_H in a bunch of places,
+but we're not actually checking for time.h, so that's never going to be defined.
+
+While at it, add in a missing include in the cram plugin.
+
+This fixes a bunch of implicit declaration warnings:
+```
+ * cyrus-sasl-2.1.28/lib/saslutil.c:280:3: warning: implicit declaration of function ‘time’ [-Wimplicit-function-declaration]
+ * cyrus-sasl-2.1.28/lib/saslutil.c:364:41: warning: implicit declaration of function ‘clock’ [-Wimplicit-function-declaration]
+ * cyrus-sasl-2.1.28/plugins/cram.c:132:7: warning: implicit declaration of function ‘time’ [-Wimplicit-function-declaration]
+ * cyrus-sasl-2.1.28/lib/saslutil.c:280:3: warning: implicit declaration of function ‘time’ [-Wimplicit-function-declaration]
+ * cyrus-sasl-2.1.28/lib/saslutil.c:364:41: warning: implicit declaration of function ‘clock’ [-Wimplicit-function-declaration]
+ * cyrus-sasl-2.1.28/plugins/cram.c:132:7: warning: implicit declaration of function ‘time’ [-Wimplicit-function-declaration]
+```
+
+Signed-off-by: Sam James <sam@gentoo.org>
+---
+ configure.ac   | 2 +-
+ plugins/cram.c | 4 ++++
+ 2 files changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index e1bf53b6..ad781830 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1290,7 +1290,7 @@ AC_CHECK_HEADERS_ONCE([sys/time.h])
+ 
+ AC_HEADER_DIRENT
+ AC_HEADER_SYS_WAIT
+-AC_CHECK_HEADERS(crypt.h des.h dlfcn.h fcntl.h limits.h malloc.h paths.h strings.h sys/file.h sys/time.h syslog.h unistd.h inttypes.h sys/uio.h sys/param.h sysexits.h stdarg.h varargs.h krb5.h)
++AC_CHECK_HEADERS(crypt.h des.h dlfcn.h fcntl.h limits.h malloc.h paths.h strings.h sys/file.h sys/time.h syslog.h time.h unistd.h inttypes.h sys/uio.h sys/param.h sysexits.h stdarg.h varargs.h krb5.h)
+ 
+ IPv6_CHECK_SS_FAMILY()
+ IPv6_CHECK_SA_LEN()
+diff --git a/plugins/cram.c b/plugins/cram.c
+index d02e9baa..695aaa91 100644
+--- a/plugins/cram.c
++++ b/plugins/cram.c
+@@ -53,6 +53,10 @@
+ #endif
+ #include <fcntl.h>
+ 
++#ifdef HAVE_TIME_H
++#include <time.h>
++#endif
++
+ #include <sasl.h>
+ #include <saslplug.h>
+ #include <saslutil.h>
-- 
2.49.0





Reply sent to Andreas Enge <andreas@enge.fr>:
You have taken responsibility. (Thu, 21 Aug 2025 08:43:02 GMT) (full text, mbox, link).


Notification sent to aragaer <aragaer@gmail.com>:
bug acknowledged by developer. (Thu, 21 Aug 2025 08:43:03 GMT) (full text, mbox, link).


Message #10 received at 78176-done@debbugs.gnu.org (full text, mbox, reply):

From: Andreas Enge <andreas@enge.fr>
To: aragaer <aragaer@gmail.com>
Cc: 78176-done@debbugs.gnu.org
Subject: Re: [PATCH] gnu: cyrus-sasl: Fix time.h check
Date: Thu, 21 Aug 2025 10:41:58 +0200
Thanks for the patch!

We normally avoid whitespace and styling changes, as they obscure the
real changes. Since the commit did not apply anymore, I have just taken
the patch and retyped the changes. Notice also the new style for inputs;
they can be simple lists, no need for adding the names as strings.

This is now on our new platform, Codeberg, as
   https://codeberg.org/guix/guix/pulls/2146
and will be applied to a branch soon; closing it here.

Andreas





Send a report that this bug log contains spam.


debbugs.gnu.org maintainers <help-debbugs@gnu.org>. Last modified: Sun Sep 7 08:56:14 2025; Machine Name: wallace-server

GNU bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.