commit: 18147fe4079060b6a55d013ad58773ddf45f6efb Author: Ulrich Müller <ulm <AT> gentoo <DOT> org> AuthorDate: Wed May 4 12:58:32 2022 +0000 Commit: Ulrich Müller <ulm <AT> gentoo <DOT> org> CommitDate: Wed May 4 12:59:34 2022 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=18147fe4
app-misc/detachtty: Fix compilation on sparc Closes: https://bugs.gentoo.org/807184 Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org> app-misc/detachtty/detachtty-11.0.0.ebuild | 4 +- .../detachtty/files/detachtty-11.0.0-sparc.patch | 121 +++++++++++++++++++++ 2 files changed, 124 insertions(+), 1 deletion(-) diff --git a/app-misc/detachtty/detachtty-11.0.0.ebuild b/app-misc/detachtty/detachtty-11.0.0.ebuild index 2a826d210e63..352a9433f0a6 100644 --- a/app-misc/detachtty/detachtty-11.0.0.ebuild +++ b/app-misc/detachtty/detachtty-11.0.0.ebuild @@ -1,4 +1,4 @@ -# Copyright 1999-2021 Gentoo Authors +# Copyright 1999-2022 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=7 @@ -13,6 +13,8 @@ LICENSE="GPL-2" SLOT="0" KEYWORDS="amd64 ppc ~sparc x86" +PATCHES=( "${FILESDIR}/${P}-sparc.patch" ) + src_compile() { emake CC="$(tc-getCC)" CFLAGS="${CFLAGS}" } diff --git a/app-misc/detachtty/files/detachtty-11.0.0-sparc.patch b/app-misc/detachtty/files/detachtty-11.0.0-sparc.patch new file mode 100644 index 000000000000..a65907abf92b --- /dev/null +++ b/app-misc/detachtty/files/detachtty-11.0.0-sparc.patch @@ -0,0 +1,121 @@ +Fix compilation on sparc. +Patch from upstream, backported to the 11.0.0 release. + +commit db785c7975e364acbf76a4db90296820d36b0740 +Author: matoro <mat...@users.noreply.github.com> +Date: Wed May 4 08:28:11 2022 -0400 + + check for signal existence before registering in handler (#5) + + Some signals are only defined on certain platforms. For example, + SIGSTKFLT does not exist on sparc. Use preprocessor macros to check for + signal's existence before registering signal handler for it. + + Note that this is the same technique cpython uses: + https://github.com/python/cpython/blob/3.10/Modules/signalmodule.c#L1427 + + See: https://bugs.gentoo.org/807184 + +--- detachtty-11.0.0/attachtty.c ++++ detachtty-11.0.0/attachtty.c +@@ -94,8 +94,45 @@ + static void init_signal_handlers(void) { + struct sigaction act; + int i, fatal_sig[] = { +- SIGHUP, SIGQUIT, SIGILL, SIGABRT, SIGBUS, SIGFPE, SIGSEGV, SIGPIPE, +- SIGTERM, SIGSTKFLT, SIGCHLD, SIGXCPU, SIGXFSZ, ++#ifdef SIGHUP ++ SIGHUP, ++#endif ++#ifdef SIGQUIT ++ SIGQUIT, ++#endif ++#ifdef SIGILL ++ SIGILL, ++#endif ++#ifdef SIGABRT ++ SIGABRT, ++#endif ++#ifdef SIGBUS ++ SIGBUS, ++#endif ++#ifdef SIGFPE ++ SIGFPE, ++#endif ++#ifdef SIGSEGV ++ SIGSEGV, ++#endif ++#ifdef SIGPIPE ++ SIGPIPE, ++#endif ++#ifdef SIGTERM ++ SIGTERM, ++#endif ++#ifdef SIGSTKFLT ++ SIGSTKFLT, ++#endif ++#ifdef SIGCHLD ++ SIGCHLD, ++#endif ++#ifdef SIGXCPU ++ SIGXCPU, ++#endif ++#ifdef SIGXFSZ ++ SIGXFSZ, ++#endif + }; + + /* catch SIGINT and send character \003 over the link */ +--- detachtty-11.0.0/detachtty.c ++++ detachtty-11.0.0/detachtty.c +@@ -392,9 +392,47 @@ + + static void init_signal_handlers(void) { + struct sigaction act; +- int i, fatal_sig[] = { SIGHUP, SIGQUIT, SIGILL, SIGABRT, SIGBUS, SIGFPE, +- SIGSEGV, /*SIGPIPE,*/ SIGTERM, SIGSTKFLT, SIGCHLD, +- SIGXCPU, SIGXFSZ, }; ++ int i, fatal_sig[] = { ++#ifdef SIGHUP ++ SIGHUP, ++#endif ++#ifdef SIGQUIT ++ SIGQUIT, ++#endif ++#ifdef SIGILL ++ SIGILL, ++#endif ++#ifdef SIGABRT ++ SIGABRT, ++#endif ++#ifdef SIGBUS ++ SIGBUS, ++#endif ++#ifdef SIGFPE ++ SIGFPE, ++#endif ++#ifdef SIGSEGV ++ SIGSEGV, ++#endif ++#ifdef SIGPIPE ++ /*SIGPIPE,*/ ++#endif ++#ifdef SIGTERM ++ SIGTERM, ++#endif ++#ifdef SIGSTKFLT ++ SIGSTKFLT, ++#endif ++#ifdef SIGCHLD ++ SIGCHLD, ++#endif ++#ifdef SIGXCPU ++ SIGXCPU, ++#endif ++#ifdef SIGXFSZ ++ SIGXFSZ, ++#endif ++ }; + + /* catch SIGCHLD, SIGQUIT, SIGTERM, SIGILL, SIGFPE... and exit */ + act.sa_handler = fatal_signal_handler;