From: YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
To: 14862@debbugs.gnu.org
Subject: bug#14862: 24.3.50; Subprocess invocation hangs
Date: Sun, 14 Jul 2013 18:17:32 +0900 [thread overview]
Message-ID: <wlip0dts9f.wl%mituharu@math.s.chiba-u.ac.jp> (raw)
The following should only be reproducible on the platforms where
neither O_CLOEXEC nor O_NOINHERIT is available, such as CentOS 5 or
Mac OS X <= 10.6.
* Steps to reproduce
1. $ emacs -Q
2. M-x shell RET
* Result
Emacs hands, blocking at line 1897 in process.c:
1889 /* Wait for child_setup to complete in case that vfork is
1890 actually defined as fork. The descriptor wait_child_setup[1]
1891 of a pipe is closed at the child side either by close-on-exec
1892 on successful execve or the _exit call in child_setup. */
1893 {
1894 char dummy;
1895
1896 emacs_close (wait_child_setup[1]);
1897 emacs_read (wait_child_setup[0], &dummy, 1);
1898 emacs_close (wait_child_setup[0]);
1899 }
where wait_child_setup[] are intended to be close-on-exec:
src/process.c:
1670 if (pipe2 (wait_child_setup, O_CLOEXEC) != 0)
1671 report_file_error ("Creating pipe", Qnil);
But O_CLOEXEC is actually defined as 0 on the platforms where neither
O_CLOEXEC nor O_NOINHERIT is available.
lib/fcntl.in.h:
194 #if !defined O_CLOEXEC && defined O_NOINHERIT
195 /* Mingw spells it 'O_NOINHERIT'. */
196 # define O_CLOEXEC O_NOINHERIT
197 #endif
198
199 #ifndef O_CLOEXEC
200 # define O_CLOEXEC 0
201 #endif
As a result, the above pipe2 call does not set the close-on-exec flag
for the created file descriptors.
Just setting O_CLOEXEC to some non-zero value would cause another
problem, because emacs_open uses it for checking its availability:
src/sysdep.c:
2168 if (! O_CLOEXEC && 0 <= fd)
2169 fcntl (fd, F_SETFD, FD_CLOEXEC);
YAMAMOTO Mitsuharu
mituharu@math.s.chiba-u.ac.jp
In GNU Emacs 24.3.50.1 (i686-pc-linux-gnu, GTK+ Version 2.10.4)
of 2013-07-14 on localhost.localdomain
Bzr revision: 113419 eggert@cs.ucla.edu-20130714051848-v62h26m8r874rvlf
Windowing system distributor `The X.Org Foundation', version 11.0.70101000
System Description: CentOS release 5.9 (Final)
next reply other threads:[~2013-07-14 9:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-14 9:17 YAMAMOTO Mitsuharu [this message]
2013-07-16 7:07 ` bug#14862: 24.3.50; Subprocess invocation hangs Paul Eggert
2013-07-17 1:45 ` 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=wlip0dts9f.wl%mituharu@math.s.chiba-u.ac.jp \
--to=mituharu@math.s.chiba-u.ac.jp \
--cc=14862@debbugs.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.