GNU bug report logs - #14862
24.3.50; Subprocess invocation hangs

Previous Next

Package: emacs;

Reported by: YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>

Date: Sun, 14 Jul 2013 09:18:02 UTC

Severity: important

Found in version 24.3.50

Done: YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 14862 in the body.
You can then email your comments to 14862 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#14862; Package emacs. (Sun, 14 Jul 2013 09:18:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 14 Jul 2013 09:18:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.50; Subprocess invocation hangs
Date: Sun, 14 Jul 2013 18:17:32 +0900
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 <at> 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 <at> cs.ucla.edu-20130714051848-v62h26m8r874rvlf
Windowing system distributor `The X.Org Foundation', version 11.0.70101000
System Description:	CentOS release 5.9 (Final)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14862; Package emacs. (Tue, 16 Jul 2013 07:08:01 GMT) Full text and rfc822 format available.

Message #8 received at 14862 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>
Subject: Re: 24.3.50; Subprocess invocation hangs
Date: Tue, 16 Jul 2013 00:07:30 -0700
Thanks for reporting that.  I installed what I hope is a fix.
Could you please try trunk bzr 113430 or later, on one of
those platforms?




Reply sent to YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>:
You have taken responsibility. (Wed, 17 Jul 2013 01:47:02 GMT) Full text and rfc822 format available.

Notification sent to YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>:
bug acknowledged by developer. (Wed, 17 Jul 2013 01:47:02 GMT) Full text and rfc822 format available.

Message #13 received at 14862-done <at> debbugs.gnu.org (full text, mbox):

From: YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 14862-done <at> debbugs.gnu.org
Subject: Re: 24.3.50; Subprocess invocation hangs
Date: Wed, 17 Jul 2013 10:45:55 +0900
>>>>> On Tue, 16 Jul 2013 00:07:30 -0700, Paul Eggert <eggert <at> cs.ucla.edu> said:

> Thanks for reporting that.  I installed what I hope is a fix.  Could
> you please try trunk bzr 113430 or later, on one of those platforms?

Yes.  Subprocess invocation no longer hangs on Cent OS 5 or Mac OS X
10.6.  Closing the bug.

BTW, the transition from explicit file descriptor close before exec by
close-process-descs to the use of close-on-exec seems to work as a
workaround for a kernel bug on OS X 10.8, which causes kernel panic on
exit (Bug IDs 13682, 13726, 13799, 13901, 14119, and 14478).

				     YAMAMOTO Mitsuharu
				mituharu <at> math.s.chiba-u.ac.jp





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 14 Aug 2013 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 265 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.