Re: x11/openbox broken with 7.4 upgrade

2023-10-21 Thread Benoit Lecocq




On 18/10/2023 10:57, Stuart Henderson wrote:

On 2023/10/17 23:07, Ghislain Mercier wrote:

Hello,

With yesterday's upgrade from 7.3 to 7.4, and more specifically with
glib2 upgrading from 2.74.6 to 2.76.6, Openbox crashes when switching
out of a fullscreen window (tested on 7.4 GENERIC.MP#1397 amd64).

It appears to be a known bug, see
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1033385

I quote :

This bug has been reported upstream at
https://bugzilla.icculus.org/show_bug.cgi?id=6669.

The following patch is provided to fix the bug, and has been accepted
into a developer's work branch here:
http://git.openbox.org/?p=mikachu/openbox.git;a=commit;h=d41128e5a1002af41c976c8860f8299cfcd3cd72


I would be happy to provide a diff for the port but I have absolutely no
idea of how to do that... Of course, if one of the kind developers had
time to provide some guidance I could learn and try.

Thanks in advance !

GM.



CC'ing maintainer.

Not tested yet but I think this should do the trick.
If it works it would make sense to commit to 7.4-stable too.


ok benoit@



Index: Makefile
===
RCS file: /cvs/ports/x11/openbox/Makefile,v
retrieving revision 1.91
diff -u -p -r1.91 Makefile
--- Makefile27 Sep 2023 20:37:19 -  1.91
+++ Makefile18 Oct 2023 08:54:50 -
@@ -1,7 +1,7 @@
  COMMENT = small, fast & usable window manager
  
  V =		3.6.1

-REVISION = 11
+REVISION = 12
  DISTNAME =openbox-${V}
  SHARED_LIBS +=obrender12.0# 32.0
  SHARED_LIBS +=obt 1.1 # 2.2
Index: patches/patch-openbox_client_c
===
RCS file: /cvs/ports/x11/openbox/patches/patch-openbox_client_c,v
retrieving revision 1.4
diff -u -p -r1.4 patch-openbox_client_c
--- patches/patch-openbox_client_c  11 Mar 2022 20:16:51 -  1.4
+++ patches/patch-openbox_client_c  18 Oct 2023 08:54:50 -
@@ -1,8 +1,25 @@
+First hunk, in client_get_settings_state():
+
  Fix a NULL pointer dereference that was causing a crash when launching
  Java GUI applications.
  From https://bugzilla.icculus.org/show_bug.cgi?id=5277 via Arch
  Linux.
  
+

+Others, in client_calc_layer():
+
+From d41128e5a1002af41c976c8860f8299cfcd3cd72 Mon Sep 17 00:00:00 2001
+From: pldubouilh 
+Date: Fri, 17 Mar 2023 18:23:47 +0100
+Subject: [PATCH] Fix list traversal issue in client_calc_layer
+
+The calls to client_calc_layer_internal can modify stacking_list, which
+can cause us to follow dangling ->next pointers (either by the pointer
+itself already being freed, or it pointing to a freed area). Avoid this
+by copying the list first, the goal is to visit every client in the list
+once so this should be fine.
+
+
  Index: openbox/client.c
  --- openbox/client.c.orig
  +++ openbox/client.c
@@ -15,3 +32,35 @@ Index: openbox/client.c
!g_pattern_match(app->title,
 strlen(self->title), self->title, NULL))
   match = FALSE;
