all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Miles Bader <miles@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: Doing Linux admin work with Emacs
Date: Sat, 16 Oct 2010 12:16:51 +0900	[thread overview]
Message-ID: <87eibq3jz0.fsf@catnip.gol.com> (raw)
In-Reply-To: barmar-41A375.21501714102010@news.eternal-september.org

Barry Margolin <barmar@alum.mit.edu> writes:
>> Hmm, by if Emacs was configured correctly, "C-c C-c" should handle this
>
> What do you mean by "configured correctly"?  Is this an option the user 
> can configure?  Or are you referring to a compile-time setting?

Well, both compile-time settings and run-time settings.

Of course, the handling of ptys/ioctls/etc is very system-dependent,
and there's tons of different compile-time-selected code-paths in
Emacs to handle them on different types of systems -- but configure
should get that right mostly.

At runtime, the only configuration I'm aware of is whether pipes or
ptys are used for subprocesses (via the `process-connection-type'
variable, defaulting to t [ptys] on most non-Windows systems I think).
If Emacs uses pipes for subshells, things generally work less nicely.

> Where does it say that?  It repeatedly says that it sends the signal to 
> a process or process group, it never says anything about sending a 
> signal to the pty.  But ordinary users aren't allowed to send signals to 
> processes owned by other users.  Typing C-c gets around this, because 
> the terminal driver interprets this, and it's able to send signals to 
> any process connected to the terminal (since it's in the kernel, it 
> could actually send signals to any process, but it never would).

On linux, at least, Emacs just sends the appropriate interrupt character
to the pty master as if the user had typed it.

So if the user types "C-c C-c" in a shell buffer, comint calls
(interrupt-process ...), which in process.c gets turned into
process_send_signal (..., SIGINT, ...) -- but then process_send_signal
notices it's a pty and SIGINT, and turns around and just sends "^C" to
the pty as input!

This isn't pretty, and has problems of its own, but it does generally
handle the "interrupting a sudo'd command in a shell buffer" case as
users expect.

> I'm running the Carbon Emacs build of Emacs 22.2, but I had the same 
> problem years ago on Solaris.

Dunno if it's broken on 22.x (haven't used that for ages), but I
have the vague impression that things have basically behaved the
same way for a long time...

-Miles

-- 
Youth, n. The Period of Possibility, when Archimedes finds a fulcrum,
Cassandra has a following and seven cities compete for the honor of endowing a
living Homer.


  reply	other threads:[~2010-10-16  3:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <70fd06bf-4566-4274-9381-ee569700cabd@n40g2000vbb.googlegroups.com>
2010-10-13 12:12 ` Doing Linux admin work with Emacs Richard Riley
2010-10-13 12:19 ` Pascal J. Bourguignon
2010-10-14  2:34   ` Barry Margolin
2010-10-14  8:17     ` Olivier Sirven
2010-10-14 10:17     ` Miles Bader
2010-10-14 12:46       ` bebop52
2010-10-14 15:00         ` Pascal J. Bourguignon
2010-10-14 21:42         ` Tim X
2010-10-15  1:50       ` Barry Margolin
2010-10-16  3:16         ` Miles Bader [this message]
2010-10-13 21:20 ` Tim X

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=87eibq3jz0.fsf@catnip.gol.com \
    --to=miles@gnu.org \
    --cc=help-gnu-emacs@gnu.org \
    /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.