On Wed 20/10/2021 00:02, Rubén Llorente wrote:
> Hi there,
> 
> This is a bug report against x11/fluxbox
> 
> I have noticed that fluxbox has a tendency to segfault and dump a
> core in my $HOME when the X server is manually turned off.
> 
> If you use xenodm to launch fluxbox and then turn it off (eihter
> by issuing # rcctl stop xenodm or by hitting Ctrl + Alt +
> Backspace) then fluxbox receives a termination signal and 
> segfaults.
> 
> I am not a code guru, but a quick look at the fluxbox code
> shows fluxbox calls a shutdown function upon receiving typical
> signals.
> 
> I have reproduced this bug on multiple installs (7.0 amd64). It
> is not critical by any means (the program crashes on exit) but it
> is ugly as heck. 
> 
> Anybody wants to take this bug?

After building with DEBUG=-g:

(gdb) bt
#0  thrkill () at /tmp/-:3
#1  0x00000f57fee6788e in _libc_abort () at /usr/src/lib/libc/stdlib/abort.c:51
#2  0x00000f55503a487f in (anonymous namespace)::handleSignal (signum=11) at 
src/main.cc:98
#3  <signal handler called>
#4  0x00000f55503d6cb2 in std::__1::less<unsigned long>::operator() 
(this=<optimized out>, __x=<optimized out>, __y=<optimized out>)
    at /usr/include/c++/v1/__functional_base:54
#5  std::__1::__map_value_compare<unsigned long, 
std::__1::__value_type<unsigned long, FbTk::EventHandler*>, 
std::__1::less<unsigned long>, true>::operator() (
    this=<optimized out>, __x=..., __y=<optimized out>) at 
/usr/include/c++/v1/map:518
#6  std::__1::__tree<std::__1::__value_type<unsigned long, 
FbTk::EventHandler*>, std::__1::__map_value_compare<unsigned long, 
std::__1::__value_type<unsigned long, FbTk::EventHandler*>, 
std::__1::less<unsigned long>, true>, 
std::__1::allocator<std::__1::__value_type<unsigned long, FbTk::EventHandler*> 
> >::__lower_bound<unsigned long> (
    this=0xf555041e040 <FbTk::EventManager::instance()::ev>, __v=<optimized 
out>, __root=0xdfdfdfdfdfdfdfdf, __result=0xf5832ca9cc0) at 
/usr/include/c++/v1/__tree:2637
#7  std::__1::__tree<std::__1::__value_type<unsigned long, 
FbTk::EventHandler*>, std::__1::__map_value_compare<unsigned long, 
std::__1::__value_type<unsigned long, FbTk::EventHandler*>, 
std::__1::less<unsigned long>, true>, 
std::__1::allocator<std::__1::__value_type<unsigned long, FbTk::EventHandler*> 
> >::find<unsigned long> (
    this=0xf555041e040 <FbTk::EventManager::instance()::ev>, __v=<optimized 
out>) at /usr/include/c++/v1/__tree:2566
#8  std::__1::__tree<std::__1::__value_type<unsigned long, 
FbTk::EventHandler*>, std::__1::__map_value_compare<unsigned long, 
std::__1::__value_type<unsigned long, FbTk::EventHandler*>, 
std::__1::less<unsigned long>, true>, 
std::__1::allocator<std::__1::__value_type<unsigned long, FbTk::EventHandler*> 
> >::__erase_unique<unsigned long> (
    this=0xf555041e040 <FbTk::EventManager::instance()::ev>, __k=<optimized 
out>) at /usr/include/c++/v1/__tree:2542
#9  std::__1::map<unsigned long, FbTk::EventHandler*, std::__1::less<unsigned 
long>, std::__1::allocator<std::__1::pair<unsigned long const, 
FbTk::EventHandler*> > >::erase (this=0xf555041e040 
<FbTk::EventManager::instance()::ev>, __k=<optimized out>) at 
/usr/include/c++/v1/map:1306
#10 FbTk::EventManager::unregisterEventHandler (this=0xf555041e040 
<FbTk::EventManager::instance()::ev>, win=<optimized out>) at 
src/FbTk/EventManager.cc:137
#11 0x00000f55503caf24 in Toolbar::~Toolbar (this=0xf577bde5000) at 
src/Toolbar.cc:277
#12 0x00000f55503cb51f in Toolbar::~Toolbar (this=0xf577bde5000) at 
src/Toolbar.cc:271
#13 0x00000f555036e592 in std::__1::auto_ptr<Toolbar>::reset 
(this=0xf5832cd3530, __p=<error reading variable: Cannot access memory at 
address 0x0>)
    at /usr/include/c++/v1/memory:2061
