GNU bug report logs - #5819
23.1.93; OSX: start-process sometimes returns an unready process

Previous Next

Package: emacs;

Reported by: Markus Triska <markus.triska <at> gmx.at>

Date: Thu, 1 Apr 2010 17:56:02 UTC

Severity: normal

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 5819 in the body.
You can then email your comments to 5819 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 owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5819; Package emacs. (Thu, 01 Apr 2010 17:56:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Markus Triska <markus.triska <at> gmx.at>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 01 Apr 2010 17:56:02 GMT) Full text and rfc822 format available.

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

From: Markus Triska <markus.triska <at> gmx.at>
To: bug-gnu-emacs <at> gnu.org
Subject: 23.1.93; OSX: start-process sometimes returns an unready process
Date: Thu, 01 Apr 2010 19:55:11 +0200
Let testprocess.el consist of the following form:

    (let (p (n 1))
      (while t
        (message "iteration %s" n)
        (setq n (1+ n)
              p (start-process "bc" nil "bc"))
        (process-send-string p "test")
        (delete-process p)))

On OSX 10.4, when I do "$ emacs -Q --script testprocess.el", I get:

   $ emacs -Q --script testprocess.el
   iteration 1
   iteration 2
   iteration 3
   writing to process: Input/output error, bc

and sometimes, particularly under high system load:

   $ emacs -Q --script testprocess.el
   iteration 1
   iteration 2
   Process bc not running

The number of iterations often varies over invocations.

In GNU Emacs 23.1.93.1 (i386-apple-darwin8.11.1)
 of 2010-04-01 on mt-computer.local
