From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Daniel Colascione Newsgroups: gmane.emacs.bugs Subject: bug#17139: Race condition in complete-in-region: should we be using pre-command-hook, not post-command-hook? Date: Fri, 28 Mar 2014 19:18:04 -0700 Message-ID: <53362D5C.2070502@dancol.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="2mjSHfBbEET1N1abhJvgfaxBC19gqIpnf" X-Trace: ger.gmane.org 1396059549 25580 80.91.229.3 (29 Mar 2014 02:19:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 29 Mar 2014 02:19:09 +0000 (UTC) To: 17139@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Mar 29 03:19:18 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WTire-0008FC-7f for geb-bug-gnu-emacs@m.gmane.org; Sat, 29 Mar 2014 03:19:18 +0100 Original-Received: from localhost ([::1]:36935 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WTird-0005mQ-Q1 for geb-bug-gnu-emacs@m.gmane.org; Fri, 28 Mar 2014 22:19:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40134) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WTirV-0005m0-4W for bug-gnu-emacs@gnu.org; Fri, 28 Mar 2014 22:19:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WTirO-00057U-L0 for bug-gnu-emacs@gnu.org; Fri, 28 Mar 2014 22:19:09 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:54108) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WTirO-00057Q-Hw for bug-gnu-emacs@gnu.org; Fri, 28 Mar 2014 22:19:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1WTirO-00073V-5O for bug-gnu-emacs@gnu.org; Fri, 28 Mar 2014 22:19:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Daniel Colascione Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 29 Mar 2014 02:19:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 17139 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: "bug-gnu-ema >> bug-emacs" Original-Received: via spool by submit@debbugs.gnu.org id=B.139605951527075 (code B ref -1); Sat, 29 Mar 2014 02:19:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 29 Mar 2014 02:18:35 +0000 Original-Received: from localhost ([127.0.0.1]:55290 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WTiqw-00072c-In for submit@debbugs.gnu.org; Fri, 28 Mar 2014 22:18:34 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:38351) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WTiqu-00072U-N3 for submit@debbugs.gnu.org; Fri, 28 Mar 2014 22:18:33 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WTiqo-000539-38 for submit@debbugs.gnu.org; Fri, 28 Mar 2014 22:18:32 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:43097) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WTiqn-000535-WC for submit@debbugs.gnu.org; Fri, 28 Mar 2014 22:18:26 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40066) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WTiqh-0005j7-J9 for bug-gnu-emacs@gnu.org; Fri, 28 Mar 2014 22:18:25 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WTiqb-00052C-4x for bug-gnu-emacs@gnu.org; Fri, 28 Mar 2014 22:18:19 -0400 Original-Received: from dancol.org ([2600:3c01::f03c:91ff:fedf:adf3]:51548) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WTiqa-000527-Pw for bug-gnu-emacs@gnu.org; Fri, 28 Mar 2014 22:18:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dancol.org; s=x; h=Content-Type:Subject:To:MIME-Version:From:Date:Message-ID; bh=ZTmJqsy5J1CRlx0W4DsFJupJtD7rPRcJZWQsy8AB3Uk=; b=eosg6Ga7Zl+w97lKiDAmuK8gYLfPZ5nsBSxwqArUMMoqbO332HOreMT2PBpmY9GzhwwAHfBABldXmSm5B73E7W4o/7s6+/oSK4VOy4NbRk4mmJk4g73wGKLimpdeC40ytmhZUkZFkt5MiME6ul0VxWfpu6fr5hyv8H2cr7bdOi89LLbgUKGLGvDEiqo6QSKjekir5Bxhb55hrWw7fHvDZVEecbtJ0syVKv2PGLFpfryRUcyzl4mWel08l1cCDGcxhuySDl90znYt6b9xao/muhE4N3n50aXmN0uc+CrsvoBzLdKpyZkJ8DmjiKHzYtPbWiWgEPHS/Pitegp+VX7opg==; Original-Received: from ip-64-134-226-73.public.wayport.net ([64.134.226.73] helo=[192.168.5.69]) by dancol.org with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1WTiqZ-00015H-KX for bug-gnu-emacs@gnu.org; Fri, 28 Mar 2014 19:18:11 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 X-Enigmail-Version: 1.6 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:87510 Archived-At: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --2mjSHfBbEET1N1abhJvgfaxBC19gqIpnf Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Say we're using a mode derived from comint that implements completion by using the comint redirection functionality to send commands to the process associated with the comint buffer. Say we have TAB bound to complete-symbol. If the user presses TAB (to create a list of completions) and then immediately presses RET to run comint-send-input, we send the input to the subprocess, but don't wait for a reply. Then we run post-command-hook; completion-in-region--postch is on the list of hooks to run. This function runs completion-in-region-mode--predicate, which makes a hidden call to the subprocess; this hidden call involves writing a command waiting for a reply. But because we just sent the *user* line in comint-send-input, we might actually read the response to *that* line instead of the internal completion command, causing an error. The response to the internal completion command then appears in the comint buffer. Why can't we do the completion-in-region--postch stuff in pre-command-hoo= k? --2mjSHfBbEET1N1abhJvgfaxBC19gqIpnf Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.14 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIcBAEBAgAGBQJTNi1cAAoJEMAaIROpHW7IUpYP/3Y27FKf0oI0UZAc2Q93tBtr g96Fkqb92U+VK6Ax/RGewhSVIt/EuJ8KHf+py/XZDvb1byrQx518H9t3HY0+Q7C7 5XNRBflLgwH72apXkOiasCUNA3fbDdXTWrw9+QDmE6Efqs+XSPud/ebRiAsk2NoC Cy2sgfU5PGWNV6Y7dltyb+KVC8VNd+m3Wcq7TxkFILha+uN4BXX0+qw8pIHQKvbD fYi8euKhDEN4kYYngAANEbDnbna2UbXjr1Rl7FDozsnhuWScHN85ujTJZzKXg3YW qTP1+xdCXU2rHvEAYckynKf36go9bg97x7KAk/oL1wFoOcsl6vz6mAZLZAxOFMq0 wkIUDEqIpNTwoi1C3zXa3CKXpfw54mK8rN4LexDDygQVLS9O9E7kpequgV+/rwGS Pw86KP0biV/QOLVlPMA05Xq65AVmV4aNo9+l3wlvnWCzfQGCssEGlJH8ZtCqufRb geidX7FcBPVdWvFPj5L//2hlp9edCuCdUyNnGOQzIPNv/DLGLA/Dc3FLuTrmxlGJ 0GXbhWXk02NwQW7h+SMYmpWuQ3tXmERDsyA5ytvuhCGOh5wuxzP5n5wY7rTGUJrF djfzzONHqar43KhPpntdpUAPKng+GR9ZdViOKsmHvVi/Ez+9MCKoeTRn/jKsFqgI 8K2Ka1yBSbt0K5amtY8w =qGNB -----END PGP SIGNATURE----- --2mjSHfBbEET1N1abhJvgfaxBC19gqIpnf--