Run finch in tmux and resize the window. Segfault will occur. This is "new" behavior after the update from 6 months ago. Prior to that, there was no issue. I am trying out UTF-8 things as well and that seems to be related, but I'm unsure of what changes make this problem manifest (is it LANG settings on my host running tmux/finch or the LANG settings on my laptop that I use to ssh into my host).
$ gdb /usr/local/bin/finch finch.core GNU gdb 6.1.1 [FreeBSD] Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "amd64-marcel-freebsd"...(no debugging symbols found)... Core was generated by `finch'. Program terminated with signal 11, Segmentation fault. Reading symbols from /usr/local/lib/libdbus-glib-1.so.2...(no debugging symbols found)...done. Loaded symbols for /usr/local/lib/libdbus-glib-1.so.2 Reading symbols from /usr/local/lib/libdbus-1.so.3...(no debugging symbols found)...done. Loaded symbols for /usr/local/lib/libdbus-1.so.3 Reading symbols from /lib/libncursesw.so.8...(no debugging symbols found)...done. Loaded symbols for /lib/libncursesw.so.8 Reading symbols from /usr/lib/libpanelw.so.5...(no debugging symbols found)...done. Loaded symbols for /usr/lib/libpanelw.so.5 Reading symbols from /usr/local/lib/libgstreamer-0.10.so.0...done. Loaded symbols for /usr/local/lib/libgstreamer-0.10.so.0 Reading symbols from /usr/local/lib/libgobject-2.0.so.0...done. Loaded symbols for /usr/local/lib/libgobject-2.0.so.0 Reading symbols from /usr/local/lib/libgmodule-2.0.so.0...done. Loaded symbols for /usr/local/lib/libgmodule-2.0.so.0 Reading symbols from /usr/local/lib/libgthread-2.0.so.0...done. Loaded symbols for /usr/local/lib/libgthread-2.0.so.0 Reading symbols from /usr/local/lib/libglib-2.0.so.0...done. Loaded symbols for /usr/local/lib/libglib-2.0.so.0 Reading symbols from /usr/local/lib/libintl.so.8...done. Loaded symbols for /usr/local/lib/libintl.so.8 Reading symbols from /usr/local/lib/libxml2.so.2...done. Loaded symbols for /usr/local/lib/libxml2.so.2 Reading symbols from /usr/local/lib/libgnt.so.0...done. Loaded symbols for /usr/local/lib/libgnt.so.0 Reading symbols from /usr/local/lib/libpurple.so.0...done. Loaded symbols for /usr/local/lib/libpurple.so.0 Reading symbols from /lib/libm.so.5...done. Loaded symbols for /lib/libm.so.5 Reading symbols from /lib/libthr.so.3...done. Loaded symbols for /lib/libthr.so.3 Reading symbols from /lib/libc.so.7...done. Loaded symbols for /lib/libc.so.7 Reading symbols from /usr/local/lib/libgio-2.0.so.0...done. Loaded symbols for /usr/local/lib/libgio-2.0.so.0 Reading symbols from /usr/local/lib/libiconv.so.2...done. Loaded symbols for /usr/local/lib/libiconv.so.2 Reading symbols from /usr/local/lib/libpcre.so.1...done. Loaded symbols for /usr/local/lib/libpcre.so.1 Reading symbols from /usr/local/lib/libffi.so.6...done. Loaded symbols for /usr/local/lib/libffi.so.6 Reading symbols from /lib/libutil.so.9...done. Loaded symbols for /lib/libutil.so.9 Reading symbols from /usr/local/lib/libpython2.7.so.1...done. Loaded symbols for /usr/local/lib/libpython2.7.so.1 Reading symbols from /usr/local/lib/libgstfarsight-0.10.so.0...done. Loaded symbols for /usr/local/lib/libgstfarsight-0.10.so.0 Reading symbols from /usr/local/lib/libgstbase-0.10.so.0...done. Loaded symbols for /usr/local/lib/libgstbase-0.10.so.0 Reading symbols from /usr/local/lib/libgstinterfaces-0.10.so.0...done. Loaded symbols for /usr/local/lib/libgstinterfaces-0.10.so.0 Reading symbols from /usr/local/lib/libidn.so.11...done. Loaded symbols for /usr/local/lib/libidn.so.11 Reading symbols from /usr/local/lib/finch/gntclipboard.so...done. Loaded symbols for /usr/local/lib/finch/gntclipboard.so Reading symbols from /usr/local/lib/finch/gntgf.so...done. Loaded symbols for /usr/local/lib/finch/gntgf.so Reading symbols from /usr/local/lib/finch/gnthistory.so...done. Loaded symbols for /usr/local/lib/finch/gnthistory.so Reading symbols from /usr/local/lib/finch/gntlastlog.so...done. Loaded symbols for /usr/local/lib/finch/gntlastlog.so Reading symbols from /usr/local/lib/finch/gnttinyurl.so...done. Loaded symbols for /usr/local/lib/finch/gnttinyurl.so Reading symbols from /usr/local/lib/finch/grouping.so...done. Loaded symbols for /usr/local/lib/finch/grouping.so Reading symbols from /usr/local/lib/purple-2/autoaccept.so...done. Loaded symbols for /usr/local/lib/purple-2/autoaccept.so Reading symbols from /usr/local/lib/purple-2/buddynote.so...done. Loaded symbols for /usr/local/lib/purple-2/buddynote.so Reading symbols from /usr/local/lib/purple-2/dbus-example.so...done. Loaded symbols for /usr/local/lib/purple-2/dbus-example.so Reading symbols from /usr/local/lib/purple-2/idle.so...done. Loaded symbols for /usr/local/lib/purple-2/idle.so Reading symbols from /usr/local/lib/purple-2/joinpart.so...done. Loaded symbols for /usr/local/lib/purple-2/joinpart.so Reading symbols from /usr/local/lib/purple-2/libaim.so...done. Loaded symbols for /usr/local/lib/purple-2/libaim.so Reading symbols from /usr/local/lib/purple-2/liboscar.so.0...done. Loaded symbols for /usr/local/lib/purple-2/liboscar.so.0 Reading symbols from /usr/local/lib/purple-2/libicq.so...done. Loaded symbols for /usr/local/lib/purple-2/libicq.so Reading symbols from /usr/local/lib/purple-2/libbonjour.so...done. Loaded symbols for /usr/local/lib/purple-2/libbonjour.so Reading symbols from /usr/local/lib/libavahi-common.so.3...done. Loaded symbols for /usr/local/lib/libavahi-common.so.3 Reading symbols from /usr/local/lib/libavahi-client.so.3...done. Loaded symbols for /usr/local/lib/libavahi-client.so.3 Reading symbols from /usr/local/lib/libavahi-glib.so.1...done. Loaded symbols for /usr/local/lib/libavahi-glib.so.1 Reading symbols from /usr/local/lib/purple-2/libgg.so...done. Loaded symbols for /usr/local/lib/purple-2/libgg.so Reading symbols from /usr/local/lib/purple-2/libirc.so...done. Loaded symbols for /usr/local/lib/purple-2/libirc.so Reading symbols from /usr/local/lib/purple-2/libmsn.so...done. Loaded symbols for /usr/local/lib/purple-2/libmsn.so Reading symbols from /usr/local/lib/purple-2/libmyspace.so...done. Loaded symbols for /usr/local/lib/purple-2/libmyspace.so Reading symbols from /usr/local/lib/purple-2/libnovell.so...done. Loaded symbols for /usr/local/lib/purple-2/libnovell.so Reading symbols from /usr/local/lib/purple-2/libsimple.so...done. Loaded symbols for /usr/local/lib/purple-2/libsimple.so Reading symbols from /usr/local/lib/purple-2/libxmpp.so...done. Loaded symbols for /usr/local/lib/purple-2/libxmpp.so Reading symbols from /usr/local/lib/purple-2/libjabber.so.0...done. Loaded symbols for /usr/local/lib/purple-2/libjabber.so.0 Reading symbols from /usr/local/lib/purple-2/libyahoo.so...done. Loaded symbols for /usr/local/lib/purple-2/libyahoo.so Reading symbols from /usr/local/lib/purple-2/libymsg.so.0...done. Loaded symbols for /usr/local/lib/purple-2/libymsg.so.0 Reading symbols from /usr/local/lib/purple-2/libyahoojp.so...done. Loaded symbols for /usr/local/lib/purple-2/libyahoojp.so Reading symbols from /usr/local/lib/purple-2/libzephyr.so...done. Loaded symbols for /usr/local/lib/purple-2/libzephyr.so Reading symbols from /usr/local/lib/purple-2/log_reader.so...done. Loaded symbols for /usr/local/lib/purple-2/log_reader.so Reading symbols from /usr/local/lib/purple-2/newline.so...done. Loaded symbols for /usr/local/lib/purple-2/newline.so Reading symbols from /usr/local/lib/purple-2/offlinemsg.so...done. Loaded symbols for /usr/local/lib/purple-2/offlinemsg.so Reading symbols from /usr/local/lib/purple-2/psychic.so...done. Loaded symbols for /usr/local/lib/purple-2/psychic.so Reading symbols from /usr/local/lib/purple-2/ssl-nss.so...done. Loaded symbols for /usr/local/lib/purple-2/ssl-nss.so Reading symbols from /usr/local/lib/libplc4.so.1...done. Loaded symbols for /usr/local/lib/libplc4.so.1 Reading symbols from /usr/local/lib/libplds4.so.1...done. Loaded symbols for /usr/local/lib/libplds4.so.1 Reading symbols from /usr/local/lib/libnspr4.so.1...done. Loaded symbols for /usr/local/lib/libnspr4.so.1 Reading symbols from /usr/local/lib/nss/libssl3.so.1...done. Loaded symbols for /usr/local/lib/nss/libssl3.so.1 Reading symbols from /usr/local/lib/nss/libsmime3.so.1...done. Loaded symbols for /usr/local/lib/nss/libsmime3.so.1 Reading symbols from /usr/local/lib/nss/libnss3.so.1...done. Loaded symbols for /usr/local/lib/nss/libnss3.so.1 Reading symbols from /usr/local/lib/nss/libsoftokn3.so.1...done. Loaded symbols for /usr/local/lib/nss/libsoftokn3.so.1 Reading symbols from /usr/local/lib/nss/libnssutil3.so.1...done. Loaded symbols for /usr/local/lib/nss/libnssutil3.so.1 Reading symbols from /usr/local/lib/libsqlite3.so.0...done. Loaded symbols for /usr/local/lib/libsqlite3.so.0 Reading symbols from /usr/local/lib/purple-2/ssl.so...done. Loaded symbols for /usr/local/lib/purple-2/ssl.so Reading symbols from /usr/local/lib/purple-2/statenotify.so...done. Loaded symbols for /usr/local/lib/purple-2/statenotify.so Reading symbols from /usr/local/lib/purple-2/nss-prefs.so...done. Loaded symbols for /usr/local/lib/purple-2/nss-prefs.so Reading symbols from /usr/local/lib/nss/libfreebl3.so.1...done. Loaded symbols for /usr/local/lib/nss/libfreebl3.so.1 Reading symbols from /usr/local/lib/python2.7/lib-dynload/_locale.so...done. Loaded symbols for /usr/local/lib/python2.7/lib-dynload/_locale.so Reading symbols from /libexec/ld-elf.so.1...done. Loaded symbols for /libexec/ld-elf.so.1 #0 0x0000000802acd9c3 in pthread_sigmask () from /lib/libthr.so.3 [New Thread 805406400 (LWP 100222/<unknown>)] (gdb) whe #0 0x0000000802acd9c3 in pthread_sigmask () from /lib/libthr.so.3 #1 0x0000000802acd238 in pthread_getspecific () from /lib/libthr.so.3 #2 0x00000008023485f5 in gnt_init () from /usr/local/lib/libgnt.so.0 #3 <signal handler called> #4 0x0000000802dd20da in _poll () from /lib/libc.so.7 #5 0x0000000802acad76 in pthread_suspend_all_np () from /lib/libthr.so.3 #6 0x0000000801ac0730 in g_main_context_iterate () from /usr/local/lib/libglib-2.0.so.0 #7 0x0000000801ac0a8f in g_main_loop_run () from /usr/local/lib/libglib-2.0.so.0 #8 0x000000000042569f in main ()
Unfortunately, this bt isn't very helpful. Can you recompile finch, libpurple, and libc with debugging symbols and get a "thread apply all bt"?
(In reply to Joe Marcus Clarke from comment #2) Hrm ... still waitin for a buildworld to finish on my VM. :-) However, getting the needed ports rebuilt seems to have something useful in it. [New process 101352] [New Thread 805406400 (LWP 101352)] Core was generated by `finch'. Program terminated with signal SIGSEGV, Segmentation fault. #0 0x0000000802b7f9c3 in ?? () from /lib/libthr.so.3 (gdb) whe #0 0x0000000802b7f9c3 in ?? () from /lib/libthr.so.3 #1 0x0000000802b7f238 in ?? () from /lib/libthr.so.3 #2 0x00000008023be1cb in sighandler (sig=28) at gntmain.c:421 #3 <signal handler called> #4 0x0000000802e840da in _poll () from /lib/libc.so.7 #5 0x0000000802b7cd76 in ?? () from /lib/libthr.so.3 #6 0x0000000801b1ba81 in g_poll (fds=0x80c2c0610, nfds=5, timeout=1963) at gpoll.c:124 #7 0x0000000801b07c20 in g_main_context_poll (context=0x805453240, timeout=1963, priority=2147483647, fds=0x80c2c0610, n_fds=5) at gmain.c:4076 #8 0x0000000801b05efe in g_main_context_iterate (context=0x805453240, block=1, dispatch=1, self=0x80c0aa960) at gmain.c:3776 #9 0x0000000801b06434 in g_main_loop_run (loop=0x805510e90) at gmain.c:3975 #10 0x00000008023be32a in gnt_main () at gntmain.c:524 #11 0x000000000042e7ad in main (argc=1, argv=0x7fffffffeb50) at finch.c:462 (gdb) thread apply all bt Thread 1 (Thread 805406400 (LWP 101352)): #0 0x0000000802b7f9c3 in ?? () from /lib/libthr.so.3 #1 0x0000000802b7f238 in ?? () from /lib/libthr.so.3 #2 0x00000008023be1cb in sighandler (sig=28) at gntmain.c:421 #3 <signal handler called> #4 0x0000000802e840da in _poll () from /lib/libc.so.7 #5 0x0000000802b7cd76 in ?? () from /lib/libthr.so.3 #6 0x0000000801b1ba81 in g_poll (fds=0x80c2c0610, nfds=5, timeout=1963) at gpoll.c:124 #7 0x0000000801b07c20 in g_main_context_poll (context=0x805453240, timeout=1963, priority=2147483647, fds=0x80c2c0610, n_fds=5) at gmain.c:4076 #8 0x0000000801b05efe in g_main_context_iterate (context=0x805453240, block=1, dispatch=1, self=0x80c0aa960) at gmain.c:3776 #9 0x0000000801b06434 in g_main_loop_run (loop=0x805510e90) at gmain.c:3975 #10 0x00000008023be32a in gnt_main () at gntmain.c:524 #11 0x000000000042e7ad in main (argc=1, argv=0x7fffffffeb50) at finch.c:462
Okay, I think I see the problem, but can you recompile libthr with debugging symbols? It seems like calling the default signal handler for SIGWINCH while handling the signal itself may be bad.
(In reply to Joe Marcus Clarke from comment #4) I think this is what you're looking for? $ /usr/local/bin/gdb /usr/local/bin/finch ./finch.core GNU gdb (GDB) 7.9.1 [GDB v7.9.1 for FreeBSD] Copyright (C) 2015 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-portbld-freebsd11.0". Type "show configuration" for configuration details. For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from /usr/local/bin/finch...done. [New process 100262] [New Thread 805406400 (LWP 100262)] Core was generated by `finch'. Program terminated with signal SIGSEGV, Segmentation fault. #0 handle_signal (actp=0x7fffffffe460, sig=28, info=0x0, ucp=0x0) at /usr/src/lib/libthr/thread/thr_sig.c:203 203 SIGSETOR(actp->sa_mask, ucp->uc_sigmask); (gdb) thread apply all bt Thread 1 (Thread 805406400 (LWP 100262)): #0 handle_signal (actp=0x7fffffffe460, sig=28, info=0x0, ucp=0x0) at /usr/src/lib/libthr/thread/thr_sig.c:203 #1 0x000000080288d238 in thr_sighandler (sig=28, info=0x0, _ucp=0x0) at /usr/src/lib/libthr/thread/thr_sig.c:187 #2 0x00000008020cc1cb in sighandler (sig=28) at gntmain.c:421 #3 <signal handler called> #4 0x0000000802b9201a in _poll () from /lib/libc.so.7 #5 0x000000080288ad76 in __thr_poll (fds=0x8057e5a30, nfds=4, timeout=3573) at /usr/src/lib/libthr/thread/thr_syscalls.c:306 #6 0x00000008013cba81 in g_poll (fds=0x8057e5a30, nfds=4, timeout=3573) at gpoll.c:124 #7 0x00000008013b7c20 in g_main_context_poll (context=0x805453240, timeout=3573, priority=2147483647, fds=0x8057e5a30, n_fds=4) at gmain.c:4076 #8 0x00000008013b5efe in g_main_context_iterate (context=0x805453240, block=1, dispatch=1, self=0x805426f60) at gmain.c:3776 #9 0x00000008013b6434 in g_main_loop_run (loop=0x8057eac00) at gmain.c:3975 #10 0x00000008020cc32a in gnt_main () at gntmain.c:524 #11 0x000000000042d89d in main (argc=1, argv=0x7fffffffeb38) at finch.c:462
Does this patch help: http://www.marcuscom.com/downloads/patch-finch_libgnt_gntmain.c
(In reply to Joe Marcus Clarke from comment #6) Yeah, it doesn't crash now. However, no window movements are allowed now after a window resize. The only thing that seems to be working is a ctrl-c to quit, but the focus doesn't shift to the quit window so the only thing that I can do after a resize is kill finch from another terminal window.
Does the same thing happen if you run it outside of tmux? Perhaps tmux signal handlers are causing the problem. You can also try commenting out the sigaction and raise lines in the sighandler() function to see if that helps.
(In reply to Joe Marcus Clarke from comment #8) Yeah this happens irrespective of screen, tmux or just a normal terminal.
Any change if you comment out those lines?
(In reply to Joe Marcus Clarke from comment #10) Ah there we go. Now things seem to be working and not crashing. :-) net-im/finch/work/pidgin-2.10.11/finch/libgnt # diff gntmain.c.orig gntmain.c 409c409 < static void (*org_winch_handler)(int); --- > static struct sigaction owinch_sa; 420,421c420,421 < if (org_winch_handler) < org_winch_handler(sig); --- > //sigaction(SIGWINCH, &owinch_sa, NULL); > //raise(SIGWINCH); 458a459,461 > #ifdef SIGWINCH > struct sigaction winch_sa; > #endif 505c508,511 < org_winch_handler = signal(SIGWINCH, sighandler); --- > winch_sa.sa_handler = sighandler; > sigemptyset(&winch_sa.sa_mask); > winch_sa.sa_flags = 0; > sigaction(SIGWINCH, &winch_sa, &owinch_sa);
slightly more readable: --- gntmain.c.orig 2014-11-23 11:41:25.000000000 -0500 +++ gntmain.c 2015-07-10 12:47:59.214456000 -0400 @@ -406,7 +406,7 @@ } #ifdef SIGWINCH -static void (*org_winch_handler)(int); +static struct sigaction owinch_sa; #endif static void @@ -417,8 +417,8 @@ case SIGWINCH: erase(); g_idle_add((GSourceFunc)refresh_screen, NULL); - if (org_winch_handler) - org_winch_handler(sig); + //sigaction(SIGWINCH, &owinch_sa, NULL); + //raise(SIGWINCH); signal(SIGWINCH, sighandler); break; #endif @@ -456,6 +456,9 @@ { char *filename; const char *locale; +#ifdef SIGWINCH + struct sigaction winch_sa; +#endif if (channel) return; @@ -502,7 +505,10 @@ wrefresh(stdscr); #ifdef SIGWINCH - org_winch_handler = signal(SIGWINCH, sighandler); + winch_sa.sa_handler = sighandler; + sigemptyset(&winch_sa.sa_mask); + winch_sa.sa_flags = 0; + sigaction(SIGWINCH, &winch_sa, &owinch_sa); #endif signal(SIGCHLD, sighandler); signal(SIGINT, sighandler);
What about this version of the patch: http://www.marcuscom.com/downloads/patch-finch_libgnt_gntmain.c
(In reply to Joe Marcus Clarke from comment #13) Looks good as well. No crashes and window updates are being processed. :-)
Good. Can you confirm that multiple resizes work properly as well as multiple Control+C actions?
(In reply to Joe Marcus Clarke from comment #15) Confirmed. I've been running this patch for a full day with multiple resizes to my terminal. Seems ok from my perspective. I do not see any useability issues here.
This is now fixed.
A commit references this bug: Author: marcus Date: Sun Jul 12 16:02:29 UTC 2015 New revision: 391782 URL: https://svnweb.freebsd.org/changeset/ports/391782 Log: Fix a crash caused by changing window size. PR: 200936 Changes: head/net-im/finch/Makefile head/net-im/libpurple/files/patch-finch_libgnt_gntmain.c