procmail: always use system strstr

The upstream procmail build system uses a small benchmark to determine
what `strstr` implementation to use: the system one or a bespoke one.

We'd like our packaging to be deterministic, so this patch (credits to
Bernhard Wiedemann of openSUSE) fixes the detection to always use the
system `strstr`.

Potentially fixes https://github.com/NixOS/nixpkgs/issues/384714
This commit is contained in:
Arnout Engelen 2025-04-03 17:01:54 +02:00
parent 2c8d3f48d3
commit 5d3b4af481
No known key found for this signature in database
GPG key ID: 061107B0F74A6DAA
2 changed files with 43 additions and 0 deletions

View file

@ -16,6 +16,9 @@ stdenv.mkDerivation rec {
};
patches = [
# Avoid benchmarking the build machine to determine compilation results
# https://build.opensuse.org/projects/server:mail/packages/procmail/files/reproducible.patch?expand=1
./reproducible.patch
# Fix clang-16 and gcc-14 build failures:
# https://github.com/BuGlessRB/procmail/pull/7
(fetchpatch {

View file

@ -0,0 +1,40 @@
https://bugzilla.opensuse.org/show_bug.cgi?id=1041534
Avoid benchmarking the build machine
to determine compilation results
Index: procmail-3.24/src/autoconf
===================================================================
--- procmail-3.24.orig/src/autoconf
+++ procmail-3.24/src/autoconf
@@ -951,6 +951,7 @@ void*realloc(),*malloc();
#endif
int main()
{ char*p=malloc(1),*q=0;
+#if 0
size_t len,last,max=BLKSIZ*64; /* 1M on non-SMALLHEAP systems */
int count=0;
for(last=len=INITIAL;len<=max+INITIAL;len+=BLKSIZ)
@@ -968,6 +969,7 @@ int main()
{ puts("#define INEFFICIENTrealloc");
exit(1);
}
+#endif
exit(0);
}
HERE
@@ -1248,10 +1250,9 @@ int main(argc,argv)int argc;const char*a
if(!iter)
iter=1;
printf("\
-/* Your system's strstr() is %.2f times %sER than my C-routine */\n",
- syscnt>=iter?(double)syscnt/iter:(double)iter/syscnt,
- syscnt>=iter?"SLOW":"FAST");
- if(syscnt>iter+iter/16) /* if at least 1.0625 times slower */
+/* Your system's strstr() is %sER than my C-routine */\n",
+ "FAST");
+ if(0) /* always use system strstr to have reproducible binaries */
printf("\
#define SLOWstrstr\t\t\t /* using my substitute instead */\n");
}