all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#5819: 23.1.93; OSX: start-process sometimes returns an unready process
@ 2010-04-01 17:55 Markus Triska
  2010-04-04  5:29 ` YAMAMOTO Mitsuharu
  0 siblings, 1 reply; 7+ messages in thread
From: Markus Triska @ 2010-04-01 17:55 UTC (permalink / raw)
  To: 5819

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







^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#5819: 23.1.93; OSX: start-process sometimes returns an unready process
  2010-04-01 17:55 bug#5819: 23.1.93; OSX: start-process sometimes returns an unready process Markus Triska
@ 2010-04-04  5:29 ` YAMAMOTO Mitsuharu
  2010-04-08  9:38   ` YAMAMOTO Mitsuharu
  0 siblings, 1 reply; 7+ messages in thread
From: YAMAMOTO Mitsuharu @ 2010-04-04  5:29 UTC (permalink / raw)
  To: Markus Triska; +Cc: 5819

>>>>> On Thu, 01 Apr 2010 19:55:11 +0200, Markus Triska <markus.triska@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@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







^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#5819: 23.1.93; OSX: start-process sometimes returns an unready process
  2010-04-04  5:29 ` YAMAMOTO Mitsuharu
@ 2010-04-08  9:38   ` YAMAMOTO Mitsuharu
  2010-04-08 22:10     ` Markus Triska
  0 siblings, 1 reply; 7+ messages in thread
From: YAMAMOTO Mitsuharu @ 2010-04-08  9:38 UTC (permalink / raw)
  To: Markus Triska; +Cc: 5819

>>>>> On Sun, 04 Apr 2010 14:29:44 +0900, YAMAMOTO Mitsuharu <mituharu@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@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







^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#5819: 23.1.93; OSX: start-process sometimes returns an unready process
  2010-04-08  9:38   ` YAMAMOTO Mitsuharu
@ 2010-04-08 22:10     ` Markus Triska
  2010-04-09  0:48       ` YAMAMOTO Mitsuharu
  0 siblings, 1 reply; 7+ messages in thread
From: Markus Triska @ 2010-04-08 22:10 UTC (permalink / raw)
  To: YAMAMOTO Mitsuharu; +Cc: 5819

YAMAMOTO Mitsuharu <mituharu@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!






^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#5819: 23.1.93; OSX: start-process sometimes returns an unready process
  2010-04-08 22:10     ` Markus Triska
@ 2010-04-09  0:48       ` YAMAMOTO Mitsuharu
  2010-04-09 13:14         ` Stefan Monnier
  0 siblings, 1 reply; 7+ messages in thread
From: YAMAMOTO Mitsuharu @ 2010-04-09  0:48 UTC (permalink / raw)
  To: Markus Triska; +Cc: Chong Yidong, 5819

>>>>> On Fri, 09 Apr 2010 00:10:09 +0200, Markus Triska <markus.triska@gmx.at> said:

> YAMAMOTO Mitsuharu <mituharu@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@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






^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#5819: 23.1.93; OSX: start-process sometimes returns an unready process
  2010-04-09  0:48       ` YAMAMOTO Mitsuharu
@ 2010-04-09 13:14         ` Stefan Monnier
  2010-04-10 10:34           ` bug#726: " YAMAMOTO Mitsuharu
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2010-04-09 13:14 UTC (permalink / raw)
  To: YAMAMOTO Mitsuharu; +Cc: Chong Yidong, 5819, Markus Triska

>>> 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






^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#726: bug#5819: 23.1.93; OSX: start-process sometimes returns an unready process
  2010-04-09 13:14         ` Stefan Monnier
@ 2010-04-10 10:34           ` YAMAMOTO Mitsuharu
  0 siblings, 0 replies; 7+ messages in thread
From: YAMAMOTO Mitsuharu @ 2010-04-10 10:34 UTC (permalink / raw)
  To: 5819-done, 726-done

>>>>> On Fri, 09 Apr 2010 09:14:48 -0400, Stefan Monnier <monnier@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@math.s.chiba-u.ac.jp






^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-04-10 10:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-01 17:55 bug#5819: 23.1.93; OSX: start-process sometimes returns an unready process Markus Triska
2010-04-04  5:29 ` YAMAMOTO Mitsuharu
2010-04-08  9:38   ` YAMAMOTO Mitsuharu
2010-04-08 22:10     ` Markus Triska
2010-04-09  0:48       ` YAMAMOTO Mitsuharu
2010-04-09 13:14         ` Stefan Monnier
2010-04-10 10:34           ` bug#726: " YAMAMOTO Mitsuharu

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.