+@@ -2702,9 +2702,12 @@ static void client_calc_layer_internal(ObClient *self)
+ void client_calc_layer(ObClient *self)
+ {
+ GList *it;
++/* the client_calc_layer_internal calls below modify stacking_list,
++   so we have to make a copy to iterate over */
++GList *list = g_list_copy(stacking_list);
+
+ /* skip over stuff above fullscreen layer */
+-for (it = stacking_list; it; it = g_list_next(it))
++for (it = list; it; it = g_list_next(it))
+ if (window_layer(it->data) <= OB_STACKING_LAYER_FULLSCREEN) break;
+
+ /* find the windows in the fullscreen layer, and mark them not-visited */
+@@ -2717,7 +2720,7 @@ void client_calc_layer(ObClient *self)
+ client_calc_layer_internal(self);
+
+ /* skip over stuff above fullscreen layer */
+-for (it = stacking_list; it; it = g_list_next(it))
++for (it = list; it; it = g_list_next(it))
+ if (window_layer(it->data) <= OB_STACKING_LAYER_FULLSCREEN) break;
+
+ /* now recalc any windows in the fullscreen layer which have not
+@@ -2728,6 +2731,8 @@ void client_calc_layer(ObClient *self)
+  !WINDOW_AS_CLIENT(it->data)->visited)
+ client_calc_layer_internal(it->data);
+ }
++
++g_list_free(it);
+ }
+
+ gboolean client_should_show(ObClient *self)





Re: x11/openbox broken with 7.4 upgrade

2023-10-20 Thread Ghislain Mercier
On 2023-10-18 at 12:50, dco...@gmail.com wrote :
> The fix for this specific problem is ok, but here's a patch incorporating
> all the relevant bugfixes from the Debian package:

Many thanks to both of you. I just tested David's patch : no more crashes !



Re: x11/openbox broken with 7.4 upgrade

2023-10-18 Thread David Coppa
On Wed, 18 Oct 2023, Stuart Henderson wrote:
> CC'ing maintainer.
> 
> Not tested yet but I think this should do the trick.
> If it works it would make sense to commit to 7.4-stable too.

Hi Stuart, hi all

I'm an Openbox user myself.
The fix for this specific problem is ok, but here's a patch incorporating
all the relevant bugfixes from the Debian package:

Index: x11/openbox/Makefile
===
RCS file: /cvs/ports/x11/openbox/Makefile,v
retrieving revision 1.91
diff -u -p -u -p -r1.91 Makefile
--- x11/openbox/Makefile27 Sep 2023 20:37:19 -  1.91
+++ x11/openbox/Makefile18 Oct 2023 08:54:58 -
@@ -1,7 +1,7 @@
 COMMENT =  small, fast & usable window manager
 
 V =3.6.1
-REVISION = 11
+REVISION = 12
 DISTNAME = openbox-${V}
 SHARED_LIBS += obrender12.0# 32.0
 SHARED_LIBS += obt 1.1 # 2.2
@@ -15,7 +15,7 @@ MAINTAINER =  Benoit Lecocq https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=719620
+
+Index: configure
+--- configure.orig
 configure
+@@ -14647,12 +14647,12 @@ if test -n "$LIBSN_CFLAGS"; then
+ pkg_cv_LIBSN_CFLAGS="$LIBSN_CFLAGS"
+  elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+-{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists 
--print-errors \"libstartup-notification-1.0 >= 0.8\""; } >&5
+-  ($PKG_CONFIG --exists --print-errors "libstartup-notification-1.0 >= 0.8") 
2>&5
++{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists 
--print-errors \"libstartup-notification-1.0 >= 0.8 xi\""; } >&5
++  ($PKG_CONFIG --exists --print-errors "libstartup-notification-1.0 >= 0.8 
xi") 2>&5
+   ac_status=$?
+   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+   test $ac_status = 0; }; then
+-  pkg_cv_LIBSN_CFLAGS=`$PKG_CONFIG --cflags "libstartup-notification-1.0 >= 
0.8" 2>/dev/null`
++  pkg_cv_LIBSN_CFLAGS=`$PKG_CONFIG --cflags "libstartup-notification-1.0 >= 
0.8 xi" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes
+ else
+   pkg_failed=yes
+@@ -14664,12 +14664,12 @@ if test -n "$LIBSN_LIBS"; then
+ pkg_cv_LIBSN_LIBS="$LIBSN_LIBS"
+  elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+-{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists 
--print-errors \"libstartup-notification-1.0 >= 0.8\""; } >&5
+-  ($PKG_CONFIG --exists --print-errors "libstartup-notification-1.0 >= 0.8") 
2>&5
++{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists 
--print-errors \"libstartup-notification-1.0 >= 0.8 xi\""; } >&5
++  ($PKG_CONFIG --exists --print-errors "libstartup-notification-1.0 >= 0.8 
xi") 2>&5
+   ac_status=$?
+   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+   test $ac_status = 0; }; then
+-  pkg_cv_LIBSN_LIBS=`$PKG_CONFIG --libs "libstartup-notification-1.0 >= 0.8" 
2>/dev/null`
++  pkg_cv_LIBSN_LIBS=`$PKG_CONFIG --libs "libstartup-notification-1.0 >= 0.8 
xi" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes
+ else
+   pkg_failed=yes
+@@ -14690,9 +14690,9 @@ else
+ _pkg_short_errors_supported=no
+ fi
+ if test $_pkg_short_errors_supported = yes; then
+-  LIBSN_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors 
--cflags --libs "libstartup-notification-1.0 >= 0.8" 2>&1`
++  LIBSN_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors 
--cflags --libs "libstartup-notification-1.0 >= 0.8 xi" 2>&1`
+ else
+-  LIBSN_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs 
"libstartup-notification-1.0 >= 0.8" 2>&1`
++  LIBSN_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs 
"libstartup-notification-1.0 >= 0.8 xi" 2>&1`
+ fi
+   # Put the nasty error message in config.log where it belongs
+   echo "$LIBSN_PKG_ERRORS" >&5
Index: x11/openbox/patches/patch-obrender_theme_c
===
RCS file: x11/openbox/patches/patch-obrender_theme_c
diff -N x11/openbox/patches/patch-obrender_theme_c
--- /dev/null   1 Jan 1970 00:00:00 -
+++ x11/openbox/patches/patch-obrender_theme_c  18 Oct 2023 08:54:58 -
@@ -0,0 +1,33 @@
+Fix for toggled hover and pressed images masks not loaded.
+Toggled hover and pressed images masks in Openbox themes are not loaded
+which broke many existing themes.
+Debian bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=887908
+
+Index: obrender/theme.c
+--- obrender/theme.c.orig
 obrender/theme.c
+@@ -1494,8 +1494,10 @@ static void read_button_styles(XrmDatabase db, const R
+ READ_BUTTON_MASK_COPY(disabled, btn->unpressed_mask);
+ READ_BUTTON_MASK_COPY(hover, btn->unpressed_mask);
+ if (toggled_mask) {
+-READ_BUTTON_MASK_COPY(pressed_toggled, btn->unpressed_toggled_mask);
+-READ_BUTTON_MASK_COPY(hover_toggled, btn->unpressed_toggled_mask);
++g_snprintf(name, 128, 

Re: x11/openbox broken with 7.4 upgrade

2023-10-18 Thread Stuart Henderson
On 2023/10/17 23:07, Ghislain Mercier wrote:
> Hello,
> 
> With yesterday's upgrade from 7.3 to 7.4, and more specifically with
> glib2 upgrading from 2.74.6 to 2.76.6, Openbox crashes when switching
> out of a fullscreen window (tested on 7.4 GENERIC.MP#1397 amd64).
> 
> It appears to be a known bug, see
> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1033385
> 
> I quote : 
> > This bug has been reported upstream at
> > https://bugzilla.icculus.org/show_bug.cgi?id=6669. 
> >
> > The following patch is provided to fix the bug, and has been accepted
> > into a developer's work branch here: 
> > http://git.openbox.org/?p=mikachu/openbox.git;a=commit;h=d41128e5a1002af41c976c8860f8299cfcd3cd72
> 
> I would be happy to provide a diff for the port but I have absolutely no
> idea of how to do that... Of course, if one of the kind developers had 
> time to provide some guidance I could learn and try.
> 
> Thanks in advance !
> 
> GM.
> 

CC'ing maintainer.

Not tested yet but I think this should do the trick.
If it works it would make sense to commit to 7.4-stable too.

Index: Makefile
===
RCS file: /cvs/ports/x11/openbox/Makefile,v
retrieving revision 1.91
diff -u -p -r1.91 Makefile
--- Makefile27 Sep 2023 20:37:19 -  1.91
+++ Makefile18 Oct 2023 08:54:50 -
@@ -1,7 +1,7 @@
 COMMENT =  small, fast & usable window manager
 
 V =3.6.1
-REVISION = 11
+REVISION = 12
 DISTNAME = openbox-${V}
 SHARED_LIBS += obrender12.0# 32.0
 SHARED_LIBS += obt 1.1 # 2.2
Index: patches/patch-openbox_client_c
===
RCS file: /cvs/ports/x11/openbox/patches/patch-openbox_client_c,v
retrieving revision 1.4
diff -u -p -r1.4 patch-openbox_client_c
--- patches/patch-openbox_client_c  11 Mar 2022 20:16:51 -  1.4
+++ patches/patch-openbox_client_c  18 Oct 2023 08:54:50 -
@@ -1,8 +1,25 @@
+First hunk, in client_get_settings_state():
+
 Fix a NULL pointer dereference that was causing a crash when launching
 Java GUI applications.
 From https://bugzilla.icculus.org/show_bug.cgi?id=5277 via Arch
 Linux.
 
+
+Others, in client_calc_layer():
+
+From d41128e5a1002af41c976c8860f8299cfcd3cd72 Mon Sep 17 00:00:00 2001
+From: pldubouilh 
+Date: Fri, 17 Mar 2023 18:23:47 +0100
+Subject: [PATCH] Fix list traversal issue in client_calc_layer
+
+The calls to client_calc_layer_internal can modify stacking_list, which
+can cause us to follow dangling ->next pointers (either by the pointer
+itself already being freed, or it pointing to a freed area). Avoid this
+by copying the list first, the goal is to visit every client in the list
+once so this should be fine.
+
+
 Index: openbox/client.c
 --- openbox/client.c.orig
 +++ openbox/client.c
@@ -15,3 +32,35 @@ Index: openbox/client.c
   !g_pattern_match(app->title,
strlen(self->title), self->title, NULL))
  match = FALSE;
+@@ -2702,9 +2702,12 @@ static void client_calc_layer_internal(ObClient *self)
+ void client_calc_layer(ObClient *self)
+ {
+ GList *it;
++/* the client_calc_layer_internal calls below modify stacking_list,
++   so we have to make a copy to iterate over */
++GList *list = g_list_copy(stacking_list);
+ 
+ /* skip over stuff above fullscreen layer */
+-for (it = stacking_list; it; it = g_list_next(it))
++for (it = list; it; it = g_list_next(it))
+ if (window_layer(it->data) <= OB_STACKING_LAYER_FULLSCREEN) break;
+ 
+ /* find the windows in the fullscreen layer, and mark them not-visited */
+@@ -2717,7 +2720,7 @@ void client_calc_layer(ObClient *self)
+ client_calc_layer_internal(self);
+ 
+ /* skip over stuff above fullscreen layer */
+-for (it = stacking_list; it; it = g_list_next(it))
++for (it = list; it; it = g_list_next(it))
+ if (window_layer(it->data) <= OB_STACKING_LAYER_FULLSCREEN) break;
+ 
+ /* now recalc any windows in the fullscreen layer which have not
+@@ -2728,6 +2731,8 @@ void client_calc_layer(ObClient *self)
+  !WINDOW_AS_CLIENT(it->data)->visited)
+ client_calc_layer_internal(it->data);
+ }
++
++g_list_free(it);
+ }
+ 
+ gboolean client_should_show(ObClient *self)



x11/openbox broken with 7.4 upgrade

2023-10-17 Thread Ghislain Mercier
Hello,

With yesterday's upgrade from 7.3 to 7.4, and more specifically with
glib2 upgrading from 2.74.6 to 2.76.6, Openbox crashes when switching
out of a fullscreen window (tested on 7.4 GENERIC.MP#1397 amd64).

It appears to be a known bug, see
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1033385

I quote : 
> This bug has been reported upstream at
> https://bugzilla.icculus.org/show_bug.cgi?id=6669. 
>
> The following patch is provided to fix the bug, and has been accepted
> into a developer's work branch here: 
> http://git.openbox.org/?p=mikachu/openbox.git;a=commit;h=d41128e5a1002af41c976c8860f8299cfcd3cd72

I would be happy to provide a diff for the port but I have absolutely no
idea of how to do that... Of course, if one of the kind developers had 
time to provide some guidance I could learn and try.

Thanks in advance !

GM.