From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David De La Harpe Golden Newsgroups: gmane.emacs.devel Subject: Re: ^D is broken in shell-mode Date: Wed, 09 Jun 2010 01:05:58 +0100 Message-ID: <4C0EDAE6.6050806@harpegolden.net> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1276041979 6318 80.91.229.12 (9 Jun 2010 00:06:19 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 9 Jun 2010 00:06:19 +0000 (UTC) Cc: emacs-devel@gnu.org, Miles Bader To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jun 09 02:06:17 2010 connect(): No such file or directory 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.69) (envelope-from ) id 1OM8o6-0006hP-OO for ged-emacs-devel@m.gmane.org; Wed, 09 Jun 2010 02:06:11 +0200 Original-Received: from localhost ([127.0.0.1]:40710 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OM8o6-0005IL-2M for ged-emacs-devel@m.gmane.org; Tue, 08 Jun 2010 20:06:10 -0400 Original-Received: from [140.186.70.92] (port=40679 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OM8o0-0005Hk-Pn for emacs-devel@gnu.org; Tue, 08 Jun 2010 20:06:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OM8ny-0000f0-S9 for emacs-devel@gnu.org; Tue, 08 Jun 2010 20:06:04 -0400 Original-Received: from harpegolden.net ([65.99.215.13]:46762) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OM8ny-0000ep-PG; Tue, 08 Jun 2010 20:06:02 -0400 Original-Received: from [87.198.55.197] (87-198-55-197.ptr.magnet.ie [87.198.55.197]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "David De La Harpe Golden", Issuer "David De La Harpe Golden Personal CA rev 3" (verified OK)) by harpegolden.net (Postfix) with ESMTP id 4FDD99A67; Wed, 9 Jun 2010 01:06:00 +0100 (IST) User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100515 Icedove/3.0.4 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. 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:125645 Archived-At: On 08/06/10 21:22, Stefan Monnier wrote: >> It now results in a literal ^D being seen by the subproces. >> I vaguely recall seeing recently that emacs stopped using ICANON mode >> for ptys; I presume this is the cause? > > Yes. > >> It's been a long time since I did pty programming, but I seem to recall >> that at least in some pty states, doing a zero-length write in the pty >> master will send an end-of-file to the slave tty. I don't recall the >> details though... > FWIW, The write(3) manpage has this to say (about pipes not ptys): > Also, some existing systems (for example, Eighth Edition) > permit a write of zero bytes to mean that the reader should get an > end-of-file indication; for those systems, a return value of zero > from write() indicates a successful write of an end-of-file > indication. That's possibly what Miles is recollecting? I'm not sure it works for ptys, or that it's actually TRT here... > I really wish someone could help. Not necessarily helping: If you turn off ICANON, it's little wonder EOF char is just passed through? This page here: http://www.lafn.org/~dave/linux/terminalIO.html makes the claim: """ Cooked mode is the default state of your terminal for almost all shells. At least when you execute another program with the shell, the terminal is put into cooked mode before it makes a call to an exec function. """ Stty in shell exec'd processes and shell children do indeed show a cooked terminal on my system, so likely emacs when in its capacity as a "normal" shell / superior process should be ensuring the pty slave it hands to children is ICANON out-of-box? But n.b. that means the MAX_INPUT/MAX_CANON limits described at that link would apply.