From: David De La Harpe Golden <david@harpegolden.net>
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: emacs-devel@gnu.org, Miles Bader <miles@gnu.org>
Subject: Re: ^D is broken in shell-mode
Date: Wed, 09 Jun 2010 01:05:58 +0100 [thread overview]
Message-ID: <4C0EDAE6.6050806@harpegolden.net> (raw)
In-Reply-To: <jwv1vchjn00.fsf-monnier+emacs@gnu.org>
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.
next prev parent reply other threads:[~2010-06-09 0:05 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-08 13:16 ^D is broken in shell-mode Miles Bader
2010-06-08 14:27 ` Andreas Schwab
2010-06-08 20:22 ` Stefan Monnier
2010-06-09 0:05 ` David De La Harpe Golden [this message]
2010-06-09 1:06 ` Miles Bader
2010-06-09 6:28 ` Jan Djärv
2010-06-09 7:40 ` Stephen J. Turnbull
2010-06-09 8:14 ` Miles Bader
2010-06-09 10:53 ` Jose A. Ortega Ruiz
2010-06-10 0:38 ` Miles Bader
2010-06-10 1:52 ` Jose A. Ortega Ruiz
-- strict thread matches above, loose matches on Subject: below --
2010-06-23 15:35 Štěpán Němec
2010-06-23 18:15 ` Jose A. Ortega Ruiz
2010-06-25 12:11 ` Štěpán Němec
2010-06-25 20:01 ` Thierry Volpiatto
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4C0EDAE6.6050806@harpegolden.net \
--to=david@harpegolden.net \
--cc=emacs-devel@gnu.org \
--cc=miles@gnu.org \
--cc=monnier@IRO.UMontreal.CA \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.