bug-mailutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Compilation error in 3.19 due to assignment between incompatible types


From: Ar Rakin
Subject: Compilation error in 3.19 due to assignment between incompatible types
Date: Tue, 3 Jun 2025 17:40:26 +0600
User-agent: Mozilla Thunderbird

Hello there,

I have tried to compile GNU Mailutils 3.19 from source. Here are my system details:

OS:      Fedora Linux 42 Workstation
Kernel:  6.14.9-300.fc42.x86_64
glibc:   2.41-5.fc42
GCC:     15.1.1 20250521 (Red Hat 15.1.1-2)

I downloaded the tarball as directed in <https://mailutils.org/download.html>. More details on how I compiled the package:

Configure command: ./configure --prefix=/usr/local
Make command:      make -j4

The compilation eventually fails with these error messages:


  CC       progmailer.lo
progmailer.c: In function 'mu_progmailer_create':
progmailer.c:63:18: error: assignment to 'void (*)(void)' from incompatible pointer type 'void (*)(int)' [-Wincompatible-pointer-types]
   63 |   pm->sighandler = SIG_ERR;
      |                  ^
progmailer.c: In function 'mu_progmailer_open':
progmailer.c:116:23: error: assignment to 'void (*)(void)' from incompatible pointer type '__sighandler_t' {aka 'void (*)(int)'} [-Wincompatible-pointer-types]
  116 |   if ((pm->sighandler = signal (SIGCHLD, SIG_DFL)) == SIG_ERR)
      |                       ^
In file included from progmailer.c:27:
/usr/include/signal.h:72:16: note: '__sighandler_t' declared here
   72 | typedef void (*__sighandler_t) (int);
      |                ^~~~~~~~~~~~~~
progmailer.c:116:52: warning: comparison of distinct pointer types lacks a cast [-Wcompare-distinct-pointer-types]
  116 |   if ((pm->sighandler = signal (SIGCHLD, SIG_DFL)) == SIG_ERR)
      |                                                    ^~
progmailer.c: In function 'mu_progmailer_close':
progmailer.c:295:22: warning: comparison of distinct pointer types lacks a cast [-Wcompare-distinct-pointer-types]
  295 |   if (pm->sighandler != SIG_ERR
      |                      ^~
progmailer.c:296:29: error: passing argument 2 of 'signal' from incompatible pointer type [-Wincompatible-pointer-types]
  296 |       && signal (SIGCHLD, pm->sighandler) == SIG_ERR)
      |                           ~~^~~~~~~~~~~~
      |                             |
      |                             void (*)(void)
/usr/include/signal.h:88:57: note: expected '__sighandler_t' {aka 'void (*)(int)'} but argument is of type 'void (*)(void)'
   88 | extern __sighandler_t signal (int __sig, __sighandler_t __handler)
      |                                          ~~~~~~~~~~~~~~~^~~~~~~~~
/usr/include/signal.h:72:16: note: '__sighandler_t' declared here
   72 | typedef void (*__sighandler_t) (int);
      |                ^~~~~~~~~~~~~~
progmailer.c:302:18: error: assignment to 'void (*)(void)' from incompatible pointer type 'void (*)(int)' [-Wincompatible-pointer-types]
  302 |   pm->sighandler = SIG_ERR;
      |                  ^


I changed the type of struct _mu_progmailer::sighandler to __sighandler_t [which basically is: void (*)(int)], and it seemed to compile successfully (runs fine too). So I decided to submit a patch with the same changes:


From 691d1f15cbeba993a8d3afd190831b612d2f8338 Mon Sep 17 00:00:00 2001
From: Ar Rakin <rakinar2@onesoftnet.eu.org>
Date: Tue, 3 Jun 2025 17:15:40 +0600
Subject: [PATCH] Fix incompatible typedefs

* libmailutils/mailer/progmailer.c: Fixed incompatible types, assignment
  of void (*)(int) to void (*)(void).  The macro SIG_ERR expands to a
  value of type __sighandler_t [aka void (*)(int)].

Signed-off-by: Ar Rakin <rakinar2@onesoftnet.eu.org>
---
 libmailutils/mailer/progmailer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libmailutils/mailer/progmailer.c b/libmailutils/mailer/progmailer.c
index c61c917e3..c506d370b 100644
--- a/libmailutils/mailer/progmailer.c
+++ b/libmailutils/mailer/progmailer.c
@@ -45,7 +45,7 @@ struct _mu_progmailer
 {
   int fd;
   pid_t pid;
-  void (*sighandler)();
+  __sighandler_t sighandler;
   char *command;
 };

--
2.49.0


If I have made mistakes here, apologies in advance. I initially tried to submit a bug report at savannah.gnu.org, but the site was extremely slow for me, I couldn't submit my report there.

Thanks,
Rakin

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]