#14 BScreen::~BScreen (this=0xf5832cd3260) at src/Screen.cc:394
#15 0x00000f555036f2df in BScreen::~BScreen (this=0xf5832cd3260) at 
src/Screen.cc:389
#16 0x00000f555039d71e in 
FbTk::STLUtil::destroyAndClear<std::__1::list<BScreen*, 
std::__1::allocator<BScreen*> > > (a=...) at ./src/FbTk/STLUtil.hh:55
#17 Fluxbox::~Fluxbox (this=0xf5782386710) at src/fluxbox.cc:482
#18 0x00000f555039da6f in Fluxbox::~Fluxbox (this=0xf5782386710) at 
src/fluxbox.cc:473
#19 0x00000f57fee3a213 in _libc___cxa_finalize (dso=<optimized out>) at 
/usr/src/lib/libc/stdlib/atexit.c:177
#20 0x00000f57fedd17d1 in _libc_exit (status=1) at 
/usr/src/lib/libc/stdlib/exit.c:54
#21 0x00000f555039c941 in (anonymous namespace)::handleXIOErrors (d=<error 
reading variable: Unhandled dwarf expression opcode 0xa3>) at src/fluxbox.cc:165
#22 0x00000f57568ec7ca in _XIOError () from /usr/X11R6/lib/libX11.so.17.1
#23 0x00000f57568e9755 in _XEventsQueued () from /usr/X11R6/lib/libX11.so.17.1
#24 0x00000f57568d94d9 in XPending () from /usr/X11R6/lib/libX11.so.17.1
#25 0x00000f555039dfd8 in Fluxbox::eventLoop (this=0xf5782386710) at 
src/fluxbox.cc:528
#26 0x00000f55503a39a6 in main (argc=<optimized out>, argv=0x7f7ffffc56c8) at 
src/main.cc:211
(gdb) f 2
#2  0x00000f55503a487f in (anonymous namespace)::handleSignal (signum=11) at 
src/main.cc:98
98              abort();


Look what happens here:

97    case SIGSEGV:
98        abort();
99        break;


>From abort():

The abort() function causes abnormal program termination to occur,
unless the signal SIGABRT is being caught and the signal handler does
not return.


Diff below seems to do the job. Could you check?


diff --git Makefile Makefile
index ddb1a0df8ca..72168cbc2e3 100644
--- Makefile
+++ Makefile
@@ -3,7 +3,7 @@
 COMMENT =      window manager based on the original Blackbox code
 DISTNAME =     fluxbox-1.3.7
 CATEGORIES =   x11
-REVISION =     4
+REVISION =     5
 
 HOMEPAGE =     http://fluxbox.org/
 
diff --git patches/patch-src_main_cc patches/patch-src_main_cc
new file mode 100644
index 00000000000..fd89475a181
--- /dev/null
+++ patches/patch-src_main_cc
@@ -0,0 +1,14 @@
+$OpenBSD$
+
+Index: src/main.cc
+--- src/main.cc.orig
++++ src/main.cc
+@@ -95,7 +95,7 @@ void handleSignal(int signum) {
+         break;
+ #endif
+     case SIGSEGV:
+-        abort();
++        exit(0);
+         break;
+     case SIGALRM:
+         // last resort for shutting down fluxbox. the alarm() is set in

Reply via email to