Gentoo Archives: gentoo-commits

From: "Ulrich Müller" <ulm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-misc/detachtty/, app-misc/detachtty/files/
Date: Wed, 04 May 2022 12:59:44
Message-Id: 1651669174.18147fe4079060b6a55d013ad58773ddf45f6efb.ulm@gentoo
1 commit: 18147fe4079060b6a55d013ad58773ddf45f6efb
2 Author: Ulrich Müller <ulm <AT> gentoo <DOT> org>
3 AuthorDate: Wed May 4 12:58:32 2022 +0000
4 Commit: Ulrich Müller <ulm <AT> gentoo <DOT> org>
5 CommitDate: Wed May 4 12:59:34 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=18147fe4
7
8 app-misc/detachtty: Fix compilation on sparc
9
10 Closes: https://bugs.gentoo.org/807184
11 Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>
12
13 app-misc/detachtty/detachtty-11.0.0.ebuild | 4 +-
14 .../detachtty/files/detachtty-11.0.0-sparc.patch | 121 +++++++++++++++++++++
15 2 files changed, 124 insertions(+), 1 deletion(-)
16
17 diff --git a/app-misc/detachtty/detachtty-11.0.0.ebuild b/app-misc/detachtty/detachtty-11.0.0.ebuild
18 index 2a826d210e63..352a9433f0a6 100644
19 --- a/app-misc/detachtty/detachtty-11.0.0.ebuild
20 +++ b/app-misc/detachtty/detachtty-11.0.0.ebuild
21 @@ -1,4 +1,4 @@
22 -# Copyright 1999-2021 Gentoo Authors
23 +# Copyright 1999-2022 Gentoo Authors
24 # Distributed under the terms of the GNU General Public License v2
25
26 EAPI=7
27 @@ -13,6 +13,8 @@ LICENSE="GPL-2"
28 SLOT="0"
29 KEYWORDS="amd64 ppc ~sparc x86"
30
31 +PATCHES=( "${FILESDIR}/${P}-sparc.patch" )
32 +
33 src_compile() {
34 emake CC="$(tc-getCC)" CFLAGS="${CFLAGS}"
35 }
36
37 diff --git a/app-misc/detachtty/files/detachtty-11.0.0-sparc.patch b/app-misc/detachtty/files/detachtty-11.0.0-sparc.patch
38 new file mode 100644
39 index 000000000000..a65907abf92b
40 --- /dev/null
41 +++ b/app-misc/detachtty/files/detachtty-11.0.0-sparc.patch
42 @@ -0,0 +1,121 @@
43 +Fix compilation on sparc.
44 +Patch from upstream, backported to the 11.0.0 release.
45 +
46 +commit db785c7975e364acbf76a4db90296820d36b0740
47 +Author: matoro <matoro@××××××××××××××××××××.com>
48 +Date: Wed May 4 08:28:11 2022 -0400
49 +
50 + check for signal existence before registering in handler (#5)
51 +
52 + Some signals are only defined on certain platforms. For example,
53 + SIGSTKFLT does not exist on sparc. Use preprocessor macros to check for
54 + signal's existence before registering signal handler for it.
55 +
56 + Note that this is the same technique cpython uses:
57 + https://github.com/python/cpython/blob/3.10/Modules/signalmodule.c#L1427
58 +
59 + See: https://bugs.gentoo.org/807184
60 +
61 +--- detachtty-11.0.0/attachtty.c
62 ++++ detachtty-11.0.0/attachtty.c
63 +@@ -94,8 +94,45 @@
64 + static void init_signal_handlers(void) {
65 + struct sigaction act;
66 + int i, fatal_sig[] = {
67 +- SIGHUP, SIGQUIT, SIGILL, SIGABRT, SIGBUS, SIGFPE, SIGSEGV, SIGPIPE,
68 +- SIGTERM, SIGSTKFLT, SIGCHLD, SIGXCPU, SIGXFSZ,
69 ++#ifdef SIGHUP
70 ++ SIGHUP,
71 ++#endif
72 ++#ifdef SIGQUIT
73 ++ SIGQUIT,
74 ++#endif
75 ++#ifdef SIGILL
76 ++ SIGILL,
77 ++#endif
78 ++#ifdef SIGABRT
79 ++ SIGABRT,
80 ++#endif
81 ++#ifdef SIGBUS
82 ++ SIGBUS,
83 ++#endif
84 ++#ifdef SIGFPE
85 ++ SIGFPE,
86 ++#endif
87 ++#ifdef SIGSEGV
88 ++ SIGSEGV,
89 ++#endif
90 ++#ifdef SIGPIPE
91 ++ SIGPIPE,
92 ++#endif
93 ++#ifdef SIGTERM
94 ++ SIGTERM,
95 ++#endif
96 ++#ifdef SIGSTKFLT
97 ++ SIGSTKFLT,
98 ++#endif
99 ++#ifdef SIGCHLD
100 ++ SIGCHLD,
101 ++#endif
102 ++#ifdef SIGXCPU
103 ++ SIGXCPU,
104 ++#endif
105 ++#ifdef SIGXFSZ
106 ++ SIGXFSZ,
107 ++#endif
108 + };
109 +
110 + /* catch SIGINT and send character \003 over the link */
111 +--- detachtty-11.0.0/detachtty.c
112 ++++ detachtty-11.0.0/detachtty.c
113 +@@ -392,9 +392,47 @@
114 +
115 + static void init_signal_handlers(void) {
116 + struct sigaction act;
117 +- int i, fatal_sig[] = { SIGHUP, SIGQUIT, SIGILL, SIGABRT, SIGBUS, SIGFPE,
118 +- SIGSEGV, /*SIGPIPE,*/ SIGTERM, SIGSTKFLT, SIGCHLD,
119 +- SIGXCPU, SIGXFSZ, };
120 ++ int i, fatal_sig[] = {
121 ++#ifdef SIGHUP
122 ++ SIGHUP,
123 ++#endif
124 ++#ifdef SIGQUIT
125 ++ SIGQUIT,
126 ++#endif
127 ++#ifdef SIGILL
128 ++ SIGILL,
129 ++#endif
130 ++#ifdef SIGABRT
131 ++ SIGABRT,
132 ++#endif
133 ++#ifdef SIGBUS
134 ++ SIGBUS,
135 ++#endif
136 ++#ifdef SIGFPE
137 ++ SIGFPE,
138 ++#endif
139 ++#ifdef SIGSEGV
140 ++ SIGSEGV,
141 ++#endif
142 ++#ifdef SIGPIPE
143 ++ /*SIGPIPE,*/
144 ++#endif
145 ++#ifdef SIGTERM
146 ++ SIGTERM,
147 ++#endif
148 ++#ifdef SIGSTKFLT
149 ++ SIGSTKFLT,
150 ++#endif
151 ++#ifdef SIGCHLD
152 ++ SIGCHLD,
153 ++#endif
154 ++#ifdef SIGXCPU
155 ++ SIGXCPU,
156 ++#endif
157 ++#ifdef SIGXFSZ
158 ++ SIGXFSZ,
159 ++#endif
160 ++ };
161 +
162 + /* catch SIGCHLD, SIGQUIT, SIGTERM, SIGILL, SIGFPE... and exit */
163 + act.sa_handler = fatal_signal_handler;