configured using `configure  '--without-x''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: nil
  value of $XMODIFIERS: nil
  locale-coding-system: nil
  default enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t





Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5819; Package emacs. (Sun, 04 Apr 2010 05:30:03 GMT) Full text and rfc822 format available.

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

From: YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>
To: Markus Triska <markus.triska <at> gmx.at>
Cc: 5819 <at> debbugs.gnu.org
Subject: Re: bug#5819: 23.1.93;
	OSX: start-process sometimes returns an unready process
Date: Sun, 04 Apr 2010 14:29:44 +0900
>>>>> On Thu, 01 Apr 2010 19:55:11 +0200, Markus Triska <markus.triska <at> gmx.at> said:

> Let testprocess.el consist of the following form:
>     (let (p (n 1))
>       (while t
>         (message "iteration %s" n)
>         (setq n (1+ n)
>               p (start-process "bc" nil "bc"))
>         (process-send-string p "test")
>         (delete-process p)))

> On OSX 10.4, when I do "$ emacs -Q --script testprocess.el", I get:

>    $ emacs -Q --script testprocess.el
>    iteration 1
>    iteration 2
>    iteration 3
>    writing to process: Input/output error, bc

> and sometimes, particularly under high system load:

>    $ emacs -Q --script testprocess.el
>    iteration 1
>    iteration 2
>    Process bc not running

> The number of iterations often varies over invocations.

I could reproduce it on Mac OS X 10.3 and 10.4, but not on 10.5 and
10.6.

The following patch, which uses openpty, seems to work for me on 10.4,
but not on 10.3.  I suspect a bug in the kernel.

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

=== modified file 'src/s/darwin.h'
*** src/s/darwin.h	2010-03-30 04:55:59 +0000
--- src/s/darwin.h	2010-04-04 04:50:02 +0000
***************
*** 90,95 ****
--- 90,121 ----
   */
  
  #define HAVE_PTYS
+ /* Run only once.  We need a `for'-loop because the code uses
+    `continue'.  */
+ #define PTY_ITERATION	for (i = 0; i < 1; i++)
+ #define PTY_NAME_SPRINTF	/* none */
+ #define PTY_TTY_NAME_SPRINTF	/* none */
+ #define PTY_OPEN						\
+   do								\
+     {								\
+       int slave, tem;						\
+       if (openpty (&fd, &slave, pty_name, NULL, NULL) == -1)	\
+ 	{							\
+ 	  fd = -1;						\
+ 	  break;						\
+ 	}							\
+       emacs_close (slave);					\
+       tem = fcntl (fd, F_GETFL, 0);				\
+       if (tem >= 0)						\
+ 	tem = fcntl (fd, F_SETFL, tem | O_NONBLOCK);		\
+       if (tem < 0)						\
+ 	{							\
+ 	  emacs_close (fd);					\
+ 	  fd = -1;						\
+ 	  break;						\
+ 	}							\
+     }								\
+   while (0)
  
  /**
   * PTYs only work correctly on Darwin 7 or higher.  So make the





Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5819; Package emacs. (Thu, 08 Apr 2010 09:39:02 GMT) Full text and rfc822 format available.

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

From: YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>
To: Markus Triska <markus.triska <at> gmx.at>
Cc: 5819 <at> debbugs.gnu.org
Subject: Re: bug#5819: 23.1.93;
	OSX: start-process sometimes returns an unready process
Date: Thu, 08 Apr 2010 18:38:32 +0900
>>>>> On Sun, 04 Apr 2010 14:29:44 +0900, YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp> said:

> The following patch, which uses openpty, seems to work for me on
> 10.4, but not on 10.3.  I suspect a bug in the kernel.

The following simpler one seems to work for me on 10.4 (but not on
10.3, again).  Could you test if it also works for you, with respect
to this problem and #726 (23.0.60; OSX: Complete OS crash)?

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

=== modified file 'src/s/darwin.h'
*** src/s/darwin.h	2010-03-30 04:55:59 +0000
--- src/s/darwin.h	2010-04-05 03:21:53 +0000
***************
*** 90,95 ****
--- 90,113 ----
   */
  
  #define HAVE_PTYS
+ /* Run only once.  We need a `for'-loop because the code uses
+    `continue'.  */
+ #define PTY_ITERATION	for (i = 0; i < 1; i++)
+ #define PTY_NAME_SPRINTF	/* none */
+ #define PTY_TTY_NAME_SPRINTF	/* none */
+ /* Note that openpty may fork via grantpt on Mac OS X 10.4/Darwin 8.
+    But we don't have to block SIGCHLD because it is blocked in the
+    implementation of grantpt.  */
+ #define PTY_OPEN						\
+   do								\
+     {								\
+       int slave;						\
+       if (openpty (&fd, &slave, pty_name, NULL, NULL) == -1)	\
+ 	fd = -1;						\
+       else							\
+ 	emacs_close (slave);					\
+     }								\
+   while (0)
  
  /**
   * PTYs only work correctly on Darwin 7 or higher.  So make the





Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5819; Package emacs. (Thu, 08 Apr 2010 22:11:01 GMT) Full text and rfc822 format available.

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

From: Markus Triska <markus.triska <at> gmx.at>
To: YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>
Cc: 5819 <at> debbugs.gnu.org
Subject: Re: bug#5819: 23.1.93;
	OSX: start-process sometimes returns an unready process
Date: Fri, 09 Apr 2010 00:10:09 +0200
YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp> writes:

> The following simpler one seems to work for me on 10.4 (but not on
> 10.3, again).  Could you test if it also works for you, with respect
> to this problem and #726 (23.0.60; OSX: Complete OS crash)?

Your patch fixes both issues for me. Thank you very much!




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5819; Package emacs. (Fri, 09 Apr 2010 00:49:01 GMT) Full text and rfc822 format available.

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

From: YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>
To: Markus Triska <markus.triska <at> gmx.at>
Cc: Chong Yidong <cyd <at> stupidchicken.com>, 5819 <at> debbugs.gnu.org,
	Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#5819: 23.1.93;
	OSX: start-process sometimes returns an unready process
Date: Fri, 09 Apr 2010 09:48:29 +0900
>>>>> On Fri, 09 Apr 2010 00:10:09 +0200, Markus Triska <markus.triska <at> gmx.at> said:

> YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp> writes:
>> The following simpler one seems to work for me on 10.4 (but not on
>> 10.3, again).  Could you test if it also works for you, with
>> respect to this problem and #726 (23.0.60; OSX: Complete OS crash)?

> Your patch fixes both issues for me. Thank you very much!

Thanks for testing.

Maintainers, which branch should I install this patch to?  Bug#726 is
marked as important.

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

=== modified file 'src/s/darwin.h'
*** src/s/darwin.h	2010-03-30 04:55:59 +0000
--- src/s/darwin.h	2010-04-05 03:21:53 +0000
***************
*** 90,95 ****
--- 90,113 ----
   */
  
  #define HAVE_PTYS
+ /* Run only once.  We need a `for'-loop because the code uses
+    `continue'.  */
+ #define PTY_ITERATION	for (i = 0; i < 1; i++)
+ #define PTY_NAME_SPRINTF	/* none */
+ #define PTY_TTY_NAME_SPRINTF	/* none */
+ /* Note that openpty may fork via grantpt on Mac OS X 10.4/Darwin 8.
+    But we don't have to block SIGCHLD because it is blocked in the
+    implementation of grantpt.  */
+ #define PTY_OPEN						\
+   do								\
+     {								\
+       int slave;						\
+       if (openpty (&fd, &slave, pty_name, NULL, NULL) == -1)	\
+ 	fd = -1;						\
+       else							\
+ 	emacs_close (slave);					\
+     }								\
+   while (0)
  
  /**
   * PTYs only work correctly on Darwin 7 or higher.  So make the




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5819; Package emacs. (Fri, 09 Apr 2010 13:16:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>
Cc: Chong Yidong <cyd <at> stupidchicken.com>, 5819 <at> debbugs.gnu.org,
	Markus Triska <markus.triska <at> gmx.at>
Subject: Re: bug#5819: 23.1.93;
	OSX: start-process sometimes returns an unready process
Date: Fri, 09 Apr 2010 09:14:48 -0400
>>> The following simpler one seems to work for me on 10.4 (but not on
>>> 10.3, again).  Could you test if it also works for you, with
>>> respect to this problem and #726 (23.0.60; OSX: Complete OS crash)?
>> Your patch fixes both issues for me. Thank you very much!
> Maintainers, which branch should I install this patch to?  Bug#726 is
> marked as important.

I'd say emacs-23,
Thank you,


        Stefan




Reply sent to YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>:
You have taken responsibility. (Sat, 10 Apr 2010 10:35:01 GMT) Full text and rfc822 format available.

Notification sent to Markus Triska <markus.triska <at> gmx.at>:
bug acknowledged by developer. (Sat, 10 Apr 2010 10:35:01 GMT) Full text and rfc822 format available.

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

From: YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>
To: 5819-done <at> debbugs.gnu.org, 726-done <at> debbugs.gnu.org
Subject: Re: bug#5819: 23.1.93;
	OSX: start-process sometimes returns an unready process
Date: Sat, 10 Apr 2010 19:34:03 +0900
>>>>> On Fri, 09 Apr 2010 09:14:48 -0400, Stefan Monnier <monnier <at> IRO.UMontreal.CA> said:

>>>> The following simpler one seems to work for me on 10.4 (but not
>>>> on 10.3, again).  Could you test if it also works for you, with
>>>> respect to this problem and #726 (23.0.60; OSX: Complete OS
>>>> crash)?
>>> Your patch fixes both issues for me. Thank you very much!
>> Maintainers, which branch should I install this patch to?  Bug#726
>> is marked as important.

> I'd say emacs-23, Thank you,

Done.

				     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. (Sat, 08 May 2010 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 15 years and 47 days ago.

Previous Next


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