Subject: bug#54889: 29.0.50; shift keys can't function when using setxkbmap with custom_symbol in gnome

From: [email-masked]
Date: Thu, 14 Apr 2022 11:48:04 +0000

I am sorry, i will notice to use 'reply all' since this time.

here is this time i tried:

1. after 'run' , i do not see gui window,
i have no way to input,
here is the result:

$ gdb ./emacs -q
Reading symbols from ./emacs...
SIGINT is used by the debugger.
Are you sure you want to change it? (y or n) [answered Y; input not from
terminal]
DISPLAY = :0
TERM = rxvt-unicode-256color
Breakpoint 1 at 0x4ac18: file emacs.c, line 412.
Breakpoint 2 at 0x129bc0: file xterm.c, line 19625.
(gdb) break xterm.c:17399
Breakpoint 3 at 0x13cb23: file xterm.c, line 18393.
(gdb) run
Starting program: /dev/shm/e29/src/emacs
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[New Thread 0x7ffff1356640 (LWP 198258)]
[New Thread 0x7ffff0ae1640 (LWP 198259)]
[New Thread 0x7fffebfff640 (LWP 198260)]
[New Thread 0x7fffeb758640 (LWP 198261)]
[New Thread 0x7fffeaf57640 (LWP 198262)]
[New Thread 0x7fffea756640 (LWP 198263)]

