From unknown Sun Jun 22 22:44:25 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13290: 24.2.91; [PATCH] Comint can stall emacs with non-trivial input senders Resent-From: Vitalie Spinu Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 27 Dec 2012 21:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 13290 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 13290@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.13566450063788 (code B ref -1); Thu, 27 Dec 2012 21:51:02 +0000 Received: (at submit) by debbugs.gnu.org; 27 Dec 2012 21:50:06 +0000 Received: from localhost ([127.0.0.1]:34099 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1ToLL4-0000z2-1b for submit@debbugs.gnu.org; Thu, 27 Dec 2012 16:50:06 -0500 Received: from eggs.gnu.org ([208.118.235.92]:44423) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1ToLL2-0000yw-HB for submit@debbugs.gnu.org; Thu, 27 Dec 2012 16:50:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ToLKB-0003Nx-6i for submit@debbugs.gnu.org; Thu, 27 Dec 2012 16:49:15 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW,T_DKIM_INVALID autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:47565) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ToLKB-0003Nj-3J for submit@debbugs.gnu.org; Thu, 27 Dec 2012 16:49:11 -0500 Received: from eggs.gnu.org ([208.118.235.92]:55769) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ToLK8-0007mO-DU for bug-gnu-emacs@gnu.org; Thu, 27 Dec 2012 16:49:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ToLK5-0003Lr-Gx for bug-gnu-emacs@gnu.org; Thu, 27 Dec 2012 16:49:08 -0500 Received: from mail-wg0-f43.google.com ([74.125.82.43]:47852) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ToLK5-0003LR-Ax for bug-gnu-emacs@gnu.org; Thu, 27 Dec 2012 16:49:05 -0500 Received: by mail-wg0-f43.google.com with SMTP id e12so4630546wge.22 for ; Thu, 27 Dec 2012 13:49:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:subject:date:message-id:user-agent:mime-version :content-type; bh=27drVgcSOz+PZkHNrRvG7SradUZVbktBAvC50LBcDZ0=; b=vyJXoQU/oyWH+H/hYL0Yz0Jolr9+OUV2R2T22V1tNasRx9Pl4IIGEkn423t7gNl+16 ZEoM/J13u3w03RXAloiB5yQcl1W208XQbUzql/jM4T/XJzjE+EiwN1BOYdiRtw6fdVXB FWBroEy0w9sQd0jolvpCIHjaHKJNrlkHr+BOvtZ7DbvBrGzTiYg5mvJMIlGZv0nUuMSp 93Ip0uyCs/TZwr8doJ5SZjY3tf7W2TWL88cYrTelpDqmSpfR7k06XJJbTNsLaWK95kd6 STxHJA1XyyMQhtzuZdqX2DIi7WS2tiRbsjqwCupn1F1334YJEcSeUCv4H2UFpWAzgU4q bl7Q== X-Received: by 10.180.78.66 with SMTP id z2mr42016437wiw.23.1356644944106; Thu, 27 Dec 2012 13:49:04 -0800 (PST) Received: from localhost (i108036.upc-i.chello.nl. [62.195.108.36]) by mx.google.com with ESMTPS id hu8sm37305233wib.6.2012.12.27.13.49.02 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 27 Dec 2012 13:49:03 -0800 (PST) From: Vitalie Spinu Date: Thu, 27 Dec 2012 22:49:01 +0100 Message-ID: <87y5gj2mk2.fsf@gmail.com> User-Agent: Gnus/5.130004 (Ma Gnus v0.4) Emacs/24.2.91 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -6.1 (------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.1 (------) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi,=20 Comint can stall emacs while waiting for subproces output. I attach a trivial patch. Here is a short explanation. First comint calls comint-input-sender=20 =E2=95=AD=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80 #1842 =E2=94=80 /home/vitoshka/TVC/emacs/lisp/comint.el =E2=94=80=E2= =94=80 =E2=94=82 (let ((comint-input-sender-no-newline no-newline)) =E2=94=82 (funcall comint-input-sender proc input)) =E2=95=B0=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80 #1843 =E2=94=80 Then, if process echoes, comint first waits for process output: =E2=95=AD=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80 #1850 =E2=94=80 /home/vitoshka/TVC/emacs/lisp/comint.el =E2=94=80=E2= =94=80 =E2=94=82 (while (and (accept-process-output proc) =E2=94=82 (> (+ comint-last-input-end echo-len) =E2=94=82 (point-max)) =E2=95=B0=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80 #1852 =E2=94=80 The problem is that, occasionally, comint-input-sender might be a non-trivial function and could take care of process output itself. Thus, accept-process-output will wait for nonexistent output, and stall emacs. The patch just reverts the order in the (and ...) above. Thanks,=20 Vitalie --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Avoid-hanging-emacs-by-complex-comint-input-senders.patch >From d3c2753a571688370a4bc8fa2254679d9c23b74a Mon Sep 17 00:00:00 2001 From: Vitalie Spinu Date: Thu, 27 Dec 2012 21:46:38 +0100 Subject: [PATCH] Avoid hanging emacs by complex comint input senders. Revert the order of echo-len check and accept-process-output to avoid stalling Emacs when there is no process output left. --- lisp/ChangeLog | 6 ++++++ lisp/comint.el | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5f4853d..cc94b0d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2012-12-27 Vitalie Spinu + + * comint.el (comint-send-input): revert the order of echo-len + check and accept-process-output to avoid hanging Emacs when there + is no process output left. + 2012-12-27 Michael Albinus * net/tramp.el (tramp-handle-file-accessible-directory-p): New defun. diff --git a/lisp/comint.el b/lisp/comint.el index f3450e3..6477f00 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -1847,9 +1847,9 @@ Similarly for Soar, Scheme, etc." (let ((echo-len (- comint-last-input-end comint-last-input-start))) ;; Wait for all input to be echoed: - (while (and (accept-process-output proc) - (> (+ comint-last-input-end echo-len) + (while (and (> (+ comint-last-input-end echo-len) (point-max)) + (accept-process-output proc) (zerop (compare-buffer-substrings nil comint-last-input-start -- 1.7.10.4 --=-=-= Content-Type: text/plain In GNU Emacs 24.2.91.1 (i686-pc-linux-gnu, GTK+ Version 2.24.13) of 2012-12-25 on vitoshka-home Windowing system distributor `The X.Org Foundation', version 11.0.11300000 System Description: Ubuntu 12.10 Important settings: value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix default enable-multibyte-characters: t --=-=-=-- From unknown Sun Jun 22 22:44:25 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13290: 24.2.91; [PATCH] Comint can stall emacs with non-trivial input senders Resent-From: Glenn Morris Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 03 Jan 2013 06:50:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13290 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Vitalie Spinu Cc: 13290@debbugs.gnu.org Received: via spool by 13290-submit@debbugs.gnu.org id=B13290.135719574724036 (code B ref 13290); Thu, 03 Jan 2013 06:50:01 +0000 Received: (at 13290) by debbugs.gnu.org; 3 Jan 2013 06:49:07 +0000 Received: from localhost ([127.0.0.1]:40931 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tqebz-0006Fd-5C for submit@debbugs.gnu.org; Thu, 03 Jan 2013 01:49:07 -0500 Received: from fencepost.gnu.org ([208.118.235.10]:40907) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tqebw-0006FS-2B for 13290@debbugs.gnu.org; Thu, 03 Jan 2013 01:49:05 -0500 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1Tqebv-0005AM-If; Thu, 03 Jan 2013 01:49:03 -0500 From: Glenn Morris References: <87y5gj2mk2.fsf@gmail.com> X-Spook: CISU Blowpipe Indigo anarchy lock picking red noise World X-Ran: *!4EwNmgb[RSCvy1V#(z4}*MA7d.+ck*'.S.RhqJ?(J,:ZdHox_,3n,:xOUyJt:ytOyfP3 X-Hue: cyan X-Attribution: GM Date: Thu, 03 Jan 2013 01:49:03 -0500 In-Reply-To: <87y5gj2mk2.fsf@gmail.com> (Vitalie Spinu's message of "Thu, 27 Dec 2012 22:49:01 +0100") Message-ID: <4xd2xmlq1s.fsf@fencepost.gnu.org> User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -4.2 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.0 (-----) Vitalie Spinu wrote: > The problem is that, occasionally, comint-input-sender might be a > non-trivial function and could take care of process output itself. Thanks for the report. Could you give an example of this happening in practice? From unknown Sun Jun 22 22:44:25 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13290: 24.2.91; [PATCH] Comint can stall emacs with non-trivial input senders Resent-From: Vitalie Spinu Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 03 Jan 2013 10:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13290 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Glenn Morris Cc: 13290@debbugs.gnu.org Received: via spool by 13290-submit@debbugs.gnu.org id=B13290.135721007117837 (code B ref 13290); Thu, 03 Jan 2013 10:48:02 +0000 Received: (at 13290) by debbugs.gnu.org; 3 Jan 2013 10:47:51 +0000 Received: from localhost ([127.0.0.1]:41102 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TqiL0-0004dd-Ru for submit@debbugs.gnu.org; Thu, 03 Jan 2013 05:47:51 -0500 Received: from mail-wg0-f48.google.com ([74.125.82.48]:47022) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TqiKx-0004dS-S6 for 13290@debbugs.gnu.org; Thu, 03 Jan 2013 05:47:49 -0500 Received: by mail-wg0-f48.google.com with SMTP id dt10so6818859wgb.3 for <13290@debbugs.gnu.org>; Thu, 03 Jan 2013 02:47:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:organization:references:date :in-reply-to:message-id:user-agent:mime-version:content-type; bh=WkJSIY84qwGEafyRlZqGhn2w76q718m44Ora8RpldkA=; b=znZgC5sVUwoJajJzlZcYFbcVLzkduT2ikRjVoRVComTYfPXhOuQZNJLl4Oq7iQKOEy LsreU0mfr5uBjDM5pr+d+5rndg8jiEVUB1C5yNFND43ZJv98lmda6rPWWF493hG5lDf5 2Uv1ve3MJ61du0u8HNQf+N/4WpPiog7d+YG/q5hV9mpjJE74p3vg5ZOi95E4Lj8Dm2zh lvOpjuZH6Dhjaxs3X+mdjvRDEQoNbZdlSTnDnGEmqxGvgM25J5cBh1IQTXF+R7sg5KVx aiLUH+VxsBRxQTxxIrYKtnuAqD+Y234qbuMy8+tT+SZU4w5g1ayJ8EgntsTG9NWyPtqc 6yGw== X-Received: by 10.194.78.162 with SMTP id c2mr77141846wjx.46.1357210066719; Thu, 03 Jan 2013 02:47:46 -0800 (PST) Received: from localhost (i108036.upc-i.chello.nl. [62.195.108.36]) by mx.google.com with ESMTPS id h19sm88978205wiv.7.2013.01.03.02.47.44 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 03 Jan 2013 02:47:45 -0800 (PST) From: Vitalie Spinu Organization: EUR References: <87y5gj2mk2.fsf@gmail.com> <4xd2xmlq1s.fsf@fencepost.gnu.org> Date: Thu, 03 Jan 2013 11:47:44 +0100 In-Reply-To: <4xd2xmlq1s.fsf@fencepost.gnu.org> (Glenn Morris's message of "Thu, 03 Jan 2013 01:49:03 -0500") Message-ID: <87ehi2k0fj.fsf@gmail.com> User-Agent: Gnus/5.130004 (Ma Gnus v0.4) Emacs/24.2.91 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.1 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -0.7 (/) >> Glenn Morris >> on Thu, 03 Jan 2013 01:49:03 -0500 wrote: > Vitalie Spinu wrote: >> The problem is that, occasionally, comint-input-sender might be a >> non-trivial function and could take care of process output itself. > Thanks for the report. Could you give an example of this happening in > practice? Yes, this was happening in ESS under some specific conditions. Particularly when the user wants to evaluate the code linewise, i.e. each line of code is echoed in the comint buffer, and then the output is immediately inserted after that line. This is implemented in comint-input-sender function, and it does nothing else than just send input line by line and wait after each line for the process output. Thus, after the execution of comint-input-sender there was no process output left, and comint was waiting for nothing. Cases like above, when both input and output should be manipulated, are not easily implemented in comint-preoutput-filter-functions. Vitalie From unknown Sun Jun 22 22:44:25 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13290: 24.2.91; [PATCH] Comint can stall emacs with non-trivial input senders Resent-From: Vitalie Spinu Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 06 Jan 2013 14:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13290 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Glenn Morris Cc: 13290@debbugs.gnu.org Received: via spool by 13290-submit@debbugs.gnu.org id=B13290.135748413232108 (code B ref 13290); Sun, 06 Jan 2013 14:56:02 +0000 Received: (at 13290) by debbugs.gnu.org; 6 Jan 2013 14:55:32 +0000 Received: from localhost ([127.0.0.1]:47199 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TrrdJ-0008Lp-UO for submit@debbugs.gnu.org; Sun, 06 Jan 2013 09:55:32 -0500 Received: from mail-we0-f173.google.com ([74.125.82.173]:46410) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TrrdG-0008Lk-OC for 13290@debbugs.gnu.org; Sun, 06 Jan 2013 09:55:28 -0500 Received: by mail-we0-f173.google.com with SMTP id z2so9008775wey.32 for <13290@debbugs.gnu.org>; Sun, 06 Jan 2013 06:55:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:organization:references:date :in-reply-to:message-id:user-agent:mime-version:content-type; bh=iD55runTrpyojhyCeDTW9P4+SgsoHjOSGqYbu5jwM4A=; b=ffu7umjrDjCV4IbE7uSLpSY6ZCqyqZb5Kod0CWGVap/RQW7Zl3xMNXTB7XxZG+NuhL 6lPWcPOUyMINmKLpDS2HP/THl4AWxQhy01bXsqp76ZntnPK0lRZ00Mc0CpRQEk34VPys pMHZZpjOmznuS9FRKHhKQe6khKf0gaei+z56P+GYkREKmpv3gQCpz9pDQtHJqrNav7jH 5jNwlWZxS9xBcbLWp4wJ/glcd3YpAqNHJuyL0D5ghwW8y0NB2T0I//oCKQ+eYUbu9Pzi 4E/fNimNi+Of76gAmMlsi+A7hFEKD8CB7eNkg85pnJS2SS/6TOYzGvm8czY9kPH/mV+p os3Q== X-Received: by 10.180.75.208 with SMTP id e16mr5359879wiw.3.1357484107398; Sun, 06 Jan 2013 06:55:07 -0800 (PST) Received: from localhost (i108036.upc-i.chello.nl. [62.195.108.36]) by mx.google.com with ESMTPS id t17sm8731331wiv.6.2013.01.06.06.55.05 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 06 Jan 2013 06:55:06 -0800 (PST) From: Vitalie Spinu Organization: EUR References: <87y5gj2mk2.fsf@gmail.com> <4xd2xmlq1s.fsf@fencepost.gnu.org> <87ehi2k0fj.fsf@gmail.com> Date: Sun, 06 Jan 2013 15:55:04 +0100 In-Reply-To: <87ehi2k0fj.fsf@gmail.com> (Vitalie Spinu's message of "Thu, 03 Jan 2013 11:47:44 +0100") Message-ID: <87623amkdz.fsf@gmail.com> User-Agent: Gnus/5.130004 (Ma Gnus v0.4) Emacs/24.2.91 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.1 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -0.7 (/) Would you mind adding this to emacs-24? This one really makes our life at ESS difficult, and I cannot see a reliable workaround on our side. Comint tweak, on the other side, is harmless and will preclude similar problems in the future. Thanks, Vitalie >> Vitalie Spinu >> on Thu, 03 Jan 2013 11:47:44 +0100 wrote: >> Glenn Morris >> on Thu, 03 Jan 2013 01:49:03 -0500 wrote: >> Vitalie Spinu wrote: >> The problem is that, occasionally, comint-input-sender might be a >> non-trivial function and could take care of process output itself. >> Thanks for the report. Could you give an example of this happening in >> practice? VS> Yes, this was happening in ESS under some specific VS> conditions. Particularly when the user wants to evaluate the code VS> linewise, i.e. each line of code is echoed in the comint buffer, and VS> then the output is immediately inserted after that line. VS> This is implemented in comint-input-sender function, and it does nothing VS> else than just send input line by line and wait after each line for the VS> process output. Thus, after the execution of comint-input-sender there VS> was no process output left, and comint was waiting for nothing. VS> Cases like above, when both input and output should be manipulated, are VS> not easily implemented in comint-preoutput-filter-functions. VS> Vitalie From unknown Sun Jun 22 22:44:25 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.428 (Entity 5.428) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Vitalie Spinu Subject: bug#13290: closed (Re: bug#13290: 24.2.91; [PATCH] Comint can stall emacs with non-trivial input senders) Message-ID: References: <87y5gj2mk2.fsf@gmail.com> X-Gnu-PR-Message: they-closed 13290 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 13290@debbugs.gnu.org Date: Mon, 07 Jan 2013 01:08:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1357520882-29515-1" This is a multi-part message in MIME format... ------------=_1357520882-29515-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #13290: 24.2.91; [PATCH] Comint can stall emacs with non-trivial input send= ers 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 13290@debbugs.gnu.org. --=20 13290: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D13290 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1357520882-29515-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 13290-done) by debbugs.gnu.org; 7 Jan 2013 01:07:14 +0000 Received: from localhost ([127.0.0.1]:33356 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Ts1BJ-0007f1-0x for submit@debbugs.gnu.org; Sun, 06 Jan 2013 20:07:13 -0500 Received: from fencepost.gnu.org ([208.118.235.10]:57274 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Ts1BG-0007er-5T for 13290-done@debbugs.gnu.org; Sun, 06 Jan 2013 20:07:12 -0500 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1Ts1BC-0003fr-GD; Sun, 06 Jan 2013 20:07:06 -0500 From: Glenn Morris To: 13290-done@debbugs.gnu.org Subject: Re: bug#13290: 24.2.91; [PATCH] Comint can stall emacs with non-trivial input senders References: <87y5gj2mk2.fsf@gmail.com> <4xd2xmlq1s.fsf@fencepost.gnu.org> <87ehi2k0fj.fsf@gmail.com> <87623amkdz.fsf@gmail.com> X-Spook: Abu Ghraib virus Fedayeen ammunition Becker AFSPC Area 51 X-Ran: )v{pxV"}XLunX9)y1ON1?]r0miZ]ao5U0U~M{@t8X>4L<:Tgv3%6j X-Hue: yellow X-Debbugs-No-Ack: yes X-Attribution: GM Date: Sun, 06 Jan 2013 20:07:06 -0500 In-Reply-To: <87623amkdz.fsf@gmail.com> (Vitalie Spinu's message of "Sun, 06 Jan 2013 15:55:04 +0100") Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: 13290-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.5 (-----) Version: 24.2.92 OK; applied. ------------=_1357520882-29515-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 27 Dec 2012 21:50:06 +0000 Received: from localhost ([127.0.0.1]:34099 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1ToLL4-0000z2-1b for submit@debbugs.gnu.org; Thu, 27 Dec 2012 16:50:06 -0500 Received: from eggs.gnu.org ([208.118.235.92]:44423) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1ToLL2-0000yw-HB for submit@debbugs.gnu.org; Thu, 27 Dec 2012 16:50:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ToLKB-0003Nx-6i for submit@debbugs.gnu.org; Thu, 27 Dec 2012 16:49:15 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW,T_DKIM_INVALID autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:47565) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ToLKB-0003Nj-3J for submit@debbugs.gnu.org; Thu, 27 Dec 2012 16:49:11 -0500 Received: from eggs.gnu.org ([208.118.235.92]:55769) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ToLK8-0007mO-DU for bug-gnu-emacs@gnu.org; Thu, 27 Dec 2012 16:49:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ToLK5-0003Lr-Gx for bug-gnu-emacs@gnu.org; Thu, 27 Dec 2012 16:49:08 -0500 Received: from mail-wg0-f43.google.com ([74.125.82.43]:47852) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ToLK5-0003LR-Ax for bug-gnu-emacs@gnu.org; Thu, 27 Dec 2012 16:49:05 -0500 Received: by mail-wg0-f43.google.com with SMTP id e12so4630546wge.22 for ; Thu, 27 Dec 2012 13:49:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:subject:date:message-id:user-agent:mime-version :content-type; bh=27drVgcSOz+PZkHNrRvG7SradUZVbktBAvC50LBcDZ0=; b=vyJXoQU/oyWH+H/hYL0Yz0Jolr9+OUV2R2T22V1tNasRx9Pl4IIGEkn423t7gNl+16 ZEoM/J13u3w03RXAloiB5yQcl1W208XQbUzql/jM4T/XJzjE+EiwN1BOYdiRtw6fdVXB FWBroEy0w9sQd0jolvpCIHjaHKJNrlkHr+BOvtZ7DbvBrGzTiYg5mvJMIlGZv0nUuMSp 93Ip0uyCs/TZwr8doJ5SZjY3tf7W2TWL88cYrTelpDqmSpfR7k06XJJbTNsLaWK95kd6 STxHJA1XyyMQhtzuZdqX2DIi7WS2tiRbsjqwCupn1F1334YJEcSeUCv4H2UFpWAzgU4q bl7Q== X-Received: by 10.180.78.66 with SMTP id z2mr42016437wiw.23.1356644944106; Thu, 27 Dec 2012 13:49:04 -0800 (PST) Received: from localhost (i108036.upc-i.chello.nl. [62.195.108.36]) by mx.google.com with ESMTPS id hu8sm37305233wib.6.2012.12.27.13.49.02 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 27 Dec 2012 13:49:03 -0800 (PST) From: Vitalie Spinu To: bug-gnu-emacs@gnu.org Subject: 24.2.91; [PATCH] Comint can stall emacs with non-trivial input senders Date: Thu, 27 Dec 2012 22:49:01 +0100 Message-ID: <87y5gj2mk2.fsf@gmail.com> User-Agent: Gnus/5.130004 (Ma Gnus v0.4) Emacs/24.2.91 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -6.1 (------) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.1 (------) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi,=20 Comint can stall emacs while waiting for subproces output. I attach a trivial patch. Here is a short explanation. First comint calls comint-input-sender=20 =E2=95=AD=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80 #1842 =E2=94=80 /home/vitoshka/TVC/emacs/lisp/comint.el =E2=94=80=E2= =94=80 =E2=94=82 (let ((comint-input-sender-no-newline no-newline)) =E2=94=82 (funcall comint-input-sender proc input)) =E2=95=B0=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80 #1843 =E2=94=80 Then, if process echoes, comint first waits for process output: =E2=95=AD=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80 #1850 =E2=94=80 /home/vitoshka/TVC/emacs/lisp/comint.el =E2=94=80=E2= =94=80 =E2=94=82 (while (and (accept-process-output proc) =E2=94=82 (> (+ comint-last-input-end echo-len) =E2=94=82 (point-max)) =E2=95=B0=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80 #1852 =E2=94=80 The problem is that, occasionally, comint-input-sender might be a non-trivial function and could take care of process output itself. Thus, accept-process-output will wait for nonexistent output, and stall emacs. The patch just reverts the order in the (and ...) above. Thanks,=20 Vitalie --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Avoid-hanging-emacs-by-complex-comint-input-senders.patch >From d3c2753a571688370a4bc8fa2254679d9c23b74a Mon Sep 17 00:00:00 2001 From: Vitalie Spinu Date: Thu, 27 Dec 2012 21:46:38 +0100 Subject: [PATCH] Avoid hanging emacs by complex comint input senders. Revert the order of echo-len check and accept-process-output to avoid stalling Emacs when there is no process output left. --- lisp/ChangeLog | 6 ++++++ lisp/comint.el | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5f4853d..cc94b0d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2012-12-27 Vitalie Spinu + + * comint.el (comint-send-input): revert the order of echo-len + check and accept-process-output to avoid hanging Emacs when there + is no process output left. + 2012-12-27 Michael Albinus * net/tramp.el (tramp-handle-file-accessible-directory-p): New defun. diff --git a/lisp/comint.el b/lisp/comint.el index f3450e3..6477f00 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -1847,9 +1847,9 @@ Similarly for Soar, Scheme, etc." (let ((echo-len (- comint-last-input-end comint-last-input-start))) ;; Wait for all input to be echoed: - (while (and (accept-process-output proc) - (> (+ comint-last-input-end echo-len) + (while (and (> (+ comint-last-input-end echo-len) (point-max)) + (accept-process-output proc) (zerop (compare-buffer-substrings nil comint-last-input-start -- 1.7.10.4 --=-=-= Content-Type: text/plain In GNU Emacs 24.2.91.1 (i686-pc-linux-gnu, GTK+ Version 2.24.13) of 2012-12-25 on vitoshka-home Windowing system distributor `The X.Org Foundation', version 11.0.11300000 System Description: Ubuntu 12.10 Important settings: value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix default enable-multibyte-characters: t --=-=-=-- ------------=_1357520882-29515-1--