1 |
commit: 95d5a573165b47f9523ba43d9abc3cae5e116c48 |
2 |
Author: Jimi Huotari <chiitoo <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Mar 19 10:24:19 2023 +0000 |
4 |
Commit: Jimi Huotari <chiitoo <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Mar 19 10:24:19 2023 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=95d5a573 |
7 |
|
8 |
x11-wm/openbox: patch issue with >=glib-2.76.0 |
9 |
|
10 |
Bug: https://bugs.gentoo.org/901777 |
11 |
Signed-off-by: Jimi Huotari <chiitoo <AT> gentoo.org> |
12 |
|
13 |
x11-wm/openbox/files/openbox-3.6.1-glib-2.76.patch | 54 +++++++++ |
14 |
x11-wm/openbox/openbox-3.6.1-r5.ebuild | 123 +++++++++++++++++++++ |
15 |
2 files changed, 177 insertions(+) |
16 |
|
17 |
diff --git a/x11-wm/openbox/files/openbox-3.6.1-glib-2.76.patch b/x11-wm/openbox/files/openbox-3.6.1-glib-2.76.patch |
18 |
new file mode 100644 |
19 |
index 000000000000..65d0dba17300 |
20 |
--- /dev/null |
21 |
+++ b/x11-wm/openbox/files/openbox-3.6.1-glib-2.76.patch |
22 |
@@ -0,0 +1,54 @@ |
23 |
+Gentoo Bug: https://bugs.gentoo.org/901777 |
24 |
+Upstream Bug: https://bugzilla.icculus.org/show_bug.cgi?id=6669 |
25 |
+Upstream Commit: https://github.com/Mikachu/openbox/commit/9ed6fdd71890c5cc43747f105382d5677e5d37e7 |
26 |
+ |
27 |
+From 9ed6fdd71890c5cc43747f105382d5677e5d37e7 Mon Sep 17 00:00:00 2001 |
28 |
+From: pldubouilh <pldubouilh@×××××.com> |
29 |
+Date: Fri, 17 Mar 2023 18:23:47 +0100 |
30 |
+Subject: [PATCH] Fix list traversal issue in client_calc_layer |
31 |
+ |
32 |
+The calls to client_calc_layer_internal can modify stacking_list, which |
33 |
+can cause us to follow dangling ->next pointers (either by the pointer |
34 |
+itself already being freed, or it pointing to a freed area). Avoid this |
35 |
+by copying the list first, the goal is to visit every client in the list |
36 |
+once so this should be fine. |
37 |
+--- |
38 |
+ openbox/client.c | 9 +++++++-- |
39 |
+ 1 file changed, 7 insertions(+), 2 deletions(-) |
40 |
+ |
41 |
+diff --git a/openbox/client.c b/openbox/client.c |
42 |
+index 7168b2407..b8264587c 100644 |
43 |
+--- a/openbox/client.c |
44 |
++++ b/openbox/client.c |
45 |
+@@ -2742,9 +2742,12 @@ static void client_calc_layer_internal(ObClient *self) |
46 |
+ void client_calc_layer(ObClient *self) |
47 |
+ { |
48 |
+ GList *it; |
49 |
++ /* the client_calc_layer_internal calls below modify stacking_list, |
50 |
++ so we have to make a copy to iterate over */ |
51 |
++ GList *list = g_list_copy(stacking_list); |
52 |
+ |
53 |
+ /* skip over stuff above fullscreen layer */ |
54 |
+- for (it = stacking_list; it; it = g_list_next(it)) |
55 |
++ for (it = list; it; it = g_list_next(it)) |
56 |
+ if (window_layer(it->data) <= OB_STACKING_LAYER_FULLSCREEN) break; |
57 |
+ |
58 |
+ /* find the windows in the fullscreen layer, and mark them not-visited */ |
59 |
+@@ -2757,7 +2760,7 @@ void client_calc_layer(ObClient *self) |
60 |
+ client_calc_layer_internal(self); |
61 |
+ |
62 |
+ /* skip over stuff above fullscreen layer */ |
63 |
+- for (it = stacking_list; it; it = g_list_next(it)) |
64 |
++ for (it = list; it; it = g_list_next(it)) |
65 |
+ if (window_layer(it->data) <= OB_STACKING_LAYER_FULLSCREEN) break; |
66 |
+ |
67 |
+ /* now recalc any windows in the fullscreen layer which have not |
68 |
+@@ -2768,6 +2771,8 @@ void client_calc_layer(ObClient *self) |
69 |
+ !WINDOW_AS_CLIENT(it->data)->visited) |
70 |
+ client_calc_layer_internal(it->data); |
71 |
+ } |
72 |
++ |
73 |
++ g_list_free(it); |
74 |
+ } |
75 |
+ |
76 |
+ gboolean client_should_show(ObClient *self) |
77 |
|
78 |
diff --git a/x11-wm/openbox/openbox-3.6.1-r5.ebuild b/x11-wm/openbox/openbox-3.6.1-r5.ebuild |
79 |
new file mode 100644 |
80 |
index 000000000000..ebd2a5d8b75d |
81 |
--- /dev/null |
82 |
+++ b/x11-wm/openbox/openbox-3.6.1-r5.ebuild |
83 |
@@ -0,0 +1,123 @@ |
84 |
+# Copyright 1999-2023 Gentoo Authors |
85 |
+# Distributed under the terms of the GNU General Public License v2 |
86 |
+ |
87 |
+EAPI=8 |
88 |
+ |
89 |
+PYTHON_COMPAT=( python3_{9..11}) |
90 |
+inherit autotools python-single-r1 |
91 |
+ |
92 |
+DESCRIPTION="Standards compliant, fast, light-weight, extensible window manager" |
93 |
+HOMEPAGE="http://openbox.org/wiki/Main_Page" |
94 |
+ |
95 |
+if [[ ${PV} == *9999* ]]; then |
96 |
+ inherit git-r3 |
97 |
+ EGIT_REPO_URI="https://github.com/Mikachu/openbox.git" |
98 |
+else |
99 |
+ SRC_URI="http://openbox.org/dist/openbox/${P}.tar.gz" |
100 |
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86 ~x86-linux" |
101 |
+fi |
102 |
+ |
103 |
+SRC_URI+=" branding? ( https://dev.gentoo.org/~hwoarang/distfiles/surreal-gentoo.tar.gz )" |
104 |
+ |
105 |
+LICENSE="GPL-2" |
106 |
+SLOT="3" |
107 |
+IUSE="branding debug imlib nls session startup-notification svg xdg" |
108 |
+REQUIRED_USE="xdg? ( ${PYTHON_REQUIRED_USE} )" |
109 |
+ |
110 |
+BDEPEND=" |
111 |
+ sys-devel/gettext |
112 |
+ virtual/pkgconfig |
113 |
+" |
114 |
+RDEPEND=" |
115 |
+ dev-libs/glib:2 |
116 |
+ >=dev-libs/libxml2-2.0 |
117 |
+ >=media-libs/fontconfig-2 |
118 |
+ x11-libs/cairo |
119 |
+ x11-libs/libXau |
120 |
+ x11-libs/libXcursor |
121 |
+ x11-libs/libXext |
122 |
+ x11-libs/libXft |
123 |
+ x11-libs/libXinerama |
124 |
+ x11-libs/libXrandr |
125 |
+ x11-libs/libXt |
126 |
+ >=x11-libs/pango-1.8[X] |
127 |
+ imlib? ( media-libs/imlib2 ) |
128 |
+ startup-notification? ( >=x11-libs/startup-notification-0.8 ) |
129 |
+ svg? ( gnome-base/librsvg:2 ) |
130 |
+ xdg? ( |
131 |
+ ${PYTHON_DEPS} |
132 |
+ $(python_gen_cond_dep ' |
133 |
+ dev-python/pyxdg[${PYTHON_USEDEP}] |
134 |
+ ') |
135 |
+ ) |
136 |
+" |
137 |
+DEPEND="${RDEPEND} |
138 |
+ x11-base/xorg-proto |
139 |
+" |
140 |
+ |
141 |
+PATCHES=( |
142 |
+ "${FILESDIR}/${PN}-3.5.2-gnome-session.patch" |
143 |
+ # see https://github.com/danakj/openbox/pull/35 |
144 |
+ "${FILESDIR}/${PN}-3.6.1-py3-xdg.patch" |
145 |
+ # https://bugs.gentoo.org/827227 |
146 |
+ "${FILESDIR}/${PN}-3.6.1-getgrent-to-getgroups.patch" |
147 |
+ # https://bugs.gentoo.org/901777 |
148 |
+ "${FILESDIR}/${PN}-3.6.1-glib-2.76.patch" |
149 |
+) |
150 |
+ |
151 |
+pkg_setup() { |
152 |
+ use xdg && python-single-r1_pkg_setup |
153 |
+} |
154 |
+ |
155 |
+src_unpack() { |
156 |
+ if [[ ${PV} == *9999* ]]; then |
157 |
+ git-r3_src_unpack |
158 |
+ fi |
159 |
+ |
160 |
+ default |
161 |
+} |
162 |
+ |
163 |
+src_prepare() { |
164 |
+ default |
165 |
+ sed -i \ |
166 |
+ -e "s:-O0 -ggdb ::" \ |
167 |
+ -e 's/-fno-strict-aliasing//' \ |
168 |
+ m4/openbox.m4 || die |
169 |
+ eautoreconf |
170 |
+} |
171 |
+ |
172 |
+src_configure() { |
173 |
+ local myeconfargs=( |
174 |
+ --disable-static |
175 |
+ --with-x |
176 |
+ $(use_enable debug) |
177 |
+ $(use_enable imlib imlib2) |
178 |
+ $(use_enable nls) |
179 |
+ $(use_enable session session-management) |
180 |
+ $(use_enable startup-notification) |
181 |
+ $(use_enable svg librsvg) |
182 |
+ ) |
183 |
+ econf "${myeconfargs[@]}" |
184 |
+} |
185 |
+ |
186 |
+src_install() { |
187 |
+ dodir /etc/X11/Sessions |
188 |
+ echo "/usr/bin/openbox-session" > "${ED}/etc/X11/Sessions/${PN}" |
189 |
+ fperms a+x /etc/X11/Sessions/${PN} |
190 |
+ emake DESTDIR="${D}" install |
191 |
+ if use branding; then |
192 |
+ insinto /usr/share/themes |
193 |
+ doins -r "${WORKDIR}"/Surreal_Gentoo |
194 |
+ # make it the default theme |
195 |
+ sed -i \ |
196 |
+ -e "/<theme>/{n; s@<name>.*</name>@<name>Surreal_Gentoo</name>@}" \ |
197 |
+ "${D}"/etc/xdg/openbox/rc.xml \ |
198 |
+ || die "failed to set Surreal Gentoo as the default theme" |
199 |
+ fi |
200 |
+ find "${ED}" -name '*.la' -delete || die |
201 |
+ if use xdg ; then |
202 |
+ python_fix_shebang "${ED}"/usr/libexec/openbox-xdg-autostart |
203 |
+ else |
204 |
+ rm "${ED}"/usr/libexec/openbox-xdg-autostart || die |
205 |
+ fi |
206 |
+} |