Thread 1 "emacs" hit Breakpoint 3, handle_one_xevent
(dpyinfo=0x555555e69600, event=0x7fffffffd120, finish=<optimized out>,
hold_quit=0x7fffffffd3f0) at xterm.c:18393
18393          if (dpyinfo->supports_xkb
(gdb) p xkey.state
No symbol "xkey" in current context.
(gdb) p dpyinfo->hyper_mod_mask
$1 = 1

2.
i saw a word "optimized"
and found this .configure cmd in folder  e29/etc/ :
 ./configure --enable-checking='yes,glyphs' --enable-check-lisp-object-type
\
    CFLAGS='-O0 -g3'

then rebuild again
  $ make clean
  $ ./auto
  $ ./configure --enable-checking='yes,glyphs'
--enable-check-lisp-object-type \
      CFLAGS='-O0 -g3'
  $ make - j 4

run gdb,
because there is no gui emacs occur,
i have no way to input:
  $ gdb ./emacs -q
  Reading symbols from ./emacs...
  SIGINT is used by the debugger.
  Are you sure you want to change it? (y or n) [answered Y; input not from
terminal]
  DISPLAY = :0
  TERM = rxvt-unicode-256color
  Breakpoint 1 at 0x212569: file emacs.c, line 412.
  Breakpoint 2 at 0x1c7e96: file xterm.c, line 19625.
  (gdb) break xterm.c:17399
  Breakpoint 3 at 0x1c52f0: file xterm.c, line 18393.
  (gdb) run
  Starting program: /dev/shm/e29/src/emacs
  [Thread debugging using libthread_db enabled]
  Using host libthread_db library "/usr/lib/libthread_db.so.1".
  [New Thread 0x7ffff1355640 (LWP 207348)]
  [New Thread 0x7ffff0ae0640 (LWP 207349)]
  [New Thread 0x7fffebfff640 (LWP 207350)]
  [New Thread 0x7fffeb758640 (LWP 207351)]
  [New Thread 0x7fffeaf57640 (LWP 207352)]
  [New Thread 0x7fffea756640 (LWP 207353)]

  Thread 1 "emacs" hit Breakpoint 3, handle_one_xevent
(dpyinfo=0x555556145600, event=0x7fffffffc500, finish=0x555555e908fc
<current_finish>, hold_quit=0x7fffffffc830) at xterm.c:18393
  18393          if (dpyinfo->supports_xkb
  (gdb) p xkey.state
  No symbol "xkey" in current context.
  (gdb) p dpyinfo->hyper_mod_mask
  $1 = 1

3.
i also try run in 'sudo su',
emacs gui appeared,
but after this prompt '(gdb)' showed again,
the gui window freezed and can not input anymore,
then appeared  guit window : "EmacsClientOpen" is not responding"  .
later, the execute cmd result is in below:

[root@pc src]#   gdb ./emacs -q
Reading symbols from ./emacs...
SIGINT is used by the debugger.
Are you sure you want to change it? (y or n) [answered Y; input not from
terminal]
DISPLAY = :0
TERM = rxvt-unicode-256color
Breakpoint 1 at 0x212569: file emacs.c, line 412.
Breakpoint 2 at 0x1c7e96: file xterm.c, line 19625.
(gdb)  break xterm.c:17399
Breakpoint 3 at 0x1c52f0: file xterm.c, line 18393.
(gdb) run
Starting program: /dev/shm/e29/src/emacs
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[New Thread 0x7ffff1355640 (LWP 210606)]
[New Thread 0x7ffff0a5f640 (LWP 210607)]
[Detaching after fork from child process 210608]
[Detaching after fork from child process 210609]
[New Thread 0x7fffebfff640 (LWP 210610)]
[New Thread 0x7fffeb7fe640 (LWP 210611)]
[Thread 0x7fffeb7fe640 (LWP 210611) exited]
[New Thread 0x7fffeb7fe640 (LWP 210612)]
[New Thread 0x7fffeaffd640 (LWP 210613)]
[Thread 0x7fffeb7fe640 (LWP 210612) exited]
[Thread 0x7fffeaffd640 (LWP 210613) exited]

Thread 1 "emacs" hit Breakpoint 3, handle_one_xevent
(dpyinfo=0x55555610c980, event=0x7fffffffd710, finish=0x555555e908fc
<current_finish>, hold_quit=0x7fffffffda40) at xterm.c:18393
warning: Source file is more recent than executable.
18393          if (dpyinfo->supports_xkb
(gdb)  p xkey.state
No symbol "xkey" in current context.
(gdb) p dpyinfo->hyper_mod_mask
$1 = 1

Po Lu <[email-masked]> 於 2022年4月14日 週四 上午12:50寫道：

> [Seriously, please use "Reply All", otherwise the bug tracker cannot
> record this conversation.  Thanks]
>
> [email-masked] writes:
> > 2. because i am not familier gdb,
> >     i need aide :
> > a) this is message wnen i enter  gdb /dev/shm/e29/src/emacs -q ,
> >
> > But that probably won't help, since
> > GTK native input is usually the first thing to go awry when you start
> > messing with modifier mapping.
> >
> > Can you attach a debugger to Emacs, add a breakpoint to this part of
> > xterm.c:
> >
> >               xkey.type = KeyPress;
> >               xkey.serial = xev->serial;
> >               xkey.send_event = xev->send_event;
> >               xkey.display = dpyinfo->display;
> >               xkey.window = xev->event;
> >               xkey.root = xev->root;
> >               xkey.subwindow = xev->child;
> >               xkey.time = xev->time;
> >               xkey.state = ((xev->mods.effective & ~(1 << 13 | 1 << 14))
> >                             | (xev->group.effective << 13));
> >
> > ===>          xkey.x = lrint (xev->event_x);
> >               xkey.y = lrint (xev->event_y);
> >               xkey.x_root = lrint (xev->root_x);
> >               xkey.y_root = lrint (xev->root_y);
> >
> > press "Shift-A", and then show the value of `xkey.state'?
> >
> > This should work for you, assuming you're using a fresh copy of Emacs
> > from the master branch:
> >
> >   $ gdb path/to/emacs/binary -Q
> >   ...
> >   (gdb) break xterm.c:17399
> >   ... the breakpoint is hit after pressing the key
> >   (gdb) p xkey.state
> >
> > Also, please show the value of dpyinfo->hyper_mod_mask at that time,
> > like this:
> >
> >   (gdb) p dpyinfo->hyper_mod_mask
> >
> > If the debugger complains about certain values being optimized out,
> > rebuild Emacs without optimizations according to the instructions in
> > etc/DEBUG.
> >
> > Po Lu <[email-masked]> 於 2022年4月13日 週三 上午4:58寫道：
> >
> >  [email-masked] writes:
> >
> >  > 1. xmodmap is outputed:
> >  >
> >  > xmodmap:  up to 3 keys per modifier, (keycodes in parentheses):
> >  >
> >  > shift       Shift_L (0x32),  Shift_R (0x3e)
> >  > lock
> >  > control     Control_L (0x25),  Control_L (0x42),  Control_R (0x69)
> >  > mod1        Alt_L (0x40),  Alt_R (0x6c),  Meta_L (0xcd)
> >  > mod2        Num_Lock (0x4d)
> >  > mod3        ISO_Last_Group (0x87),  Mode_switch (0xcb)
> >  > mod4        Super_L (0x85),  Super_L (0xce),  Hyper_L (0xcf)
> >  > mod5        BadKey (0x5c),  ISO_Level3_Shift (0x86)
> >  >
> >  > 2-1.  i tried these cmd:
> >  >        ./configure  --with-xinput2
> >  >      then
> >  >        make -j 4
> >  >
> >  >      after done:
> >  >        emacs -q -xrm 'Emacs.useXIM: false'
> >  >
> >  >      still the same,  if i press Shift+A , minibuffer showed "H-a is
> undefined" and no capital letter inputed.
> >  >
> >  > 2-2. could you teach me how to tuen on 'x-gtk-use-native-input' ?
> >  >          i have no comprehensive knowlage about linux in now.
> >
> >     Hi,
> >
> >  >> (setq x-gtk-use-native-input t).
> >
> >     as you expect, after excute  it still can't input capital letter
> with shift key.
> >
> >  >> Can you attach a debugger to Emacs, add a breakpoint to this part of
> >  xterm.c:
> >
> >     unfortunally, in this step, my base knowlage not enough,
> >     here is the result:
> >       1.git clone https://github.com/emacs-mirror/emacs  to
> /dev/shm/e29/
> >       2. after ./configure then build, cd  ./src
> >            gdb ./emacs -q
> >
> >          first, a lot  message occured,
> >          i put these text in ~/.config/gdb/gdbinit  , after google:
> >               add-auto-load-safe-path /dev/shm/e29/src/
> >               set auto-load safe-path /dev/shm/e29/src/
> >           hope it is a right way.
> >
> >        3. then execute:
> >           $  gdb ./emacs -q
> >  Reading symbols from ./emacs...
> > SIGINT is used by the debugger.
> > Are you sure you want to change it? (y or n) [answered Y; input not from
> terminal]
> > DISPLAY = :0
> > TERM = rxvt-unicode-256color
> > Breakpoint 1 at 0x4ac18: file emacs.c, line 412.
> > Breakpoint 2 at 0x129bc0: file xterm.c, line 19625.
> >
> > (gdb) break xterm.c:17399
> > Breakpoint 3 at 0x13cb23: file xterm.c, line 18393.
>
> You forgot to enter "run" and then press Shift-A here once the input
> focus shifts to the Emacs window.  I'm sorry for not mentioning that
> earlier.  Thanks.
>