Hi,

bbkeys-0.9.0p2 crashes on 4.8-beta/amd64 with following backtrace:
(gdb) bt
#0  0x000000020317b34c in _xcb_in_read_block (c=0x2103c4000, buf=0x207440dc0, 
    len=36)
    at /usr/xenocara/lib/libxcb/libxcb/../../../dist/libxcb/src/xcb_in.c:685
#1  0x000000020317b7e0 in _xcb_in_read (c=0x2103c4000)
    at /usr/xenocara/lib/libxcb/libxcb/../../../dist/libxcb/src/xcb_in.c:169
#2  0x000000020317d450 in _xcb_conn_wait (c=0x2103c4000, cond=Variable "cond" 
is not available.
)
    at /usr/xenocara/lib/libxcb/libxcb/../../../dist/libxcb/src/xcb_conn.c:335
#3  0x000000020317c2a5 in xcb_wait_for_reply (c=0x2103c4000, request=45373, 
    e=0x7f7fffbfc2e8)
    at /usr/xenocara/lib/libxcb/libxcb/../../../dist/libxcb/src/xcb_in.c:390
#4  0x0000000202372d4a in _XReply () from /usr/X11R6/lib/libX11.so.13.0
#5  0x00000002023512ed in XGetWindowProperty ()
   from /usr/X11R6/lib/libX11.so.13.0
#6  0x00000000004135c0 in std::operator+<char, std::char_traits<char>, 
std::allocator<char> > ()
#7  0x00000000004137c6 in std::operator+<char, std::char_traits<char>, 
std::allocator<char> > ()
...

If I remove patch patches/patch-src_Netclient_cpp from the port,
the crash goes away and bbkeys works normally on amd64.

I haven't tested what happens on other platforms with the
patch-src_Netclient_cpp patch.

$HOME/.bbkeysrc: (in case relevant)
[begin] (bbkeys configuration file)

  [config]
    [option] (stylefile) 
{/home/tkoskine/programs/blackbox/share/blackbox/styles/Green}
    [option] (honorModifiers) {false}
    [option] (stackedCycling) {true}
    [option] (stackedRaise) {false}
    [option] (showCycleMenu)  {true}
    [option] (menuTextJustify) {right}
    [option] (autoConfig)   {true}
    [option] (autoConfigCheckTimeout) {10}
    [option] (workspaceColumns) {6}
    [option] (workspaceRows) {1}
  [end]
  [keybindings] (begin keybindings)
    [NextWindow]  (Mod1-Tab)
    [NextWindowOnAllWorkspaces]  (Mod1-Control-Tab)
    [PrevWindow]  (Mod1-Shift-Tab)
    [NextWorkspace] (Mod4-Right)
    [PrevWorkspace] (Mod4-Left)
    [changeWorkspace]  (Mod4-1) {1}
    [changeWorkspace]  (Mod4-2) {2}
    [changeWorkspace]  (Mod4-3) {3}
    [changeWorkspace]  (Mod4-4) {4}
    [changeWorkspace]  (Mod4-5) {5}
    [changeWorkspace]  (Mod4-6) {6}
    [changeWorkspace]  (Mod4-7) {7}
    [changeWorkspace]  (Mod4-8) {8}
    [changeWorkspace]  (Mod4-9) {9}

#    [showRootMenu] (Mod1-Control-Escape)
    [showRootMenu] (Menu)
    [Execute] (Mod4-F1) {xterm}
    [Execute] (Mod4-F2) {xterm -e ssh gurb}

  [end] (end keybindings)
[end] (end bbkeys configuration)

The fix in diff format:
? bbkeys.core
Index: Makefile
===================================================================
RCS file: /cvs/ports/x11/bbkeys/Makefile,v
retrieving revision 1.19
diff -u -p -u -r1.19 Makefile
--- Makefile    30 Jul 2010 06:58:57 -0000      1.19
+++ Makefile    5 Aug 2010 19:52:13 -0000
@@ -3,7 +3,7 @@
 COMMENT=       X keygrabber for blackbox
 
 DISTNAME=      bbkeys-0.9.0
-REVISION=      2
+REVISION=      3
 CATEGORIES=    x11
 MASTER_SITES=  ${MASTER_SITE_SOURCEFORGE:=bbkeys/}
 
Index: patches/patch-src_Netclient_cpp
===================================================================
RCS file: patches/patch-src_Netclient_cpp
diff -N patches/patch-src_Netclient_cpp
--- patches/patch-src_Netclient_cpp     5 Aug 2007 13:43:39 -0000       1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,46 +0,0 @@
-$OpenBSD: patch-src_Netclient_cpp,v 1.1 2007/08/05 13:43:39 naddy Exp $
---- src/Netclient.cpp.orig     Fri Aug  3 21:43:44 2007
-+++ src/Netclient.cpp  Fri Aug  3 21:45:07 2007
-@@ -140,6 +140,7 @@ bool Netclient::getValue(Window win, Atom atom, Atom t
-   int result;
-   unsigned long maxread = nelements;
-   bool ret = False;
-+  size_t bsize;
- 
-   // try get the first element
-   result = XGetWindowProperty(_display.XDisplay(), win, atom, 0l, 1l, False,
-@@ -148,18 +149,19 @@ bool Netclient::getValue(Window win, Atom atom, Atom t
-   ret = (result == Success && ret_type == type && ret_size == size &&
-          nelements > 0);
-   if (ret) {
-+    bsize = (size == 32) ? sizeof(long) : size/8;
-     if (ret_bytes == 0 || maxread <= nelements) {
-       // we got the whole property's value
--      *value = new unsigned char[nelements * size/8 + 1];
--      memcpy(*value, c_val, nelements * size/8 + 1);
-+      *value = new unsigned char[nelements * bsize + 1];
-+      memcpy(*value, c_val, nelements * bsize + 1);
-     } else {
-       // get the entire property since it is larger than one long
-       XFree(c_val);
-       // the number of longs that need to be retreived to get the property's
-       // entire value. The last + 1 is the first long that we retrieved above.
-       int remain = (ret_bytes - 1)/sizeof(long) + 1 + 1;
--      if (remain > size/8 * (signed)maxread) // dont get more than the max
--        remain = size/8 * (signed)maxread;
-+      if (remain > bsize * (signed)maxread) // dont get more than the max
-+        remain = bsize * (signed)maxread;
-       result = XGetWindowProperty(_display.XDisplay(), win, atom, 0l, remain, 
False, type,
-                                   &ret_type, &ret_size, &nelements, 
&ret_bytes,
-                                   &c_val);
-@@ -173,8 +175,8 @@ bool Netclient::getValue(Window win, Atom atom, Atom t
-       if (! ret)
-         return getValue(win, atom, type, maxread, value, size);
-   
--      *value = new unsigned char[nelements * size/8 + 1];
--      memcpy(*value, c_val, nelements * size/8 + 1);
-+      *value = new unsigned char[nelements * bsize + 1];
-+      memcpy(*value, c_val, nelements * bsize + 1);
-     }    
-   }
-   if (c_val) XFree(c_val);

-- 
Tero Koskinen <tero.koski...@iki.fi>

Reply via email to