I believe I have a patch to fix this issue. It is attached. Taken from: https://www.mail-archive.com/fltk-bugs@easysw.com/msg01159.html
The link was pointed to by the Servo issue that Patrick Smith linked to. (Thanks, Patrick!) Patrick, can you please try (from a clean 4.9 dmenu sourcetree) `git apply fix-xim-failure.patch` and rebuild and test? This solves the issue for me. Jordan Jordan On Sun, Feb 10, 2019 at 6:29 PM Jordan Timmerman <skor...@gmail.com> wrote: > > Patrick, > > Can you also try reverting 377bd37e212b1ec4c03a481245603c6560d0be22 ? > > It certainly sounds like the same issue I experience; if so, reverting > that commit will cause dmenu to work correctly again. This may be able > to help guide your search if you continue debugging. > > On Sun, Feb 10, 2019 at 6:18 PM Patrick Smith <pat42sm...@gmail.com> wrote: > > > > Another point of information... after seeing > > https://github.com/servo/servo/issues/9938, I tried these two commands > > with my instrumented dmenu: > > > > >>>> printf 'foo\nbar' | ./dmenu > > Calling XOpenIM > > Back from XOpenIM, xim=0x0 > > Calling XCreateIC > > Back from XCreateIC, xic=0x0 > > xic = 0x0, event type = 2 > > calling XmbLookupString > > Segmentation fault (core dumped) > > >>>> > > >>>> printf 'foo\nbar' | LANG=en_US.UTF-8 ./dmenu > > Calling XOpenIM > > Back from XOpenIM, xim=0x67c3b660 > > Calling XCreateIC > > Back from XCreateIC, xic=0x67c3c3b0 > > xic = 0x67c3c3b0, event type = 2 > > calling XmbLookupString > > back from XmbLookupString > > foo > > > > In the first case, $LANG is set to my default value, en_CA.UTF-8. > > There is another difference, not visible in the above output. In the > > first command, I can press enter immediately after entering the > > command, and this causes dmenu to terminate with the segfault. In the > > second case, immediately pressing enter does nothing. I have to move > > the cursor to the menu prepared by dmenu at the top of the screen, and > > then press enter (fwiw, my window manager is i3). > > > > On Sun, Feb 10, 2019 at 3:54 PM Jordan Timmerman <skor...@gmail.com> wrote: > > > > > > With a little finagling, I've managed to produce a backtrace by using > > > Quentin's suggested flag modifications to config.mk. This is attached. > > > It seems to me only to confirm what we've already learned: the failure > > > occurs in XmbLookupString. Perhaps with the additional diagnostic > > > information Patrick was able to provide we'll figure it out. > > > > > > As an aside: thanks to everyone who has patiently helped me figure out > > > how to provide debugging information! Sorry I can't be more help. > > > > > > On Sun, Feb 10, 2019 at 5:39 PM Patrick Smith <pat42sm...@gmail.com> > > > wrote: > > > > > > > > I'm experiencing a problem that appears very similar to this one, and > > > > I can add a bit of information. > > > > > > > > Summary: When I have scim+anthy installed as an input method, the call > > > > to XOpenIM fails, returning a null pointer. But I don't know much > > > > about the internals of X, so can't be 100% sure this is the root of > > > > the problem. Nor do I know what to look at next. > > > > > > > > My environment: up to date Arch Linux, dmenu 4.9. For X input methods, > > > > using scim and anthy by setting environment variables: > > > > > > > > export XMODIFIERS=@im=SCIM > > > > export GTK_IM_MODULE=scim > > > > export QT_IM_MODULE=scim > > > > > > > > To reproduce the crash, I can do > > > > > > > > printf 'foo\nbar' | dmenu > > > > > > > > and then press return. With the Arch Linux 4.9, this produces a > > > > segmentation fault. After I downgraded to the Arch version of dmenu > > > > 4.8, it works correctly. > > > > > > > > So I downloaded the 4.9 source code and built it myself, with no > > > > changes to config.mk or anything else. This version produces still > > > > produces the segfault. > > > > > > > > Then I added debugging code to print some information to stderr. From > > > > this, I see that the crash seems to be inside XmbLookupString, as > > > > reported previously; the xic pointer returned from XCreateIC and > > > > passed to XmbLookupString is null, and the xim pointer returned from > > > > XOpenIM and passed to XCreateIC is also null. > > > > > > > > After this, I restarted X with scim disabled by commenting out the > > > > exports mentioned above, and retried the printf into dmenu. Now it > > > > works correctly, and reports that both XOpenIM and XCreateIC return > > > > non-null pointers. > > > > > > > > I'm not sure what to look at next, so I hope that helps someone else > > > > to diagnose the problem... > > > > > >
diff --git a/dmenu.c b/dmenu.c index f803149..7666f81 100644 --- a/dmenu.c +++ b/dmenu.c @@ -666,6 +666,10 @@ setup(void) /* open input methods */ xim = XOpenIM(dpy, NULL, NULL, NULL); + if (!xim) { + XSetLocaleModifiers("@im=local"); + xim = XOpenIM(dpy, NULL, NULL, NULL); + } xic = XCreateIC(xim, XNInputStyle, XIMPreeditNothing | XIMStatusNothing, XNClientWindow, win, XNFocusWindow, win, NULL);