I tried patching the dmenu 4.9 source code similarly to
https://www.mail-archive.com/fltk-bugs@easysw.com/msg01159.html.

Result: printf 'foo\nbar' | ./dmenu now works correctly. And I do not
need to move the mouse cursor before pressing the enter key.

Of course, I don't know whether that would be an appropriate fix in
the context of dmenu.

On Sun, Feb 10, 2019 at 4:17 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...
> > >

Reply via email to