[#22195] IO::for_io and TCPServer#bind — GOTOU Yuuzou <gotoyuzo@...>

test_drb が IPv4 射影アドレスが有効な環境でないと動かないこ

16 messages 2003/12/09
[#22198] Re: IO::for_io and TCPServer#bind — matz@... (Yukihiro Matsumoto) 2003/12/09

まつもと ゆきひろです

[#22205] yet another inconsistency about EOF between StringIO and IO — Tanaka Akira <akr@...17n.org>

StringIO の

24 messages 2003/12/10
[#22206] Re: yet another inconsistency about EOF between StringIO and IO — nobu.nakada@... 2003/12/10

なかだです。

[#22214] Re: yet another inconsistency about EOF between StringIO and IO — Tanaka Akira <akr@...17n.org> 2003/12/10

In article <200312100725.hBA7P8Ac011112@sharui.nakada.kanuma.tochigi.jp>,

[#22222] Re: yet another inconsistency about EOF between StringIO and IO — nobu.nakada@... 2003/12/10

なかだです。

[#22234] Re: yet another inconsistency about EOF between StringIO and IO — Masahiro Sakai (酒井政裕) <sakai@...> 2003/12/11

さかいといいます。

[#22262] Re: yet another inconsistency about EOF between StringIO and IO — Tanaka Akira <akr@...17n.org> 2003/12/13

In article <20031211.214041.71090239.sakai@tom.sfc.keio.ac.jp>,

[#22328] Re: yet another inconsistency about EOF between StringIO and IO — Tanaka Akira <akr@...17n.org> 2003/12/23

In article <87k751dzyf.fsf@serein.a02.aist.go.jp>,

[#22331] Re: yet another inconsistency about EOF between StringIO and IO — matz@... (Yukihiro Matsumoto) 2003/12/23

まつもと ゆきひろです

[#22334] Re: yet another inconsistency about EOF between StringIO and IO — Tanaka Akira <akr@...17n.org> 2003/12/23

In article <1072167374.096702.13473.nullmailer@picachu.netlab.jp>,

[#22343] Re: yet another inconsistency about EOF between StringIO and IO — matz@... (Yukihiro Matsumoto) 2003/12/23

まつもと ゆきひろです

[#22330] core dump with ungetc — Tanaka Akira <akr@...17n.org>

次のように ungetc を使うと core を吐く場合があります。

14 messages 2003/12/23
[#22332] Re: core dump with ungetc — nobu.nakada@... 2003/12/23

なかだです。

[#22366] `to_s': method `to_s' overridden (TypeError) — Tanaka Akira <akr@...17n.org>

そういえば、次の `to_s': method `to_s' overridden (TypeError) というの

12 messages 2003/12/24

[#22385] Tk.callback_break causes seg-fault or hang-up — Hidetoshi NAGAI <nagai@...>

永井@知能.九工大です.

19 messages 2003/12/24
[#22387] Re: Tk.callback_break causes seg-fault or hang-up — matz@... (Yukihiro Matsumoto) 2003/12/24

まつもと ゆきひろです

[#22393] Re: Tk.callback_break causes seg-fault or hang-up — Hidetoshi NAGAI <nagai@...> 2003/12/24

永井@知能.九工大です.

[#22395] Re: Tk.callback_break causes seg-fault or hang-up — matz@... (Yukihiro Matsumoto) 2003/12/24

まつもと ゆきひろです

[#22396] Re: Tk.callback_break causes seg-fault or hang-up — matz@... (Yukihiro Matsumoto) 2003/12/24

まつもと ゆきひろです

[#22397] Re: Tk.callback_break causes seg-fault or hang-up — Hidetoshi NAGAI <nagai@...> 2003/12/24

永井@知能.九工大です.

[#22418] ruby-1.8.1 build failed on HP-UX 11.11 — MIYAMUKO Katsuyuki <k-miyamuko@...>

みやむこです。

29 messages 2003/12/25
[#22419] Re: ruby-1.8.1 build failed on HP-UX 11.11 — matz@... (Yukihiro Matsumoto) 2003/12/25

まつもと ゆきひろです

[#22420] Re: ruby-1.8.1 build failed on HP-UX 11.11 — matz@... (Yukihiro Matsumoto) 2003/12/25

まつもと ゆきひろです

[#22424] Re: ruby-1.8.1 build failed on HP-UX 11.11 — MIYAMUKO Katsuyuki <k-miyamuko@...> 2003/12/25

みやむこです。

[#22491] Re: ruby-1.8.1 build failed on HP-UX 11.11 — MIYAMUKO Katsuyuki <k-miyamuko@...> 2004/01/05

みやむこです。

[ruby-dev:22245] Re: 1.8.1 preview3

From: nobu.nakada@...
Date: 2003-12-12 09:29:07 UTC
List: ruby-dev #22245
なかだです。

At Wed, 10 Dec 2003 15:00:54 +0900,
U.Nakamura wrote:
> ごとうゆうぞうさんが直し方を発見して、それにわたなべひろふみさんが
> 手を加えたものを、私が代理で先ほどcommitしておきました。
> # ややこしい
> 
> たぶん直ってると思いますが、よかったら確認してみてください。

これは条件が変わってコンパイルされる部分が変わったわけですが、
元の部分(!defined(TIOCSCTTY)のとき)を使う環境では解決していない
ような気がします。一度slaveをclose()してしまうのがまずいのでは
なかろうか、という推測でこういうパッチを作ってみましたが、実際
そういう環境は持ってないのでよく分かりません。

あと、できればPTY::ChildExited#initializeも。


Index: ext/pty/pty.c
===================================================================
RCS file: /cvs/ruby/src/ruby/ext/pty/pty.c,v
retrieving revision 1.19
diff -u -2 -p -d -r1.19 pty.c
--- ext/pty/pty.c	11 Dec 2003 02:39:59 -0000	1.19
+++ ext/pty/pty.c	12 Dec 2003 09:00:21 -0000
@@ -119,4 +119,20 @@ extern int errno;
 
 static VALUE eChildExited;
+extern VALUE rb_last_status;
+
+static VALUE
+echild_initialize(argc, argv, self)
+    int argc;
+    VALUE *argv;
+    VALUE self;
+{
+    VALUE mesg, status;
+    if (rb_scan_args(argc, argv, "11", &mesg, &status) < 2) {
+	status = rb_last_status;
+    }
+    rb_call_super(1, &mesg);
+    rb_iv_set(self, "status", status);
+    return self;
+}
 
 static VALUE
@@ -133,19 +149,4 @@ struct pty_info {
 };
 
-static void
-raise_from_wait(state, info)
-    struct pty_info *info;
-    char *state;
-{
-    extern VALUE rb_last_status;
-    char buf[1024];
-    VALUE exc;
-
-    snprintf(buf, sizeof(buf), "pty - %s: %d", state, info->child_pid);
-    exc = rb_exc_new2(eChildExited, buf);
-    rb_iv_set(exc, "status", rb_last_status);
-    rb_funcall(info->thread, rb_intern("raise"), 1, exc);
-}
-
 static VALUE
 pty_syswait(info)
@@ -153,4 +154,6 @@ pty_syswait(info)
 {
     int cpid, status;
+    char buf[40], *state;
+    VALUE exc, args[2];
 
     for (;;) {
@@ -159,21 +162,22 @@ pty_syswait(info)
 
 #if defined(IF_STOPPED)
-	if (IF_STOPPED(status)) { /* suspend */
-	    raise_from_wait("stopped", info);
-	}
-#elif defined(WIFSTOPPED)
-	if (WIFSTOPPED(status)) { /* suspend */
-	    raise_from_wait("stopped", info);
-	}
-#else
+#define WIFSTOPPED(status) IF_STOPPED(status)
+#elif !defined(WIFSTOPPED)
 ---->> Either IF_STOPPED or WIFSTOPPED is needed <<----
 #endif /* WIFSTOPPED | IF_STOPPED */
+	if (WIFSTOPPED(status)) { /* suspend */
+	    state = "stopped";
+	}
 	else if (kill(info->child_pid, 0) == 0) {
-	    raise_from_wait("changed", info);
+	    state = "changed";
 	}
 	else {
-	    raise_from_wait("exited", info);
-	    return Qnil;
+	    state = "exited";
 	}
+	snprintf(buf, sizeof(buf), "pty - %s: %d", state, info->child_pid);
+	args[0] = rb_str_new2(buf);
+	args[1] = rb_last_status;
+	exc = rb_class_new_instance(2, args, eChildExited);
+	rb_funcall(info->thread, rb_intern("raise"), 1, exc);
     }
 }
@@ -268,5 +272,5 @@ establishShell(argc, argv, info)
 	/* errors ignored for sun */
 #else
-	close(slave);
+	i = slave;
 	slave = open(SlaveName, O_RDWR);
 	if (slave < 0) {
@@ -274,4 +278,5 @@ establishShell(argc, argv, info)
 	    _exit(1);
 	}
+	close(i);
 	close(master);
 #endif


-- 
--- 僕の前にBugはない。
--- 僕の後ろにBugはできる。
    中田 伸悦

In This Thread