From unknown Sat Sep 13 02:39:20 2025 X-Loop: help-debbugs@gnu.org Subject: bug#55094: 27.2; XELB under EXWM stops processing all keyboard events Resent-From: Maze Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 24 Apr 2022 17:35:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 55094 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 55094@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.165082169316550 (code B ref -1); Sun, 24 Apr 2022 17:35:02 +0000 Received: (at submit) by debbugs.gnu.org; 24 Apr 2022 17:34:53 +0000 Received: from localhost ([127.0.0.1]:60093 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nig8J-0004Ir-PK for submit@debbugs.gnu.org; Sun, 24 Apr 2022 13:34:53 -0400 Received: from lists.gnu.org ([209.51.188.17]:56160) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nifrB-0003s6-MD for submit@debbugs.gnu.org; Sun, 24 Apr 2022 13:17:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40302) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nifrB-0004nM-I4 for bug-gnu-emacs@gnu.org; Sun, 24 Apr 2022 13:17:09 -0400 Received: from mx1.polytechnique.org ([129.104.30.34]:49065) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nifr7-0004uA-48 for bug-gnu-emacs@gnu.org; Sun, 24 Apr 2022 13:17:08 -0400 Received: from ubik (unknown [199.167.29.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ssl.polytechnique.org (Postfix) with ESMTPSA id 85D9856468C for ; Sun, 24 Apr 2022 19:16:58 +0200 (CEST) Received: from maze by ubik with local (Exim 4.95) (envelope-from ) id 1nifqr-0006M5-PK for bug-gnu-emacs@gnu.org; Mon, 25 Apr 2022 01:16:49 +0800 Date: Mon, 25 Apr 2022 01:16:49 +0800 From: Maze Message-ID: <20220424171649.fgms4eqcyedzbieu@ubik.pkbd.org> X-PGP-Key: http://data.pkbd.org/pgp/maze/pubkey.asc MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable X-AV-Checked: ClamAV using ClamSMTP at svoboda.polytechnique.org (Sun Apr 24 19:16:59 2022 +0200 (CEST)) X-Spam-Flag: No, tests=bogofilter, spamicity=0.439682, queueID=D080756468D Received-SPF: pass client-ip=129.104.30.34; envelope-from=SRS0=Pst4=VC=ubik.pkbd.org=maze@bounces.m4x.org; helo=mx1.polytechnique.org X-Spam_score_int: -39 X-Spam_score: -4.0 X-Spam_bar: ---- X-Spam_report: (-4.0 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.1 (-) X-Mailman-Approved-At: Sun, 24 Apr 2022 13:34:50 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.1 (--) =0D =0D Sorry if this is not be the right place to report: this is a bug of=0D GNU ELPA package XELB running under EXWM, and not a bug of vanilla=0D emacs. However it seems the official place to report EXWM is on Github,=0D and, unless I missed something, it won't let me report a bug there=0D unless I create a github account, which I won't.=0D =0D Description: after hitting a key from the number row, EXWM acting as the=0D X Window Manager stops processing all keyboard input. Emacs and=0D all other graphical programs lose keyboard input. For me this happens=0D always after hitting any key from the numbers row of my=0D keyboard. Specifics may very possibly vary for other users but my=0D informed guess is that the risk is existing for all keyboard=0D configurations, as I will try to explain.=0D =0D Cause: a backtrace is generated showing that an array of xkb keytypes=0D was referenced out of its range in the method xcb:keysyms:keycode->keysym.= =0D I included this backtrace at the end of this message.=0D =0D This situation develops for the following reason:=0D When initializing EXWM, XELB creates a keyboard representation including=0D 2 arrays for keysyms and keytypes. After I hit a first key and start using = the=0D WM, XELB processes an XkbNewKeyBoardNotify event. XELB reacts to this=0D event by creating a new keysyms array without creating a new keytypes=0D array. Because the original keyboard had 28 keytypes but the new=0D keyboard has 29 keytypes in Xkb, and since my number row keys get associate= d=0D to the highest index keytype of the new keyboard, this causes the legacy=0D keytypes array to be accessed out of range by one index after I hit one=0D of the number row keys.=0D =0D Solution: I propose a patch. I'm not sure it's absolutely the best thing=0D to do but it is tested on my configuration and I think it probably=0D should not cause breaks for other users: calling the method =0D xcb:keysyms:-update-keytypes with correct parameters is in effect=0D retrieving information from Xkb and putting XELB in sync. My guess =0D is that the logic which drives this condition of=0D xcb:keysyms:-update-keycodes to be called alone without=0D calling xcb:keysyms:-update-keytype is not sanely selecting only=0D cases where it would be a good idea to skip the call... At this =0D stage of my understanding, calling both methods has to be safe in all =0D cases, and solves the severe crash of the WM that I experience. =0D =0D * in method xcb:keysyms:-on-NewKeyboardNotify, update keytypes of =0D new keyboard in order to prevent the WM from crashing when =0D processing keycodes=0D =0D diff --git a/xcb-keysyms.el b/xcb-keysyms.el=0D index af4f97b..2b7f89f 100644=0D --- a/xcb-keysyms.el=0D +++ b/xcb-keysyms.el=0D @@ -161,6 +161,7 @@ This method must be called before using any other metho= d in this module."=0D (setq device (xcb:-get-extra-plist obj 'keysyms deviceID))=0D (when (and device=0D (not (slot-value device 'updated)))=0D + (xcb:keysyms:-update-keytypes obj deviceID)=0D (xcb:keysyms:-update-keycodes obj deviceID)=0D (when (=3D deviceID device-id)=0D (setq updated t)=0D =0D Below is the backtrace that I obtained when I hit a key from the numbers=0D row while EXWM is managing X windows:=0D =0D window-list xcb-debug:buffer t ...))) (while --dolist-tail-- (let (...)=0D (if ... ...) (setq --dolist-tail-- ...)))) (save-excursion (goto-char=0D (point-max)) (let ((standard-output ...)) (backtrace))) (let=0D ((--dolist-tail-- windows-eob)) (while --dolist-tail-- (let (...)=0D (set-window-point w ...) (setq --dolist-tail-- ...)))))))(error=0D (args-out-of-range [#=0D # # #=0D # # #=0D # # #=0D # # #=0D # # #=0D # # #=0D # # #=0D # # #=0D # # #] 28))=0D aref([# # #=0D # # #=0D # # #=0D # # #=0D # # #=0D # # #=0D # # #=0D # # #=0D # # #=0D #] 28)=0D (setq keytype (aref (slot-value object 'keytypes) (elt (slot-value=0D keycode 'kt-index) group)))=0D (catch 'return (if (<=3D (slot-value object 'min-keycode) keycode=0D (slot-value object 'max-keycode)) nil (throw 'return '(0 . 0)))=0D (setq keycode (aref (slot-value object 'keycodes) (- keycode=0D (slot-value object 'min-keycode))) group-info (slot-value keycode=0D 'groupInfo) group-number (logand group-info 15)) (if (=3D=0D group-number 0) (progn (throw 'return '(0 . 0)))) (setq group (if=0D (null modifiers) 0 (logand (lsh modifiers -13) 3))) (if (>=3D group=0D group-number) (progn (let* ((val (logand group-info 192))) (cond=0D ((eq val 'xcb:xkb:GroupsWrap:RedirectIntoRange) (setq group=0D (logand 255 ...)) (if (>=3D group group-number) (progn ...))) ((eq=0D val 'xcb:xkb:GroupsWrap:ClampIntoRange) (setq group (1-=0D group-number))) (t (setq group (% group group-number))))))) (setq=0D index (* group (slot-value keycode 'width))) (progn (message=0D "KEYSTROKE keysym: %s kt-index: %s" (slot-value keycode 'syms)=0D (slot-value keycode 'kt-index)) (let* ((object keycode)) (message=0D "KEYSTROKE keysym: %s kt-index: %s" (slot-value object 'syms)=0D (slot-value object 'kt-index))) (message "number of keysyms: %s"=0D (length (slot-value object 'keycodes))) (message "number of=0D keytypes: %s" (length (slot-value object 'keytypes))) (let*=0D ((--cl-vec-- (slot-value object 'keycodes)) (--cl-idx-- -1) (code=0D nil)) (while (< (setq --cl-idx-- (1+ --cl-idx--)) (length=0D --cl-vec--)) (setq code (aref --cl-vec-- --cl-idx--)) (if code=0D (progn (let* (...) (if ... ...))))) nil)) (setq keytype (aref=0D (slot-value object 'keytypes) (elt (slot-value keycode 'kt-index)=0D group))) (let* ((object keytype)) (if (null modifiers) (delq nil=0D (mapcar #'(lambda (entry) (if ... ...)) (slot-value object 'map)))=0D (catch 'break (let ((--dolist-tail-- (slot-value object ...)))=0D (while --dolist-tail-- (let (...) (let* ... ...) (setq=0D --dolist-tail-- ...))))) (cons (elt (slot-value keycode 'syms)=0D index) (logand (slot-value object 'mods-mask) (lognot=0D preserve))))))=0D (let* ((object (xcb:keysyms:-get-current-device obj))) (catch=0D 'return (if (<=3D (slot-value object 'min-keycode) keycode=0D (slot-value object 'max-keycode)) nil (throw 'return '(0 . 0)))=0D (setq keycode (aref (slot-value object 'keycodes) (- keycode=0D (slot-value object 'min-keycode))) group-info (slot-value=0D keycode 'groupInfo) group-number (logand group-info 15)) (if (=3D=0D group-number 0) (progn (throw 'return '(0 . 0)))) (setq group=0D (if (null modifiers) 0 (logand (lsh modifiers -13) 3))) (if (>=3D=0D group group-number) (progn (let* ((val (logand group-info 192)))=0D (cond ((eq val ...) (setq group ...) (if ... ...)) ((eq val ...)=0D (setq group ...)) (t (setq group ...)))))) (setq index (* group=0D (slot-value keycode 'width))) (progn (message "KEYSTROKE keysym:=0D %s kt-index: %s" (slot-value keycode 'syms) (slot-value keycode=0D 'kt-index)) (let* ((object keycode)) (message "KEYSTROKE keysym:=0D %s kt-index: %s" (slot-value object 'syms) (slot-value object=0D 'kt-index))) (message "number of keysyms: %s" (length=0D (slot-value object 'keycodes))) (message "number of keytypes:=0D %s" (length (slot-value object 'keytypes))) (let* ((--cl-vec--=0D (slot-value object 'keycodes)) (--cl-idx-- -1) (code nil))=0D (while (< (setq --cl-idx-- (1+ --cl-idx--)) (length --cl-vec--))=0D (setq code (aref --cl-vec-- --cl-idx--)) (if code (progn (let*=0D ... ...)))) nil)) (setq keytype (aref (slot-value object=0D 'keytypes) (elt (slot-value keycode 'kt-index) group))) (let*=0D ((object keytype)) (if (null modifiers) (delq nil (mapcar=0D #'(lambda ... ...) (slot-value object 'map))) (catch 'break (let=0D ((--dolist-tail-- ...)) (while --dolist-tail-- (let=0D ... ... ...)))) (cons (elt (slot-value keycode 'syms) index)=0D (logand (slot-value object 'mods-mask) (lognot preserve)))))))=0D (let ((preserve 0) group group-info group-number index=0D keytype) (let* ((object (xcb:keysyms:-get-current-device=0D obj))) (catch 'return (if (<=3D (slot-value object 'min-keycode)= =0D keycode (slot-value object 'max-keycode)) nil (throw 'return=0D '(0 . 0))) (setq keycode (aref (slot-value object 'keycodes)=0D (- keycode (slot-value object 'min-keycode))) group-info=0D (slot-value keycode 'groupInfo) group-number (logand=0D group-info 15)) (if (=3D group-number 0) (progn (throw 'return=0D '(0 . 0)))) (setq group (if (null modifiers) 0 (logand (lsh=0D modifiers -13) 3))) (if (>=3D group group-number) (progn (let*=0D ((val ...)) (cond (... ... ...) (... ...) (t ...))))) (setq=0D index (* group (slot-value keycode 'width))) (progn (message=0D "KEYSTROKE keysym: %s kt-index: %s" (slot-value keycode 'syms)=0D (slot-value keycode 'kt-index)) (let* ((object keycode))=0D (message "KEYSTROKE keysym: %s kt-index: %s" (slot-value=0D object 'syms) (slot-value object 'kt-index))) (message "number=0D of keysyms: %s" (length (slot-value object 'keycodes)))=0D (message "number of keytypes: %s" (length (slot-value object=0D 'keytypes))) (let* ((--cl-vec-- (slot-value object ...))=0D (--cl-idx-- -1) (code nil)) (while (< (setq --cl-idx-- ...)=0D (length --cl-vec--)) (setq code (aref --cl-vec-- --cl-idx--))=0D (if code (progn ...))) nil)) (setq keytype (aref (slot-value=0D object 'keytypes) (elt (slot-value keycode 'kt-index) group)))=0D (let* ((object keytype)) (if (null modifiers) (delq nil=0D (mapcar #'... (slot-value object ...))) (catch 'break (let=0D (...) (while --dolist-tail-- ...))) (cons (elt (slot-value=0D keycode ...) index) (logand (slot-value object ...) (lognot=0D preserve))))))))=0D (progn (let ((preserve 0) group group-info group-number=0D index keytype) (let* ((object=0D (xcb:keysyms:-get-current-device obj))) (catch 'return (if=0D (<=3D (slot-value object 'min-keycode) keycode (slot-value=0D object 'max-keycode)) nil (throw 'return '(0 . 0))) (setq=0D keycode (aref (slot-value object 'keycodes) (- keycode=0D (slot-value object ...))) group-info (slot-value keycode=0D 'groupInfo) group-number (logand group-info 15)) (if (=3D=0D group-number 0) (progn (throw 'return '...))) (setq group=0D (if (null modifiers) 0 (logand (lsh modifiers -13) 3))) (if=0D (>=3D group group-number) (progn (let* (...) (cond=0D ... ... ...)))) (setq index (* group (slot-value keycode=0D 'width))) (progn (message "KEYSTROKE keysym: %s kt-index:=0D %s" (slot-value keycode 'syms) (slot-value keycode=0D 'kt-index)) (let* ((object keycode)) (message "KEYSTROKE=0D keysym: %s kt-index: %s" (slot-value object ...) (slot-value=0D object ...))) (message "number of keysyms: %s" (length=0D (slot-value object ...))) (message "number of keytypes: %s"=0D (length (slot-value object ...))) (let* ((--cl-vec-- ...)=0D (--cl-idx-- -1) (code nil)) (while (< ... ...) (setq code=0D ...) (if code ...)) nil)) (setq keytype (aref (slot-value=0D object 'keytypes) (elt (slot-value keycode ...) group)))=0D (let* ((object keytype)) (if (null modifiers) (delq nil=0D (mapcar ... ...)) (catch 'break (let ... ...)) (cons (elt=0D ... index) (logand ... ...))))))))=0D (closure (t) (obj keycode modifiers) "Convert KEYCODE to=0D keysym or get possible modifier..." (progn (let ((preserve=0D 0) group group-info group-number index keytype) (let*=0D ((object (xcb:keysyms:-get-current-device obj))) (catch=0D 'return (if (<=3D ... keycode ...) nil (throw ... ...))=0D (setq keycode (aref ... ...) group-info (slot-value=0D keycode ...) group-number (logand group-info 15)) (if (=3D=0D group-number 0) (progn ...)) (setq group (if ... 0 ...))=0D (if (>=3D group group-number) (progn ...)) (setq index (*=0D group ...)) (progn (message "KEYSTROKE keysym: %s=0D kt-index: %s" ... ...) (let* ... ...) (message "number of=0D keysyms: %s" ...) (message "number of keytypes: %s" ...)=0D (let* ... ... nil)) (setq keytype (aref ... ...)) (let*=0D (...) (if ... ... ... ...)))))))(# 20 16)=0D apply((closure (t) (obj keycode modifiers) "Convert=0D KEYCODE to keysym or get possible modifier..." (progn=0D (let ((preserve 0) group group-info group-number index=0D keytype) (let* ((object (xcb:keysyms:-get-current-device=0D obj))) (catch 'return (if (<=3D ... keycode ...) nil=0D (throw ... ...)) (setq keycode (aref ... ...) group-info=0D (slot-value keycode ...) group-number (logand group-info=0D 15)) (if (=3D group-number 0) (progn ...)) (setq group (if= =0D ... 0 ...)) (if (>=3D group group-number) (progn ...))=0D (setq index (* group ...)) (progn (message "KEYSTROKE=0D keysym: %s kt-index: %s" ... ...) (let* ... ...)=0D (message "number of keysyms: %s" ...) (message "number=0D of keytypes: %s" ...) (let* ... ... nil)) (setq keytype=0D (aref ... ...)) (let* (...) (if ... ... ... ...)))))))=0D # (20 16))=0D xcb:keysyms:keycode->keysym(# 20 16)=0D From unknown Sat Sep 13 02:39:20 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Maze Subject: bug#55094: closed (Re: bug#55094: 27.2; XELB under EXWM stops processing all keyboard events) Message-ID: References: <87o80q6kzr.fsf@yahoo.com> <20220424171649.fgms4eqcyedzbieu@ubik.pkbd.org> X-Gnu-PR-Message: they-closed 55094 X-Gnu-PR-Package: emacs Reply-To: 55094@debbugs.gnu.org Date: Mon, 25 Apr 2022 00:55:01 +0000 Content-Type: multipart/mixed; boundary="----------=_1650848101-11827-1" This is a multi-part message in MIME format... ------------=_1650848101-11827-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #55094: 27.2; XELB under EXWM stops processing all keyboard events which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 55094@debbugs.gnu.org. --=20 55094: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D55094 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1650848101-11827-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 55094-done) by debbugs.gnu.org; 25 Apr 2022 00:54:31 +0000 Received: from localhost ([127.0.0.1]:60402 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nimzm-00033y-Nz for submit@debbugs.gnu.org; Sun, 24 Apr 2022 20:54:30 -0400 Received: from sonic307-10.consmr.mail.ne1.yahoo.com ([66.163.190.33]:44063) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nimzl-00033l-Q7 for 55094-done@debbugs.gnu.org; Sun, 24 Apr 2022 20:54:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1650848063; bh=5ilMnSAb4fGctNL3LSuCl6JcplpW7SmJH3eUNSRIKmE=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From:Subject:Reply-To; b=UhwlYfaUpk4/br4asbej8R9lOaYl6SEJJM2Pl+qriauwLhls/dHvnHHKpSbeb6tHnBboZh+/GWsKommF+H5rS/P6i5LzEDWGLHC8YhInJy6TwqSAQM2p9hmyHNTKHdGoX1h8tXl5V+Cio6BFQNmETjLujPAxqWB+PYBWlm/P7FT3GfW5hIgtVXMH9CTNgK3SzYnuEnspNGwdvIaVcpbguvBwcea8Pf1LTiFI9R3JgqXxB8dDynP32eMva0UtbN/KU8nboD+OZcDvJsYLi06+B/L4gaw3gIQ04mo8YWwIy4RDgTX2hxjlIPALGjp24qi/PpJdLN5TOWxGAEFbClR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rrM29PS6ndNp9VML396Bx1Szer2t 0DNfopewUHaqWuB89ygkG1p1qV5Wky39SXpOqbWkHU658ku8sSPF3KTEMrwrbhqdYQOgYL8XJt.a t4ryFyUMDHsVmxenexVuHB2oJ7dDp5zPv8o6rcyLIlFIesVf1RsJc4vM789iRWlrnfAuW2eYE_th 5qC3vIqm0aLzjzZYHCeo2yKciFYWYmP5gLkqS.i.tUNjpqcKX0Qq3u34dwZ5McRlpvj9mycbQjuS mUTG8zx4bqW51gHNbW10zT7SFutQYQWlLfKn5jDC9OgrUKtHnupmXEeFh1xrvE.yN5cOrtxStgZB mMDdkC1UciWfXXqq8nSW7ld49vVvGsSdmqCHSJwFKgAXvUYSQGgMYpMCtgx6vSHblRWHPuYCN.VR wrBK9cxdf6fQVUSWqAoAFHjHd_uw1ps52Wz4A61u4YtOvAFg_yU6KVBndcU8vJipDVdxjclMqcRF UK6hBF2TeOCk9eorLpEVnp96rVKR965fwrUOgmpgrIOG8rEOcYHqsDegyH6j7R4BHiXysuef6Hk5 E0FuR16fRlpd9MrA72jJyfOX5cJKn5Elra73dnmEoLPQF_Syx8OIV6SycRaeRCq5vAAgjo5RPYbk h3_ddNq.klc4TWIYLj6F04iUWa0El6YybVQTMfcLmYkAF4HUpEqzaIu6.KRn3mA-- X-Sonic-MF: Received: from sonic.gate.mail.ne1.yahoo.com by sonic307.consmr.mail.ne1.yahoo.com with HTTP; Mon, 25 Apr 2022 00:54:23 +0000 Received: by hermes--canary-production-sg3-6589f79784-49pc6 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 3b7f4d5cc77d1c784376663061ea7a44; Mon, 25 Apr 2022 00:54:21 +0000 (UTC) From: Po Lu To: Maze Subject: Re: bug#55094: 27.2; XELB under EXWM stops processing all keyboard events References: <20220424171649.fgms4eqcyedzbieu@ubik.pkbd.org> Date: Mon, 25 Apr 2022 08:54:16 +0800 In-Reply-To: <20220424171649.fgms4eqcyedzbieu@ubik.pkbd.org> (maze@pkbd.org's message of "Mon, 25 Apr 2022 01:16:49 +0800") Message-ID: <87o80q6kzr.fsf@yahoo.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.91 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Mailer: WebService/1.1.20118 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Content-Length: 534 X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 55094-done Cc: 55094-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Maze writes: > Sorry if this is not be the right place to report: this is a bug of > GNU ELPA package XELB running under EXWM, and not a bug of vanilla > emacs. However it seems the official place to report EXWM is on Github, > and, unless I missed something, it won't let me report a bug there > unless I create a github account, which I won't. This is definitely not the right place to report this bug, so I'm closing it. You might want to ask the EXWM maintainer directly, but he hasn't been active for a while. ------------=_1650848101-11827-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 24 Apr 2022 17:34:53 +0000 Received: from localhost ([127.0.0.1]:60093 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nig8J-0004Ir-PK for submit@debbugs.gnu.org; Sun, 24 Apr 2022 13:34:53 -0400 Received: from lists.gnu.org ([209.51.188.17]:56160) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nifrB-0003s6-MD for submit@debbugs.gnu.org; Sun, 24 Apr 2022 13:17:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40302) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nifrB-0004nM-I4 for bug-gnu-emacs@gnu.org; Sun, 24 Apr 2022 13:17:09 -0400 Received: from mx1.polytechnique.org ([129.104.30.34]:49065) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nifr7-0004uA-48 for bug-gnu-emacs@gnu.org; Sun, 24 Apr 2022 13:17:08 -0400 Received: from ubik (unknown [199.167.29.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ssl.polytechnique.org (Postfix) with ESMTPSA id 85D9856468C for ; Sun, 24 Apr 2022 19:16:58 +0200 (CEST) Received: from maze by ubik with local (Exim 4.95) (envelope-from ) id 1nifqr-0006M5-PK for bug-gnu-emacs@gnu.org; Mon, 25 Apr 2022 01:16:49 +0800 Date: Mon, 25 Apr 2022 01:16:49 +0800 From: Maze To: bug-gnu-emacs@gnu.org Subject: 27.2; XELB under EXWM stops processing all keyboard events Message-ID: <20220424171649.fgms4eqcyedzbieu@ubik.pkbd.org> X-PGP-Key: http://data.pkbd.org/pgp/maze/pubkey.asc MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable X-AV-Checked: ClamAV using ClamSMTP at svoboda.polytechnique.org (Sun Apr 24 19:16:59 2022 +0200 (CEST)) X-Spam-Flag: No, tests=bogofilter, spamicity=0.439682, queueID=D080756468D Received-SPF: pass client-ip=129.104.30.34; envelope-from=SRS0=Pst4=VC=ubik.pkbd.org=maze@bounces.m4x.org; helo=mx1.polytechnique.org X-Spam_score_int: -39 X-Spam_score: -4.0 X-Spam_bar: ---- X-Spam_report: (-4.0 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.1 (-) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Sun, 24 Apr 2022 13:34:50 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.1 (--) =0D =0D Sorry if this is not be the right place to report: this is a bug of=0D GNU ELPA package XELB running under EXWM, and not a bug of vanilla=0D emacs. However it seems the official place to report EXWM is on Github,=0D and, unless I missed something, it won't let me report a bug there=0D unless I create a github account, which I won't.=0D =0D Description: after hitting a key from the number row, EXWM acting as the=0D X Window Manager stops processing all keyboard input. Emacs and=0D all other graphical programs lose keyboard input. For me this happens=0D always after hitting any key from the numbers row of my=0D keyboard. Specifics may very possibly vary for other users but my=0D informed guess is that the risk is existing for all keyboard=0D configurations, as I will try to explain.=0D =0D Cause: a backtrace is generated showing that an array of xkb keytypes=0D was referenced out of its range in the method xcb:keysyms:keycode->keysym.= =0D I included this backtrace at the end of this message.=0D =0D This situation develops for the following reason:=0D When initializing EXWM, XELB creates a keyboard representation including=0D 2 arrays for keysyms and keytypes. After I hit a first key and start using = the=0D WM, XELB processes an XkbNewKeyBoardNotify event. XELB reacts to this=0D event by creating a new keysyms array without creating a new keytypes=0D array. Because the original keyboard had 28 keytypes but the new=0D keyboard has 29 keytypes in Xkb, and since my number row keys get associate= d=0D to the highest index keytype of the new keyboard, this causes the legacy=0D keytypes array to be accessed out of range by one index after I hit one=0D of the number row keys.=0D =0D Solution: I propose a patch. I'm not sure it's absolutely the best thing=0D to do but it is tested on my configuration and I think it probably=0D should not cause breaks for other users: calling the method =0D xcb:keysyms:-update-keytypes with correct parameters is in effect=0D retrieving information from Xkb and putting XELB in sync. My guess =0D is that the logic which drives this condition of=0D xcb:keysyms:-update-keycodes to be called alone without=0D calling xcb:keysyms:-update-keytype is not sanely selecting only=0D cases where it would be a good idea to skip the call... At this =0D stage of my understanding, calling both methods has to be safe in all =0D cases, and solves the severe crash of the WM that I experience. =0D =0D * in method xcb:keysyms:-on-NewKeyboardNotify, update keytypes of =0D new keyboard in order to prevent the WM from crashing when =0D processing keycodes=0D =0D diff --git a/xcb-keysyms.el b/xcb-keysyms.el=0D index af4f97b..2b7f89f 100644=0D --- a/xcb-keysyms.el=0D +++ b/xcb-keysyms.el=0D @@ -161,6 +161,7 @@ This method must be called before using any other metho= d in this module."=0D (setq device (xcb:-get-extra-plist obj 'keysyms deviceID))=0D (when (and device=0D (not (slot-value device 'updated)))=0D + (xcb:keysyms:-update-keytypes obj deviceID)=0D (xcb:keysyms:-update-keycodes obj deviceID)=0D (when (=3D deviceID device-id)=0D (setq updated t)=0D =0D Below is the backtrace that I obtained when I hit a key from the numbers=0D row while EXWM is managing X windows:=0D =0D window-list xcb-debug:buffer t ...))) (while --dolist-tail-- (let (...)=0D (if ... ...) (setq --dolist-tail-- ...)))) (save-excursion (goto-char=0D (point-max)) (let ((standard-output ...)) (backtrace))) (let=0D ((--dolist-tail-- windows-eob)) (while --dolist-tail-- (let (...)=0D (set-window-point w ...) (setq --dolist-tail-- ...)))))))(error=0D (args-out-of-range [#=0D # # #=0D # # #=0D # # #=0D # # #=0D # # #=0D # # #=0D # # #=0D # # #=0D # # #] 28))=0D aref([# # #=0D # # #=0D # # #=0D # # #=0D # # #=0D # # #=0D # # #=0D # # #=0D # # #=0D #] 28)=0D (setq keytype (aref (slot-value object 'keytypes) (elt (slot-value=0D keycode 'kt-index) group)))=0D (catch 'return (if (<=3D (slot-value object 'min-keycode) keycode=0D (slot-value object 'max-keycode)) nil (throw 'return '(0 . 0)))=0D (setq keycode (aref (slot-value object 'keycodes) (- keycode=0D (slot-value object 'min-keycode))) group-info (slot-value keycode=0D 'groupInfo) group-number (logand group-info 15)) (if (=3D=0D group-number 0) (progn (throw 'return '(0 . 0)))) (setq group (if=0D (null modifiers) 0 (logand (lsh modifiers -13) 3))) (if (>=3D group=0D group-number) (progn (let* ((val (logand group-info 192))) (cond=0D ((eq val 'xcb:xkb:GroupsWrap:RedirectIntoRange) (setq group=0D (logand 255 ...)) (if (>=3D group group-number) (progn ...))) ((eq=0D val 'xcb:xkb:GroupsWrap:ClampIntoRange) (setq group (1-=0D group-number))) (t (setq group (% group group-number))))))) (setq=0D index (* group (slot-value keycode 'width))) (progn (message=0D "KEYSTROKE keysym: %s kt-index: %s" (slot-value keycode 'syms)=0D (slot-value keycode 'kt-index)) (let* ((object keycode)) (message=0D "KEYSTROKE keysym: %s kt-index: %s" (slot-value object 'syms)=0D (slot-value object 'kt-index))) (message "number of keysyms: %s"=0D (length (slot-value object 'keycodes))) (message "number of=0D keytypes: %s" (length (slot-value object 'keytypes))) (let*=0D ((--cl-vec-- (slot-value object 'keycodes)) (--cl-idx-- -1) (code=0D nil)) (while (< (setq --cl-idx-- (1+ --cl-idx--)) (length=0D --cl-vec--)) (setq code (aref --cl-vec-- --cl-idx--)) (if code=0D (progn (let* (...) (if ... ...))))) nil)) (setq keytype (aref=0D (slot-value object 'keytypes) (elt (slot-value keycode 'kt-index)=0D group))) (let* ((object keytype)) (if (null modifiers) (delq nil=0D (mapcar #'(lambda (entry) (if ... ...)) (slot-value object 'map)))=0D (catch 'break (let ((--dolist-tail-- (slot-value object ...)))=0D (while --dolist-tail-- (let (...) (let* ... ...) (setq=0D --dolist-tail-- ...))))) (cons (elt (slot-value keycode 'syms)=0D index) (logand (slot-value object 'mods-mask) (lognot=0D preserve))))))=0D (let* ((object (xcb:keysyms:-get-current-device obj))) (catch=0D 'return (if (<=3D (slot-value object 'min-keycode) keycode=0D (slot-value object 'max-keycode)) nil (throw 'return '(0 . 0)))=0D (setq keycode (aref (slot-value object 'keycodes) (- keycode=0D (slot-value object 'min-keycode))) group-info (slot-value=0D keycode 'groupInfo) group-number (logand group-info 15)) (if (=3D=0D group-number 0) (progn (throw 'return '(0 . 0)))) (setq group=0D (if (null modifiers) 0 (logand (lsh modifiers -13) 3))) (if (>=3D=0D group group-number) (progn (let* ((val (logand group-info 192)))=0D (cond ((eq val ...) (setq group ...) (if ... ...)) ((eq val ...)=0D (setq group ...)) (t (setq group ...)))))) (setq index (* group=0D (slot-value keycode 'width))) (progn (message "KEYSTROKE keysym:=0D %s kt-index: %s" (slot-value keycode 'syms) (slot-value keycode=0D 'kt-index)) (let* ((object keycode)) (message "KEYSTROKE keysym:=0D %s kt-index: %s" (slot-value object 'syms) (slot-value object=0D 'kt-index))) (message "number of keysyms: %s" (length=0D (slot-value object 'keycodes))) (message "number of keytypes:=0D %s" (length (slot-value object 'keytypes))) (let* ((--cl-vec--=0D (slot-value object 'keycodes)) (--cl-idx-- -1) (code nil))=0D (while (< (setq --cl-idx-- (1+ --cl-idx--)) (length --cl-vec--))=0D (setq code (aref --cl-vec-- --cl-idx--)) (if code (progn (let*=0D ... ...)))) nil)) (setq keytype (aref (slot-value object=0D 'keytypes) (elt (slot-value keycode 'kt-index) group))) (let*=0D ((object keytype)) (if (null modifiers) (delq nil (mapcar=0D #'(lambda ... ...) (slot-value object 'map))) (catch 'break (let=0D ((--dolist-tail-- ...)) (while --dolist-tail-- (let=0D ... ... ...)))) (cons (elt (slot-value keycode 'syms) index)=0D (logand (slot-value object 'mods-mask) (lognot preserve)))))))=0D (let ((preserve 0) group group-info group-number index=0D keytype) (let* ((object (xcb:keysyms:-get-current-device=0D obj))) (catch 'return (if (<=3D (slot-value object 'min-keycode)= =0D keycode (slot-value object 'max-keycode)) nil (throw 'return=0D '(0 . 0))) (setq keycode (aref (slot-value object 'keycodes)=0D (- keycode (slot-value object 'min-keycode))) group-info=0D (slot-value keycode 'groupInfo) group-number (logand=0D group-info 15)) (if (=3D group-number 0) (progn (throw 'return=0D '(0 . 0)))) (setq group (if (null modifiers) 0 (logand (lsh=0D modifiers -13) 3))) (if (>=3D group group-number) (progn (let*=0D ((val ...)) (cond (... ... ...) (... ...) (t ...))))) (setq=0D index (* group (slot-value keycode 'width))) (progn (message=0D "KEYSTROKE keysym: %s kt-index: %s" (slot-value keycode 'syms)=0D (slot-value keycode 'kt-index)) (let* ((object keycode))=0D (message "KEYSTROKE keysym: %s kt-index: %s" (slot-value=0D object 'syms) (slot-value object 'kt-index))) (message "number=0D of keysyms: %s" (length (slot-value object 'keycodes)))=0D (message "number of keytypes: %s" (length (slot-value object=0D 'keytypes))) (let* ((--cl-vec-- (slot-value object ...))=0D (--cl-idx-- -1) (code nil)) (while (< (setq --cl-idx-- ...)=0D (length --cl-vec--)) (setq code (aref --cl-vec-- --cl-idx--))=0D (if code (progn ...))) nil)) (setq keytype (aref (slot-value=0D object 'keytypes) (elt (slot-value keycode 'kt-index) group)))=0D (let* ((object keytype)) (if (null modifiers) (delq nil=0D (mapcar #'... (slot-value object ...))) (catch 'break (let=0D (...) (while --dolist-tail-- ...))) (cons (elt (slot-value=0D keycode ...) index) (logand (slot-value object ...) (lognot=0D preserve))))))))=0D (progn (let ((preserve 0) group group-info group-number=0D index keytype) (let* ((object=0D (xcb:keysyms:-get-current-device obj))) (catch 'return (if=0D (<=3D (slot-value object 'min-keycode) keycode (slot-value=0D object 'max-keycode)) nil (throw 'return '(0 . 0))) (setq=0D keycode (aref (slot-value object 'keycodes) (- keycode=0D (slot-value object ...))) group-info (slot-value keycode=0D 'groupInfo) group-number (logand group-info 15)) (if (=3D=0D group-number 0) (progn (throw 'return '...))) (setq group=0D (if (null modifiers) 0 (logand (lsh modifiers -13) 3))) (if=0D (>=3D group group-number) (progn (let* (...) (cond=0D ... ... ...)))) (setq index (* group (slot-value keycode=0D 'width))) (progn (message "KEYSTROKE keysym: %s kt-index:=0D %s" (slot-value keycode 'syms) (slot-value keycode=0D 'kt-index)) (let* ((object keycode)) (message "KEYSTROKE=0D keysym: %s kt-index: %s" (slot-value object ...) (slot-value=0D object ...))) (message "number of keysyms: %s" (length=0D (slot-value object ...))) (message "number of keytypes: %s"=0D (length (slot-value object ...))) (let* ((--cl-vec-- ...)=0D (--cl-idx-- -1) (code nil)) (while (< ... ...) (setq code=0D ...) (if code ...)) nil)) (setq keytype (aref (slot-value=0D object 'keytypes) (elt (slot-value keycode ...) group)))=0D (let* ((object keytype)) (if (null modifiers) (delq nil=0D (mapcar ... ...)) (catch 'break (let ... ...)) (cons (elt=0D ... index) (logand ... ...))))))))=0D (closure (t) (obj keycode modifiers) "Convert KEYCODE to=0D keysym or get possible modifier..." (progn (let ((preserve=0D 0) group group-info group-number index keytype) (let*=0D ((object (xcb:keysyms:-get-current-device obj))) (catch=0D 'return (if (<=3D ... keycode ...) nil (throw ... ...))=0D (setq keycode (aref ... ...) group-info (slot-value=0D keycode ...) group-number (logand group-info 15)) (if (=3D=0D group-number 0) (progn ...)) (setq group (if ... 0 ...))=0D (if (>=3D group group-number) (progn ...)) (setq index (*=0D group ...)) (progn (message "KEYSTROKE keysym: %s=0D kt-index: %s" ... ...) (let* ... ...) (message "number of=0D keysyms: %s" ...) (message "number of keytypes: %s" ...)=0D (let* ... ... nil)) (setq keytype (aref ... ...)) (let*=0D (...) (if ... ... ... ...)))))))(# 20 16)=0D apply((closure (t) (obj keycode modifiers) "Convert=0D KEYCODE to keysym or get possible modifier..." (progn=0D (let ((preserve 0) group group-info group-number index=0D keytype) (let* ((object (xcb:keysyms:-get-current-device=0D obj))) (catch 'return (if (<=3D ... keycode ...) nil=0D (throw ... ...)) (setq keycode (aref ... ...) group-info=0D (slot-value keycode ...) group-number (logand group-info=0D 15)) (if (=3D group-number 0) (progn ...)) (setq group (if= =0D ... 0 ...)) (if (>=3D group group-number) (progn ...))=0D (setq index (* group ...)) (progn (message "KEYSTROKE=0D keysym: %s kt-index: %s" ... ...) (let* ... ...)=0D (message "number of keysyms: %s" ...) (message "number=0D of keytypes: %s" ...) (let* ... ... nil)) (setq keytype=0D (aref ... ...)) (let* (...) (if ... ... ... ...)))))))=0D # (20 16))=0D xcb:keysyms:keycode->keysym(# 20 16)=0D ------------=_1650848101-11827-1--