From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Sending EOF in process-send-string Date: Tue, 01 Dec 2009 16:27:16 -0500 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1259702945 21866 80.91.229.12 (1 Dec 2009 21:29:05 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 1 Dec 2009 21:29:05 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Dec 01 22:28:58 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NFaHK-0002uk-08 for ged-emacs-devel@m.gmane.org; Tue, 01 Dec 2009 22:28:58 +0100 Original-Received: from localhost ([127.0.0.1]:59785 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NFaHJ-0007Og-8O for ged-emacs-devel@m.gmane.org; Tue, 01 Dec 2009 16:28:57 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NFaHF-0007Oa-2m for emacs-devel@gnu.org; Tue, 01 Dec 2009 16:28:53 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NFaHA-0007O6-J9 for emacs-devel@gnu.org; Tue, 01 Dec 2009 16:28:52 -0500 Original-Received: from [199.232.76.173] (port=52954 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NFaHA-0007O2-DP for emacs-devel@gnu.org; Tue, 01 Dec 2009 16:28:48 -0500 Original-Received: from chene.dit.umontreal.ca ([132.204.246.20]:48443) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NFaHA-0002D3-0y for emacs-devel@gnu.org; Tue, 01 Dec 2009 16:28:48 -0500 Original-Received: from faina.iro.umontreal.ca (faina.iro.umontreal.ca [132.204.26.177]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id nB1LRGFC004255; Tue, 1 Dec 2009 16:27:16 -0500 Original-Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id 32E263A14D; Tue, 1 Dec 2009 16:27:16 -0500 (EST) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) X-NAI-Spam-Level: X-NAI-Spam-Score: 0.5 X-NAI-Spam-Rules: 2 Rules triggered DATE_FUTURE=0.5, RV3418=0 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:118068 Archived-At: Could someone explain to me exactly why /* If we sent just part of the string, put in an EOF (C-d) to force it through, before we send the rest. */ if (len > 0) Fprocess_send_eof (proc); is the right thing to do in process.c:send_process ? I have no knowledge of tty programming, but reading the tcsetattr manpage, I get the impression that this EOF char only needs to be sent if the tty is in ICANON mode (and even then, it's not necessary for correctness, but only to make our text immediately `read'able to the other end without having to wait for an EOL). Apparently in ICANON mode, this EOF char will not be passed on to the other end, so it seems OK to send it. OTOH, if the tty is in raw mode, the EOF char will be seen by the other end, which is not what we want (and seems to be a cause of bugs in inferior-process modes, worked around in various ways, typically with something like "use a temp file is the input is too long"). A related question is: why does child_setup_tty set ICANON even though the comments say "It should not echo or do line-editing, since that is done in Emacs". Stefan "who's tempted to remove both the Fprocess_send_eof and the setting to ICANON"