From: YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
To: Markus Triska <markus.triska@gmx.at>, 554@emacsbugs.donarmstrong.com
Subject: bug#554: OSX: with-temp-buffer kills unrelated processes
Date: Mon, 14 Jul 2008 19:26:52 +0900 [thread overview]
Message-ID: <wlvdz82237.wl%mituharu@math.s.chiba-u.ac.jp> (raw)
In-Reply-To: <20080713173957.65071954A3D@mt-computer.local>
>>>>> On Sun, 13 Jul 2008 19:39:57 +0200 (CEST), Markus Triska <markus.triska@gmx.at> said:
--text follows this line--
> Let w.el consist of the following forms:
> (start-process "bc1" (current-buffer) "bc")
> (with-temp-buffer (start-process "bc2" (current-buffer) "bc"))
> When I do "emacs -Q w.el", and press C-M-x on the first form, "bc"
> (the GNU arbitrary precision calculator) is started and puts its
> start-up message at the end of the buffer (you can also use any other
> program that waits for further input). When I then press C-M-x on the
> second form, the first process receives SIGHUP, and the message reads:
> "Process bc1 hangup"
> I can reproduce this with Emacs 22.2 and latest CVS on OSX. I tried to
> trace it in gdb by putting a breakpoint at process_send_signal, but
> couldn't reproduce it in the debugger. Otherwise it works every time.
Just some analysis: not a solution I'm afraid.
It seems that the child process receives SIGHUP before it calls
execvp. As the child process is still running the Emacs executable,
it sends SIGHUP to all the subprocesses when it receives SIGHUP
(fatal_error_signal -> shut_down_emacs -> kill_buffer_processes).
A similar problem can be found in following example:
(process-running-child-p (start-process "bc1" (current-buffer) "bc"))
=> t
(process-running-child-p (prog1 (start-process "bc1" (current-buffer) "bc")
(sleep-for 1)))
=> nil
I think these behaviors are not observable in other platforms, because
they use vfork, and the parent side effectively blocks until the child
side calls execvp or others in its typical implementations. Emacs on
Darwin is using fork instead of vfork because the latter had (or
have?) some problems I'm not familiar with.
YAMAMOTO Mitsuharu
mituharu@math.s.chiba-u.ac.jp
next prev parent reply other threads:[~2008-07-14 10:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-13 17:39 bug#554: OSX: with-temp-buffer kills unrelated processes Markus Triska
2008-07-14 10:26 ` YAMAMOTO Mitsuharu [this message]
2008-07-16 9:17 ` YAMAMOTO Mitsuharu
2008-07-16 15:27 ` Markus Triska
2008-07-17 1:51 ` YAMAMOTO Mitsuharu
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=wlvdz82237.wl%mituharu@math.s.chiba-u.ac.jp \
--to=mituharu@math.s.chiba-u.ac.jp \
--cc=554@emacsbugs.donarmstrong.com \
--cc=markus.triska@gmx.at \
/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).