From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 5F32F1581D3 for ; Wed, 22 May 2024 19:24:45 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 9E911E2A25; Wed, 22 May 2024 19:24:44 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 449EDE2A25 for ; Wed, 22 May 2024 19:24:44 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 3A795341E1C for ; Wed, 22 May 2024 19:24:43 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 6DCC01A2E for ; Wed, 22 May 2024 19:24:41 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1716405481.47750a2e4af92aa6566c3225985f7515b63b61dd.sam@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: mail-filter/procmail/files/, mail-filter/procmail/ X-VCS-Repository: repo/gentoo X-VCS-Files: mail-filter/procmail/files/procmail-3.24-modern-c.patch mail-filter/procmail/procmail-3.24-r1.ebuild X-VCS-Directories: mail-filter/procmail/files/ mail-filter/procmail/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 47750a2e4af92aa6566c3225985f7515b63b61dd X-VCS-Branch: master Date: Wed, 22 May 2024 19:24:41 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 8d9c34ce-78e7-45b0-afe8-b7dab58ce71e X-Archives-Hash: 855b7236e6f2a5eb891f63bd777761d4 commit: 47750a2e4af92aa6566c3225985f7515b63b61dd Author: Gabi Falk gmx com> AuthorDate: Sun May 19 20:00:00 2024 +0000 Commit: Sam James gentoo org> CommitDate: Wed May 22 19:18:01 2024 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=47750a2e mail-filter/procmail: fix modern C issues Added the patch from the upstream pull request (thanks to Jaroslav Škarvada). Link: https://github.com/BuGlessRB/procmail/pull/7 Closes: https://bugs.gentoo.org/919024 Signed-off-by: Gabi Falk gmx.com> Closes: https://github.com/gentoo/gentoo/pull/36747 Signed-off-by: Sam James gentoo.org> .../procmail/files/procmail-3.24-modern-c.patch | 255 +++++++++++++++++++++ mail-filter/procmail/procmail-3.24-r1.ebuild | 119 ++++++++++ 2 files changed, 374 insertions(+) diff --git a/mail-filter/procmail/files/procmail-3.24-modern-c.patch b/mail-filter/procmail/files/procmail-3.24-modern-c.patch new file mode 100644 index 000000000000..dba497304957 --- /dev/null +++ b/mail-filter/procmail/files/procmail-3.24-modern-c.patch @@ -0,0 +1,255 @@ +From 8cfd570fd14c8fb9983859767ab1851bfd064b64 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jaroslav=20=C5=A0karvada?= +Date: Wed, 31 Jan 2024 18:41:21 +0100 +Subject: [PATCH] Fixed build with gcc-14 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Jaroslav Škarvada +--- + initmake | 4 +- + src/autoconf | 173 ++++++++++++++++++++++++++------------------------- + 2 files changed, 91 insertions(+), 86 deletions(-) + +diff --git a/initmake b/initmake +index b901add..703d651 100755 +--- a/initmake ++++ b/initmake +@@ -124,7 +124,7 @@ else + fi + + cat >_autotst.c <_autotst.c < + #include + #include +-main() ++int main() + { struct stat buf;return!&buf; + } + HERE +diff --git a/src/autoconf b/src/autoconf +index 7c46487..97c0bce 100755 +--- a/src/autoconf ++++ b/src/autoconf +@@ -363,6 +363,7 @@ cat >_autotst.c < /* getpid() getppid() */ + #endif + #include ++#include + #include + #include + #include /* SIGKILL */ +@@ -416,6 +417,16 @@ cat >_autotst.c <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 < ++#include ++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/mail-filter/procmail/procmail-3.24-r1.ebuild b/mail-filter/procmail/procmail-3.24-r1.ebuild new file mode 100644 index 000000000000..07ee45bb8869 --- /dev/null +++ b/mail-filter/procmail/procmail-3.24-r1.ebuild @@ -0,0 +1,119 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit flag-o-matic toolchain-funcs prefix + +DESCRIPTION="Mail delivery agent/filter" +HOMEPAGE="https://www.procmail.org/" +SRC_URI="https://github.com/BuGlessRB/procmail/archive/refs/tags/v${PV}.tar.gz -> ${P}.gh.tar.gz" + +LICENSE="|| ( Artistic GPL-2 )" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos" +IUSE="mbox selinux" + +DEPEND=" + acct-group/mail + virtual/mta +" +RDEPEND=" + ${DEPEND} + selinux? ( sec-policy/selinux-procmail ) +" + +src_prepare() { + # disable flock, using both fcntl and flock style locking + # doesn't work with NFS with 2.6.17+ kernels, bug #156493 + + sed -e "s|/\*#define NO_flock_LOCK|#define NO_flock_LOCK|" \ + -i config.h || die "sed failed" + + eapply "${FILESDIR}/${P}-modern-c.patch" + + if ! use mbox ; then + echo "# Use maildir-style mailbox in user's home directory" > "${S}"/procmailrc || die + echo 'DEFAULT=$HOME/.maildir/' >> "${S}"/procmailrc || die + cd "${S}" || die + eapply "${FILESDIR}/${P}-maildir.patch" + else + echo '# Use mbox-style mailbox in /var/spool/mail' > "${S}"/procmailrc || die + echo 'DEFAULT=${EPREFIX}/var/spool/mail/$LOGNAME' >> "${S}"/procmailrc || die + fi + + # Do not use lazy bindings on lockfile and procmail + if [[ ${CHOST} != *-darwin* ]]; then + eapply "${FILESDIR}/${P}-lazy-bindings.patch" + fi + + # Prefixify config.h + eapply "${FILESDIR}/${P}-gentoo-prefix.patch" + eprefixify config.h Makefile src/autoconf src/recommend.c + + default +} + +src_compile() { + # bug #875251, bug #896052 + append-flags -std=gnu89 + # bug #859517 + filter-lto + + # -finline-functions (implied by -O3) leaves strstr() in an infinite loop. + # To work around this, we append -fno-inline-functions to CFLAGS + # Since GCC 4.7 we also need -fno-ipa-cp-clone (bug #466552) + # If it's clang, ignore -fno-ipa-cp-clone, as clang doesn't support this + append-flags -fno-inline-functions + tc-is-clang || append-flags -fno-ipa-cp-clone + + sed -e "s|CFLAGS0 = -O|CFLAGS0 = ${CFLAGS}|" \ + -e "s|LDFLAGS0= -s|LDFLAGS0 = ${LDFLAGS}|" \ + -e "s|LOCKINGTEST=__defaults__|#LOCKINGTEST=__defaults__|" \ + -e "s|#LOCKINGTEST=/tmp|LOCKINGTEST=/tmp|" \ + -i Makefile || die "sed failed" + + emake CC="$(tc-getCC)" +} + +src_install() { + cd "${S}"/new || die + insinto /usr/bin + insopts -m 6755 + doins procmail + + doins lockfile + fowners root:mail /usr/bin/lockfile + fperms 2755 /usr/bin/lockfile + + dobin formail mailstat + insopts -m 0644 + + doman *.1 *.5 + + cd "${S}" || die + dodoc FAQ FEATURES HISTORY INSTALL KNOWN_BUGS README + + insinto /etc + doins procmailrc + + docinto examples + dodoc examples/* +} + +pkg_postinst() { + if ! use mbox ; then + elog "Starting with mail-filter/procmail-3.22-r9 you'll need to ensure" + elog "that you configure a mail storage location using DEFAULT in" + elog "/etc/procmailrc, for example:" + elog "\tDEFAULT=\$HOME/.maildir/" + fi + if has sfperms ${FEATURES}; then + ewarn "FEATURES=sfperms removes the read-bit for others from" + ewarn " /usr/bin/procmail" + ewarn " /usr/bin/lockfile" + ewarn "If you use procmail from an MTA like Exim, you need to" + ewarn "re-add the read-bit or avoid the MTA checking the binary" + ewarn "exists." + fi +}