Bug 2148550

Summary: procmail: Port to C99 or switch to building in C89 mode
Product: [Fedora] Fedora Reporter: Florian Weimer <fweimer>
Component: procmailAssignee: Jaroslav Škarvada <jskarvad>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: anon.amish, fhrdina, jskarvad
Target Milestone: ---Keywords: FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2137512    

Description Florian Weimer 2022-11-25 21:24:53 UTC
I'm trying to build procmail with a (strict)er C99 compiler, but the initmake and autoconf shell scripts (not GNU autoconf) look difficult to port.  As far as I understand it, C sources like this one are a compiled:

#include "includes.h"
int main(){int i;i=1;
 i+=WIFEXITED(i);
 i+=WIFSTOPPED(i);
 i+=WEXITSTATUS(i);
 i+=WSIGTERM(i);
 return i;}

And then a function is listed as unsupported if it it appears in a warning. Error messages cause the procedure to abort; the compiler exit status must be zero. This doesn't work in strict C99 mode because the compilation fails; we do not have WSIGTERM in this example.

There doesn't seem to be an upstream project around anymore.

Also raised on the c-std-porting list:

Porting procmail to C99
<https://lore.kernel.org/c-std-porting/87fse6ka12.fsf@oldenburg.str.redhat.com/T/>

Comment 1 Florian Weimer 2022-11-25 21:36:14 UTC
Building in C89 mode like this works at least. Due to local patches, the build flags are injected properly.

diff --git a/procmail.spec b/procmail.spec
index 6767045..87c3653 100644
--- a/procmail.spec
+++ b/procmail.spec
@@ -54,8 +54,8 @@ forward certain incoming mail automatically to someone.
 find examples -type f | xargs chmod 644
 
 %build
-make RPM_OPT_FLAGS="$(getconf LFS_CFLAGS)" autoconf.h
-make RPM_OPT_FLAGS="$RPM_OPT_FLAGS %{?hardened_flags} -Wno-comments $(getconf LFS_CFLAGS)"
+make RPM_OPT_FLAGS="-std=gnu89 $(getconf LFS_CFLAGS)" autoconf.h
+make RPM_OPT_FLAGS="$RPM_OPT_FLAGS -std=gnu89 %{?hardened_flags} -Wno-comments $(getconf LFS_CFLAGS)"
 
 %install
 rm -rf ${RPM_BUILD_ROOT}

Comment 2 Jaroslav Škarvada 2022-11-29 14:26:17 UTC
Yes, the upstream seems dead.

What's the point in compiling the package in Fedora in C89? Isn't the default Fedora C standard gnu18? For whatever reason you need it, isn't enough to just enforce the C89 standard to the detection code in the autoconf script? What benefit will it have for Fedora?

Comment 3 Florian Weimer 2022-11-29 14:47:49 UTC
We want to stop providing support for obsolete language constructs in GCC by default if they are known to waste programmer time or are incompatible with future language evolution. That means that code which uses C89-only constructs that were removed from C89, it has to be ported to C99 or later, or built in C89 mode. There is no other way to disable these obsolete features by default.

procmail doesn't use real autoconf, it has its own thing, which at least means we don't have to worry about autoreconf.

Comment 4 Ben Cotton 2023-02-07 14:59:53 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 38 development cycle.
Changing version to 38.