unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Jan Djärv" <jan.h.d@swipnet.se>
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: emacs-devel@gnu.org
Subject: Re: ^D is broken in shell-mode
Date: Wed, 09 Jun 2010 08:28:23 +0200	[thread overview]
Message-ID: <4C0F3487.101@swipnet.se> (raw)
In-Reply-To: <jwv1vchjn00.fsf-monnier+emacs@gnu.org>

2010-06-08 22:22, Stefan Monnier skrev:
>> 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...
>
> I really wish someone could help.  At least if someone could point me to
> some kind of documentation that would be very helpful.  The best "doc"
> I could find so far is the xterm source code, which I do not really
> understand and whose behavior I haven't been able to reproduce yet
> (e.g. it seems not to disable ICANON mode, and it doesn't seem to ever
> send EOF either, even when sending large chunks of data, yet that data
> doesn't get truncated, whereas when I try to to make Emacs send large
> amounts of data in ICANON mode without EOFs, it gets truncated).
>

I don't know what the original problem was (sending large amount of data may 
hang?) that prompted the removal of ICANON.  But as far as xterm goes (if it 
hasn't changed radically in the last year or so), it does something like this:

loop1:
try to write min(128 characters, what we want to write) to the pty (128 is 
half of what POSIX says is the minimum pty buffer size)

If write returned what we put in and there is more to write, goto loop1.

If write returned less or (-1 and errno is EAGAIN/EWOULDBLOCK), stop writing 
and select on the fd for write.

When select says it is OK to write again, start at loop1.

	Jan D.






  parent reply	other threads:[~2010-06-09  6:28 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
2010-06-09  1:06   ` Miles Bader
2010-06-09  6:28   ` Jan Djärv [this message]
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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C0F3487.101@swipnet.se \
    --to=jan.h.d@swipnet.se \
    --cc=emacs-devel@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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).