From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#29349: [Patch] Bug 29349: read_key_sequence is only partially recursive. This is a bug. Date: Sun, 19 Nov 2017 19:01:09 +0200 Message-ID: <83tvxqdwyy.fsf@gnu.org> References: <20171118093843.GA3819@ACM> <20171119123456.GA4576@ACM> <20171119155908.GB4576@ACM> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1511111043 13681 195.159.176.226 (19 Nov 2017 17:04:03 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 19 Nov 2017 17:04:03 +0000 (UTC) Cc: 29349@debbugs.gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Nov 19 18:03:56 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eGT0Z-0002oR-Dn for geb-bug-gnu-emacs@m.gmane.org; Sun, 19 Nov 2017 18:03:51 +0100 Original-Received: from localhost ([::1]:53753 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eGT0f-0002bp-26 for geb-bug-gnu-emacs@m.gmane.org; Sun, 19 Nov 2017 12:03:57 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52942) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eGSyt-0001Nx-Eu for bug-gnu-emacs@gnu.org; Sun, 19 Nov 2017 12:02:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eGSyo-0001MX-KN for bug-gnu-emacs@gnu.org; Sun, 19 Nov 2017 12:02:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:39047) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eGSyo-0001MQ-H5 for bug-gnu-emacs@gnu.org; Sun, 19 Nov 2017 12:02:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eGSyo-0004xI-7c for bug-gnu-emacs@gnu.org; Sun, 19 Nov 2017 12:02:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 19 Nov 2017 17:02:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 29349 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 29349-submit@debbugs.gnu.org id=B29349.151111089219008 (code B ref 29349); Sun, 19 Nov 2017 17:02:02 +0000 Original-Received: (at 29349) by debbugs.gnu.org; 19 Nov 2017 17:01:32 +0000 Original-Received: from localhost ([127.0.0.1]:47728 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eGSyJ-0004wW-Ug for submit@debbugs.gnu.org; Sun, 19 Nov 2017 12:01:32 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:33559) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eGSyI-0004wI-64 for 29349@debbugs.gnu.org; Sun, 19 Nov 2017 12:01:30 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eGSy8-000133-1W for 29349@debbugs.gnu.org; Sun, 19 Nov 2017 12:01:24 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:51008) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eGSy7-00012x-UW; Sun, 19 Nov 2017 12:01:19 -0500 Original-Received: from [176.228.60.248] (port=2103 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1eGSy7-0005B2-9l; Sun, 19 Nov 2017 12:01:19 -0500 In-reply-to: <20171119155908.GB4576@ACM> (message from Alan Mackenzie on Sun, 19 Nov 2017 15:59:08 +0000) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:140100 Archived-At: > Date: Sun, 19 Nov 2017 15:59:08 +0000 > From: Alan Mackenzie > > > > In a Linux tty using the GPM mouse package, doing read_key_sequence (the > > > C function in keyboard.c), when a menu action is activated, > > > read_key_sequence calls itself recursively to handle all the mouse > > > manipulation. > > > > Unfortunately, the variable raw_keybuf_count is initialised to 0 in > > > r_k_s. This includes in the recursive call. This variable indexes the > > > global buffer raw_keybuf, which accumulates the raw events which make up > > > the key sequence. > > > > The result of this is that the events in the recursive call overwrite > > > the stored events of the outer r_k_s call, leaving a mess. > > > > r_k_s is static in keyboard.c and is called from three functions: > > > command_loop_1, read_menu_command (the one that gives the trouble), and > > > read_key_sequence_vs. > > > > So I propose as a solution that raw_keybuf_count be initialised to zero > > > in two of these three functions, but not in read_menu_command (and no > > > longer in read_key_sequence). I've tried this, and it seems to work. > > > It has the disadvantage of being ugly, and it makes read_menu_command > > > only callable as a subfunction of r_k_s. > > > > Has anybody any thoughts on this? > > > Here is how I propose to solve this: Can you please show a recipe where the current code misbehaves? I've re-read the thread, and found myself confused wrt the practical implications of the problem you describe. Thanks.