1 |
commit: a70bd894c4d44702fd4631669ef7326f5901d0d3 |
2 |
Author: James Le Cuirot <chewi <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Mar 11 23:19:18 2020 +0000 |
4 |
Commit: James Le Cuirot <chewi <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Mar 11 23:20:31 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a70bd894 |
7 |
|
8 |
x11-misc/barrier: Patch around USE=-gui and infinite loop issues |
9 |
|
10 |
These patches are already merged upstream. |
11 |
|
12 |
Closes: https://bugs.gentoo.org/712140 |
13 |
Package-Manager: Portage-2.3.93, Repoman-2.3.20 |
14 |
Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org> |
15 |
|
16 |
...arrier-2.3.2.ebuild => barrier-2.3.2-r1.ebuild} | 2 + |
17 |
.../barrier/files/barrier-2.3.2-inf-loop.patch | 132 +++++++++++++++++++++ |
18 |
.../barrier/files/barrier-2.3.2-no-avahi.patch | 25 ++++ |
19 |
3 files changed, 159 insertions(+) |
20 |
|
21 |
diff --git a/x11-misc/barrier/barrier-2.3.2.ebuild b/x11-misc/barrier/barrier-2.3.2-r1.ebuild |
22 |
similarity index 95% |
23 |
rename from x11-misc/barrier/barrier-2.3.2.ebuild |
24 |
rename to x11-misc/barrier/barrier-2.3.2-r1.ebuild |
25 |
index e5595798265..4b553a9888e 100644 |
26 |
--- a/x11-misc/barrier/barrier-2.3.2.ebuild |
27 |
+++ b/x11-misc/barrier/barrier-2.3.2-r1.ebuild |
28 |
@@ -40,6 +40,8 @@ DEPEND=" |
29 |
" |
30 |
|
31 |
PATCHES=( |
32 |
+ "${FILESDIR}"/${P}-inf-loop.patch |
33 |
+ "${FILESDIR}"/${P}-no-avahi.patch |
34 |
"${FILESDIR}"/${P}-pthread.patch |
35 |
) |
36 |
|
37 |
|
38 |
diff --git a/x11-misc/barrier/files/barrier-2.3.2-inf-loop.patch b/x11-misc/barrier/files/barrier-2.3.2-inf-loop.patch |
39 |
new file mode 100644 |
40 |
index 00000000000..125b903e58e |
41 |
--- /dev/null |
42 |
+++ b/x11-misc/barrier/files/barrier-2.3.2-inf-loop.patch |
43 |
@@ -0,0 +1,132 @@ |
44 |
+From c79120c049d825fedeed70d5a1a9dc64d17ce9f0 Mon Sep 17 00:00:00 2001 |
45 |
+From: Vasily Galkin <galkin-vv@××.ru> |
46 |
+Date: Sun, 9 Feb 2020 23:27:26 +0300 |
47 |
+Subject: [PATCH] Fix infinite loop on fast TCP disconnection |
48 |
+ |
49 |
+The commit a841b28 changed the condition for removing job from processing. |
50 |
+New flag MultiplexerJobStatus::continue_servicing become used |
51 |
+instead of checking pointer for NULL. |
52 |
+However for cases when TCPSocket::newJob() returns nullptr |
53 |
+the behaviour changed: earlier the job was removed, but after change |
54 |
+it is called again, since MultiplexerJobStatus equal to {true, nullptr} |
55 |
+means "run this job again". |
56 |
+ |
57 |
+This leads to problem with eating CPU and RAM on linux |
58 |
+https://github.com/debauchee/barrier/issues/470 |
59 |
+ |
60 |
+There is similar windows problem, but not sure it is related. |
61 |
+https://github.com/debauchee/barrier/issues/552 |
62 |
+ |
63 |
+Since it looks that the goal of a841b28 was only clarifying |
64 |
+object ownership and not changing job deletion behaviour, |
65 |
+this commit tries to get original behaviour and fix the bugs above |
66 |
+by returning {false, nullptr} instead of {true, nullptr} |
67 |
+when TCPSocket::newJob() returns nullptr. |
68 |
+--- |
69 |
+ src/lib/net/SecureSocket.cpp | 4 ++-- |
70 |
+ src/lib/net/TCPSocket.cpp | 25 +++++++++++++------------ |
71 |
+ src/lib/net/TCPSocket.h | 3 ++- |
72 |
+ 3 files changed, 17 insertions(+), 15 deletions(-) |
73 |
+ |
74 |
+diff --git a/src/lib/net/SecureSocket.cpp b/src/lib/net/SecureSocket.cpp |
75 |
+index 99f626e8..92abea3c 100644 |
76 |
+--- a/src/lib/net/SecureSocket.cpp |
77 |
++++ b/src/lib/net/SecureSocket.cpp |
78 |
+@@ -761,7 +761,7 @@ MultiplexerJobStatus SecureSocket::serviceConnect(ISocketMultiplexerJob* job, |
79 |
+ // If status > 0, success |
80 |
+ if (status > 0) { |
81 |
+ sendEvent(m_events->forIDataSocket().secureConnected()); |
82 |
+- return {true, newJob()}; |
83 |
++ return newJobOrStopServicing(); |
84 |
+ } |
85 |
+ |
86 |
+ // Retry case |
87 |
+@@ -793,7 +793,7 @@ MultiplexerJobStatus SecureSocket::serviceAccept(ISocketMultiplexerJob* job, |
88 |
+ // If status > 0, success |
89 |
+ if (status > 0) { |
90 |
+ sendEvent(m_events->forClientListener().accepted()); |
91 |
+- return {true, newJob()}; |
92 |
++ return newJobOrStopServicing(); |
93 |
+ } |
94 |
+ |
95 |
+ // Retry case |
96 |
+diff --git a/src/lib/net/TCPSocket.cpp b/src/lib/net/TCPSocket.cpp |
97 |
+index 4f4251ad..09a8f17e 100644 |
98 |
+--- a/src/lib/net/TCPSocket.cpp |
99 |
++++ b/src/lib/net/TCPSocket.cpp |
100 |
+@@ -403,6 +403,15 @@ void TCPSocket::setJob(std::unique_ptr<ISocketMultiplexerJob>&& job) |
101 |
+ } |
102 |
+ } |
103 |
+ |
104 |
++MultiplexerJobStatus TCPSocket::newJobOrStopServicing() |
105 |
++{ |
106 |
++ auto new_job = newJob(); |
107 |
++ if (new_job) |
108 |
++ return {true, std::move(new_job)}; |
109 |
++ else |
110 |
++ return {false, {}}; |
111 |
++} |
112 |
++ |
113 |
+ std::unique_ptr<ISocketMultiplexerJob> TCPSocket::newJob() |
114 |
+ { |
115 |
+ // note -- must have m_mutex locked on entry |
116 |
+@@ -519,22 +528,14 @@ MultiplexerJobStatus TCPSocket::serviceConnecting(ISocketMultiplexerJob* job, bo |
117 |
+ catch (XArchNetwork& e) { |
118 |
+ sendConnectionFailedEvent(e.what()); |
119 |
+ onDisconnected(); |
120 |
+- auto new_job = newJob(); |
121 |
+- if (new_job) |
122 |
+- return {true, std::move(new_job)}; |
123 |
+- else |
124 |
+- return {false, {}}; |
125 |
++ return newJobOrStopServicing(); |
126 |
+ } |
127 |
+ } |
128 |
+ |
129 |
+ if (write) { |
130 |
+ sendEvent(m_events->forIDataSocket().connected()); |
131 |
+ onConnected(); |
132 |
+- auto new_job = newJob(); |
133 |
+- if (new_job) |
134 |
+- return {true, std::move(new_job)}; |
135 |
+- else |
136 |
+- return {false, {}}; |
137 |
++ return newJobOrStopServicing(); |
138 |
+ } |
139 |
+ |
140 |
+ return {true, {}}; |
141 |
+@@ -548,7 +549,7 @@ MultiplexerJobStatus TCPSocket::serviceConnected(ISocketMultiplexerJob* job, |
142 |
+ if (error) { |
143 |
+ sendEvent(m_events->forISocket().disconnected()); |
144 |
+ onDisconnected(); |
145 |
+- return {true, newJob()}; |
146 |
++ return newJobOrStopServicing(); |
147 |
+ } |
148 |
+ |
149 |
+ EJobResult writeResult = kRetry; |
150 |
+@@ -603,7 +604,7 @@ MultiplexerJobStatus TCPSocket::serviceConnected(ISocketMultiplexerJob* job, |
151 |
+ if (writeResult == kBreak || readResult == kBreak) { |
152 |
+ return {false, {}}; |
153 |
+ } else if (writeResult == kNew || readResult == kNew) { |
154 |
+- return {true, newJob()}; |
155 |
++ return newJobOrStopServicing(); |
156 |
+ } else { |
157 |
+ return {true, {}}; |
158 |
+ } |
159 |
+diff --git a/src/lib/net/TCPSocket.h b/src/lib/net/TCPSocket.h |
160 |
+index 28891353..0b988886 100644 |
161 |
+--- a/src/lib/net/TCPSocket.h |
162 |
++++ b/src/lib/net/TCPSocket.h |
163 |
+@@ -76,7 +76,8 @@ protected: |
164 |
+ |
165 |
+ void removeJob(); |
166 |
+ void setJob(std::unique_ptr<ISocketMultiplexerJob>&& job); |
167 |
+- |
168 |
++ MultiplexerJobStatus newJobOrStopServicing(); |
169 |
++ |
170 |
+ bool isReadable() { return m_readable; } |
171 |
+ bool isWritable() { return m_writable; } |
172 |
+ |
173 |
+-- |
174 |
+2.24.1 |
175 |
+ |
176 |
|
177 |
diff --git a/x11-misc/barrier/files/barrier-2.3.2-no-avahi.patch b/x11-misc/barrier/files/barrier-2.3.2-no-avahi.patch |
178 |
new file mode 100644 |
179 |
index 00000000000..481a23a2d70 |
180 |
--- /dev/null |
181 |
+++ b/x11-misc/barrier/files/barrier-2.3.2-no-avahi.patch |
182 |
@@ -0,0 +1,25 @@ |
183 |
+From 93a4035409ed5a4349c9848c3dae3ec670884ee0 Mon Sep 17 00:00:00 2001 |
184 |
+From: Tetja Rediske <tetja+gitlab@×××××.de~> |
185 |
+Date: Sat, 19 Oct 2019 00:28:13 +0200 |
186 |
+Subject: [PATCH] make non-gui variants build without avahi |
187 |
+ |
188 |
+--- |
189 |
+ CMakeLists.txt | 2 +- |
190 |
+ 1 file changed, 1 insertion(+), 1 deletion(-) |
191 |
+ |
192 |
+diff --git a/CMakeLists.txt b/CMakeLists.txt |
193 |
+index 7f9efac8..8e10776e 100644 |
194 |
+--- a/CMakeLists.txt |
195 |
++++ b/CMakeLists.txt |
196 |
+@@ -175,7 +175,7 @@ if (UNIX) |
197 |
+ link_directories("/usr/X11R6/lib") |
198 |
+ endif() |
199 |
+ |
200 |
+- if (${PKG_CONFIG_FOUND}) |
201 |
++ if (BARRIER_BUILD_GUI AND ${PKG_CONFIG_FOUND}) |
202 |
+ pkg_check_modules (AVAHI_COMPAT REQUIRED avahi-compat-libdns_sd) |
203 |
+ include_directories (BEFORE SYSTEM ${AVAHI_COMPAT_INCLUDE_DIRS}) |
204 |
+ set (CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};${AVAHI_COMPAT_INCLUDE_DIRS}") |
205 |
+-- |
206 |
+2.24.1 |
207 |
+ |