From d65ce0b32ca8b7daf63088006c0231cac348c097 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Sat, 17 Dec 2022 21:40:37 +0100 Subject: [PATCH] Backport upstream patch to fix C99 issue in kill It is again necessary to run autotools during the build. Related to: --- util-linux-kill-c99.patch | 46 +++++++++++++++++++++++++++++++++++++++ util-linux.spec | 16 +++++++++----- 2 files changed, 56 insertions(+), 6 deletions(-) create mode 100644 util-linux-kill-c99.patch diff --git a/util-linux-kill-c99.patch b/util-linux-kill-c99.patch new file mode 100644 index 0000000..7e02ab1 --- /dev/null +++ b/util-linux-kill-c99.patch @@ -0,0 +1,46 @@ +commit 84732a8849a08d42a9a95dcbee9005116be78eb8 +Author: Khem Raj +Date: Sun Aug 7 14:39:19 2022 -0700 + + check for sys/pidfd.h + + This header in newer glibc defines the signatures of functions + pidfd_send_signal() and pidfd_open() and when these functions are + defined by libc then we need to include the relevant header to get + the definitions. Clang 15+ has started to error out when function + signatures are missing. + + Fixes errors like + misc-utils/kill.c:402:6: error: call to undeclared function 'pidfd_send_signal'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] + if (pidfd_send_signal(pfd, ctl->numsig, &info, 0) < 0) + + Signed-off-by: Khem Raj + +diff --git a/configure.ac b/configure.ac +index d8b4d475103c2bab..4a35d17f81375c29 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -339,6 +339,7 @@ AC_CHECK_HEADERS([ \ + sys/mkdev.h \ + sys/mount.h \ + sys/param.h \ ++ sys/pidfd.h \ + sys/prctl.h \ + sys/resource.h \ + sys/sendfile.h \ +diff --git a/include/pidfd-utils.h b/include/pidfd-utils.h +index eddede9767478be2..d9e33cbc57ae38c8 100644 +--- a/include/pidfd-utils.h ++++ b/include/pidfd-utils.h +@@ -4,8 +4,10 @@ + #ifdef HAVE_SYS_SYSCALL_H + # include + # if defined(SYS_pidfd_send_signal) && defined(SYS_pidfd_open) ++# ifdef HAVE_SYS_PIDFD_H ++# include ++# endif + # include +- + # ifndef HAVE_PIDFD_SEND_SIGNAL + static inline int pidfd_send_signal(int pidfd, int sig, siginfo_t *info, + unsigned int flags) diff --git a/util-linux.spec b/util-linux.spec index 8f1af25..01eaff2 100644 --- a/util-linux.spec +++ b/util-linux.spec @@ -2,7 +2,7 @@ Summary: Collection of basic system utilities Name: util-linux Version: 2.38.1 -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv2 and GPLv2+ and LGPLv2+ and BSD with advertising and Public Domain URL: https://en.wikipedia.org/wiki/Util-linux @@ -38,10 +38,10 @@ BuildRequires: librtas-devel %endif # enable if make changes to build-system -#BuildRequires: autoconf -#BuildRequires: automake -#BuildRequires: libtool -#BuildRequires: bison +BuildRequires: autoconf +BuildRequires: automake +BuildRequires: libtool +BuildRequires: bison ### Sources Source0: https://www.kernel.org/pub/linux/utils/util-linux/v%{upstream_major}/util-linux-%{upstream_version}.tar.xz @@ -93,6 +93,7 @@ Patch0: login-lastlog-create.patch # Add `/run/motd.d` to the hardcoded MOTD_FILE # https://github.com/coreos/console-login-helper-messages/issues/60 Patch1: login-default-motd-file.patch +Patch2: util-linux-kill-c99.patch %description The util-linux package contains a large variety of low-level system @@ -288,7 +289,7 @@ chfn and chsh utilities with dependence on libuser. unset LINGUAS || : # enable only when make a change to the build-system -#./autogen.sh +./autogen.sh export CFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 $RPM_OPT_FLAGS" @@ -909,6 +910,9 @@ fi %{_libdir}/python*/site-packages/libmount/ %changelog +* Sat Dec 17 2022 Florian Weimer - 2.38.1-3 +- Backport upstream patch to fix C99 issue in kill + * Mon Aug 22 2022 Karel Zak - 2.38.1-2 - improve tmpfiles.d use in spec file