Bug 2148550 - procmail: Port to C99 or switch to building in C89 mode
Summary: procmail: Port to C99 or switch to building in C89 mode
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: procmail
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jaroslav Škarvada
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PortingToModernCHelpNeeded
TreeView+ depends on / blocked
 
Reported: 2022-11-25 21:24 UTC by Florian Weimer
Modified: 2025-02-28 01:47 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Fedora Package Sources procmail pull-request 2 0 None None None 2025-02-28 01:47:31 UTC
Gentoo 875251 0 None None None 2022-11-25 21:25:23 UTC
Github BuGlessRB procmail issues 1 0 None open Build error: implicit declaration of function 2022-11-26 15:37:08 UTC

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.


Note You need to log in before you can comment on or make changes to this bug.