GNU bug report logs - #79135
[PATCH] gnu: procmail: Fix build with gcc-14.

Previous Next

Package: guix-patches;

Reported by: Tomas Volf <~@wolfsden.cz>

Date: Thu, 31 Jul 2025 16:16:01 UTC

Severity: normal

Tags: patch

Done: Andreas Enge <andreas <at> enge.fr>

To reply to this bug, email your comments to 79135 AT debbugs.gnu.org.
There is no need to reopen the bug first.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#79135; Package guix-patches. (Thu, 31 Jul 2025 16:16:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Tomas Volf <~@wolfsden.cz>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Thu, 31 Jul 2025 16:16:02 GMT) Full text and rfc822 format available.

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

From: Tomas Volf <~@wolfsden.cz>
To: guix-patches <at> gnu.org
Cc: Tomas Volf <~@wolfsden.cz>
Subject: [PATCH] gnu: procmail: Fix build with gcc-14.
Date: Thu, 31 Jul 2025 18:14:31 +0200
* gnu/packages/patches/procmail-gcc-14.patch: New patch.
* gnu/packages/mail.scm (procmail)[source]: Use it.
* gnu/local.mk (dist_patch_DATA): Register it.

Change-Id: I41b3e1d73d319a19efa15ac75cefd326eedd58b1
---
 gnu/local.mk                               |   1 +
 gnu/packages/mail.scm                      |   3 +-
 gnu/packages/patches/procmail-gcc-14.patch | 266 +++++++++++++++++++++
 3 files changed, 269 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/procmail-gcc-14.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 76f2e402b5..37b4a5f959 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -2127,6 +2127,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/procmail-ambiguous-getline-debian.patch  \
   %D%/packages/patches/procmail-CVE-2014-3618.patch		\
   %D%/packages/patches/procmail-CVE-2017-16844.patch		\
+  %D%/packages/patches/procmail-gcc-14.patch		\
   %D%/packages/patches/proj-7-initialize-memory.patch		\
   %D%/packages/patches/proot-add-clone3.patch			\
   %D%/packages/patches/proot-add-missing-include.patch		\
diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index 68611d32f2..f13dbc3010 100644
--- a/gnu/packages/mail.scm
+++ b/gnu/packages/mail.scm
@@ -2808,7 +2808,8 @@ (define-public procmail
        ;; patch 24.
        (patches (search-patches "procmail-ambiguous-getline-debian.patch"
                                 "procmail-CVE-2014-3618.patch"
-                                "procmail-CVE-2017-16844.patch"))))
+                                "procmail-CVE-2017-16844.patch"
+                                "procmail-gcc-14.patch"))))
     (arguments
      `(#:phases (modify-phases %standard-phases
                   (replace 'configure
diff --git a/gnu/packages/patches/procmail-gcc-14.patch b/gnu/packages/patches/procmail-gcc-14.patch
new file mode 100644
index 0000000000..36accb863f
--- /dev/null
+++ b/gnu/packages/patches/procmail-gcc-14.patch
@@ -0,0 +1,266 @@
+diff --git a/initmake b/initmake
+index 82d718d..e44ee67 100755
+--- a/initmake
++++ b/initmake
+@@ -124,7 +124,7 @@ else
+ fi
+
+ cat >_autotst.c <<HERE
+-main()
++int main()
+ { return 0;
+ }
+ HERE
+@@ -200,7 +200,7 @@ cat >_autotst.c <<HERE
+ #include <sys/types.h>
+ #include <stdio.h>
+ #include <sys/stat.h>
+-main()
++int main()
+ { struct stat buf;return!&buf;
+ }
+ HERE
+diff --git a/src/autoconf b/src/autoconf
+index 1cb4c42..995d8bb 100755
+--- a/src/autoconf
++++ b/src/autoconf
+@@ -363,6 +363,7 @@ cat >_autotst.c <<HERE
+ #include <unistd.h>		/* getpid() getppid() */
+ #endif
+ #include <stdio.h>
++#include <stdlib.h>
+ #include <time.h>
+ #include <fcntl.h>
+ #include <signal.h>		/* SIGKILL */
+@@ -416,6 +417,16 @@ cat >_autotst.c <<HERE
+ int dolock,child[NR_of_forks],timeout,fdcollect;
+ char dirlocktest[]="_locktest";
+
++int killchildren()
++{ int i;
++  i=NR_of_forks;
++  do
++     if(child[--i]>0)
++	kill(child[i],SIGTERM),child[i]=0;
++  while(i);
++  return 0;
++}
++
+ void stimeout()
+ { timeout=1;close(fdcollect);killchildren();
+ }
+@@ -437,7 +448,79 @@ unsigned sfork()
+   return pid;
+ }
+
+-int main(argc,argv)char*argv[];
++static int oldfdlock;
++#ifdef F_SETLKW
++static struct flock flck;		/* why can't it be a local variable? */
++#endif
++#ifdef F_LOCK
++static off_t oldlockoffset;
++#endif
++
++int fdlock(int fd)
++{ int i;unsigned gobble[GOBBLE>>2];
++  for(i=GOBBLE>>2;i;gobble[--i]=~(unsigned)0);		 /* SunOS crash test */
++  oldfdlock=fd;fd=0;
++  if(MSK_fcntl&dolock)
++#ifdef F_SETLKW
++   { static unsigned extra;
++     flck.l_type=F_WRLCK;flck.l_whence=SEEK_SET;flck.l_start=tell(oldfdlock);
++     if(!extra--)
++	extra=MIN_locks/4,flck.l_len=2,i|=fcntl(oldfdlock,F_SETLK,&flck);
++     flck.l_len=0;fd|=fcntl(oldfdlock,F_SETLKW,&flck);
++   }
++#else
++     fd=1;
++#endif
++  if(MSK_lockf&dolock)
++#ifdef F_LOCK
++     oldlockoffset=tell(oldfdlock),fd|=lockf(oldfdlock,F_LOCK,(off_t)0);
++#else
++     fd=1;
++#endif
++  if(MSK_flock&dolock)
++#ifdef LOCK_EX
++     fd|=flock(oldfdlock,LOCK_EX);
++#else
++     fd=1;
++#endif
++  return fd;
++}
++
++int sfdlock(int fd)
++{ int i;unsigned gobble[GOBBLE>>2];
++  for(i=GOBBLE>>2;i;gobble[--i]=~(unsigned)0);		 /* SunOS crash test */
++  return fdlock(fd);
++}
++
++int fdunlock()
++{ int i;unsigned gobble[GOBBLE];
++  for(i=GOBBLE;i;gobble[--i]=~(unsigned)0);  /* some SunOS libs mess this up */
++  if(MSK_flock&dolock)
++#ifdef LOCK_EX
++     i|=flock(oldfdlock,LOCK_UN);
++#else
++     i=1;
++#endif
++  if(MSK_lockf&dolock)
++#ifdef F_LOCK
++   { lseek(oldfdlock,oldlockoffset,SEEK_SET);
++     i|=lockf(oldfdlock,F_LOCK,(off_t)2);i|=lockf(oldfdlock,F_ULOCK,(off_t)0);
++   }
++#else
++     i=1;
++#endif
++  if(MSK_fcntl&dolock)
++#ifdef F_SETLKW
++     flck.l_type=F_UNLCK,flck.l_len=0,i|=fcntl(oldfdlock,F_SETLK,&flck);
++#else
++     i=1;
++#endif
++  if(!i)
++     for(i=GOBBLE;i&&gobble[--i]==~(unsigned)0;);
++  return i;
++}
++
++int main(argc,argv)int argc;char*argv[];
+ { int goodlock,testlock,i,pip[2],pipw[2];time_t otimet;unsigned dtimet;
+   static char filename[]="_locktst.l0";
+   close(0);goodlock=0;testlock=FIRST_lock;signal(SIGPIPE,SIG_DFL);
+@@ -576,88 +659,6 @@ skip_tests:
+   puts("Kernel-locking tests completed.");fprintf(stderr,"\n");
+   return EXIT_SUCCESS;
+ }
+-
+-int killchildren()
+-{ int i;
+-  i=NR_of_forks;
+-  do
+-     if(child[--i]>0)
+-	kill(child[i],SIGTERM),child[i]=0;
+-  while(i);
+-  return 0;
+-}
+-
+-int sfdlock(fd)
+-{ int i;unsigned gobble[GOBBLE>>2];
+-  for(i=GOBBLE>>2;i;gobble[--i]=~(unsigned)0);		 /* SunOS crash test */
+-  return fdlock(fd);
+-}
+-
+-static oldfdlock;
+-#ifdef F_SETLKW
+-static struct flock flck;		/* why can't it be a local variable? */
+-#endif
+-#ifdef F_LOCK
+-static off_t oldlockoffset;
+-#endif
+-
+-int fdlock(fd)
+-{ int i;unsigned gobble[GOBBLE>>2];
+-  for(i=GOBBLE>>2;i;gobble[--i]=~(unsigned)0);		 /* SunOS crash test */
+-  oldfdlock=fd;fd=0;
+-  if(MSK_fcntl&dolock)
+-#ifdef F_SETLKW
+-   { static unsigned extra;
+-     flck.l_type=F_WRLCK;flck.l_whence=SEEK_SET;flck.l_start=tell(oldfdlock);
+-     if(!extra--)
+-	extra=MIN_locks/4,flck.l_len=2,i|=fcntl(oldfdlock,F_SETLK,&flck);
+-     flck.l_len=0;fd|=fcntl(oldfdlock,F_SETLKW,&flck);
+-   }
+-#else
+-     fd=1;
+-#endif
+-  if(MSK_lockf&dolock)
+-#ifdef F_LOCK
+-     oldlockoffset=tell(oldfdlock),fd|=lockf(oldfdlock,F_LOCK,(off_t)0);
+-#else
+-     fd=1;
+-#endif
+-  if(MSK_flock&dolock)
+-#ifdef LOCK_EX
+-     fd|=flock(oldfdlock,LOCK_EX);
+-#else
+-     fd=1;
+-#endif
+-  return fd;
+-}
+-
+-int fdunlock()
+-{ int i;unsigned gobble[GOBBLE];
+-  for(i=GOBBLE;i;gobble[--i]=~(unsigned)0);  /* some SunOS libs mess this up */
+-  if(MSK_flock&dolock)
+-#ifdef LOCK_EX
+-     i|=flock(oldfdlock,LOCK_UN);
+-#else
+-     i=1;
+-#endif
+-  if(MSK_lockf&dolock)
+-#ifdef F_LOCK
+-   { lseek(oldfdlock,oldlockoffset,SEEK_SET);
+-     i|=lockf(oldfdlock,F_LOCK,(off_t)2);i|=lockf(oldfdlock,F_ULOCK,(off_t)0);
+-   }
+-#else
+-     i=1;
+-#endif
+-  if(MSK_fcntl&dolock)
+-#ifdef F_SETLKW
+-     flck.l_type=F_UNLCK,flck.l_len=0,i|=fcntl(oldfdlock,F_SETLK,&flck);
+-#else
+-     i=1;
+-#endif
+-  if(!i)
+-     for(i=GOBBLE;i&&gobble[--i]==~(unsigned)0;);
+-  return i;
+-}
+ HERE
+
+ if $MAKE _autotst >_autotst.rrr 2>&1
+@@ -1033,6 +1034,10 @@ cat >_autotst.c <<HERE
+ #ifndef NO_COMSAT
+ #include "network.h"
+ #endif
++#include <string.h>
++#include <unistd.h>
++int setrgid();
++int setresgid();
+ int main(){char a[2];
+  endpwent();endgrent();memmove(a,"0",1);bcopy("0",a,1);strcspn(a,"0");
+  strtol("0",(char**)0,10);strchr("0",'0');strpbrk(a,"0");rename(a,"0");
+@@ -1059,7 +1064,7 @@ echo 'Testing for memmove, strchr, strpbrk, strcspn, strtol, strstr,'
+ echo '	rename, setrgid, setegid, pow, opendir, mkdir, waitpid, fsync,'
+ echo '	ftruncate, strtod, strncasecmp, strerror, strlcat,'
+ echo '	memset, bzero, and _exit'
+-if $MAKE _autotst.$O >$DEVNULL 2>&1
++if $MAKE _autotst.$O >_autotst.rrr 2>&1
+ then
+ :
+ else
+diff --git a/src/foldinfo.c b/src/foldinfo.c
+index 10fe406..33e7bff 100644
+--- a/src/foldinfo.c
++++ b/src/foldinfo.c
+@@ -18,6 +18,7 @@ static /*const*/char rcsid[]=
+ #include "goodies.h"
+ #include "locking.h"
+ #include "foldinfo.h"
++#include "acommon.h"
+
+ static const char
+  maildirtmp[]=MAILDIRtmp,maildircur[]=MAILDIRcur;
+diff --git a/src/mailfold.c b/src/mailfold.c
+index 917b502..9e3d386 100644
+--- a/src/mailfold.c
++++ b/src/mailfold.c
+@@ -371,7 +371,7 @@ void concon(ch)const int ch;   /* flip between concatenated and split fields */
+    }
+ }
+
+-void readmail(rhead,tobesent)const long tobesent;
++void readmail(rhead,tobesent)const long tobesent; int rhead;
+ { char*chp,*pastend;static size_t contlengthoffset;
+   ;{ long dfilled;
+      if(rhead==2)		  /* already read, just examine what we have */
-- 
2.50.1





Information forwarded to guix-patches <at> gnu.org:
bug#79135; Package guix-patches. (Fri, 01 Aug 2025 11:55:02 GMT) Full text and rfc822 format available.

Message #8 received at 79135 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Enge <andreas <at> enge.fr>
To: Tomas Volf <~@wolfsden.cz>
Cc: 79135 <at> debbugs.gnu.org
Subject: Re: [PATCH] gnu: procmail: Fix build with gcc-14.
Date: Fri, 1 Aug 2025 13:53:51 +0200
Hello Tomas,

thanks for the patch! Could you add a comment as to where it comes from?
Or did you create it yourself? Maybe then this could also be a comment
at the top of the file...

At https://codeberg.org/guix/guix/issues/1671 I ask the question whether
there is a new "official" release; would you have an answer to that?

Andreas





Information forwarded to guix-patches <at> gnu.org:
bug#79135; Package guix-patches. (Sat, 02 Aug 2025 15:42:01 GMT) Full text and rfc822 format available.

Message #11 received at 79135 <at> debbugs.gnu.org (full text, mbox):

From: Tomas Volf <~@wolfsden.cz>
To: Andreas Enge <andreas <at> enge.fr>
Cc: 79135 <at> debbugs.gnu.org
Subject: Re: [PATCH] gnu: procmail: Fix build with gcc-14.
Date: Sat, 02 Aug 2025 17:41:20 +0200
Hi Andreas,

Andreas Enge <andreas <at> enge.fr> writes:

> thanks for the patch! Could you add a comment as to where it comes from?
> Or did you create it yourself? Maybe then this could also be a comment
> at the top of the file...

Since the patch already has From and Signed-off-by, I did not realize it
necessary, but sure, can do.  I took the patch from the link ArneBab
provided in the issue you have linked below and made few additions to
get it to actually compile in Guix, but those are minor enough to not
warrant copyright for me.

Where should that comment go?  Into the package definition
(gnu/packages/mail.scm) or into the patch itself?

> At https://codeberg.org/guix/guix/issues/1671 I ask the question whether
> there is a new "official" release; would you have an answer to that?

Sadly I have no answer here.

Tomas

-- 
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.




Reply sent to Andreas Enge <andreas <at> enge.fr>:
You have taken responsibility. (Sat, 02 Aug 2025 17:07:01 GMT) Full text and rfc822 format available.

Notification sent to Tomas Volf <~@wolfsden.cz>:
bug acknowledged by developer. (Sat, 02 Aug 2025 17:07:02 GMT) Full text and rfc822 format available.

Message #16 received at 79135-done <at> debbugs.gnu.org (full text, mbox):

From: Andreas Enge <andreas <at> enge.fr>
To: Tomas Volf <~@wolfsden.cz>
Cc: 79135-done <at> debbugs.gnu.org
Subject: Re: [PATCH] gnu: procmail: Fix build with gcc-14.
Date: Sat, 2 Aug 2025 19:05:58 +0200
Am Sat, Aug 02, 2025 at 05:41:20PM +0200 schrieb Tomas Volf:
> > thanks for the patch! Could you add a comment as to where it comes from?
> > Or did you create it yourself? Maybe then this could also be a comment
> > at the top of the file...
> Since the patch already has From and Signed-off-by, I did not realize it
> necessary, but sure, can do.  I took the patch from the link ArneBab
> provided in the issue you have linked below and made few additions to
> get it to actually compile in Guix, but those are minor enough to not
> warrant copyright for me.

Sorry for being ambiguous, I really meant adding a comment to the .patch
file itself; when it comes from upstream, for instance, it can be useful
to make it clear that it can simply be dropped in a newer release, for
instance.

Given your explanation, I have added the link Arne gave to this issue.

Pushed, thanks!

Andreas





This bug report was last modified 13 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.