cho-m created an issue (rpm-software-management/rpm#3688)

**Describe the bug**
Building rpm 4.20.1 on macOS fails with undeclared `sighandler_t`. Regression 
introduced with 
https://github.com/rpm-software-management/rpm/commit/7bb4dfd0bcadc7c6177d6fe88a4bcccf7fac98b9.
 

Personally seen in Homebrew. Looking at other repositories, it was hit in:
* nixpkgs - 
https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/tools/package-management/rpm/sighandler_t-macos.patch
* netbsd - 
https://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/misc/rpm/patches/patch-build_rpmfc.c?rev=1.3

**To Reproduce**
Steps to reproduce the behavior:
1. Start with macOS (or probably *BSD) machine
2. Get rpm 4.20.1 source with patch for 
https://github.com/rpm-software-management/rpm/commit/e1d7046ba6662eac9e5e7638e484eb792afa36cc
 (otherwise will fail on `-fhardened`)
3. Perform any build. To reproduce, I went with a minimal dependency build with 
many features disabled: `cmake -S. -B_build -DWITH_LIBELF=OFF -DWITH_LIBDW=OFF 
-DWITH_READLINE=OFF -DENABLE_OPENMP=OFF -DWITH_CAP=OFF -DWITH_ACL=OFF 
-DWITH_AUDIT=OFF -DWITH_SELINUX=OFF -DWITH_SEQUOIA=OFF -DENABLE_PYTHON=OFF 
-DWITH_DBUS=OFF -DCMAKE_PREFIX_PATH=$(brew --prefix libarchive) && cmake 
--build _build`

**Expected behavior**
Successful build

**Output**
```
/tmp/rpm-20250326-12525-j05egl/rpm-4.20.1/build/rpmfc.c:298:5: error: use of 
undeclared identifier 'sighandler_t'
  298 |     sighandler_t oldhandler = signal(SIGPIPE, SIG_IGN);
      |     ^
/tmp/rpm-20250326-12525-j05egl/rpm-4.20.1/build/rpmfc.c:453:21: error: use of 
undeclared identifier 'oldhandler'
  453 |     signal(SIGPIPE, oldhandler);
      |                     ^
```

**Environment**
 - OS / Distribution: macOS 15
 - Version rpm-4.20.1

**Additional context**
According to POSIX 
https://pubs.opengroup.org/onlinepubs/9699919799/functions/signal.html
```
SYNOPSIS

    #include <signal.h>
    
    void (*signal(int sig, void (*func)(int)))(int);
```

And Linux manpage:

```
 The use of sighandler_t is a GNU extension, exposed if _GNU_SOURCE
 is defined; glibc also defines (the BSD-derived) sig_t if
 _BSD_SOURCE (glibc 2.19 and earlier) or _DEFAULT_SOURCE (glibc
 2.19 and later) is defined.  The standard definition of signal()
 is:

     typeof(void (int)) *signal(int signum, typeof(void (int)) *handler);
```

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/3688
You are receiving this because you are subscribed to this thread.

Message ID: <rpm-software-management/rpm/issues/3...@github.com>
_______________________________________________
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
https://lists.rpm.org/mailman/listinfo/rpm-maint

Reply via email to