小松です。

ruby-1.4.5-i586-beos-socket.zipを作ろうと思ってテストセットを
動かしていたら、dualstack-httpd.rbが落ちました。
1.5.4でも落ちます。

% ruby-1.4.5 -v dualstack-httpd.rb ruby 1.4.5 (2000-06-24) [sparc-solaris2.5.1] dualstack-httpd.rb:16: [BUG] Segmentation fault 異常終了 (コアダンプしました。) % gdb ruby-1.4.5 GNU gdb 5.0 ... (gdb) run dualstack-httpd.rb Starting program: /usr/local/bin/ruby-1.4.5 dualstack-httpd.rb Program received signal SIGSEGV, Segmentation fault. 0xef735bc8 in sock_s_getnameinfo (argc=2, argv=0xefffdeb8) at /home/atropos/src/ruby-1.4.5/ext/socket/socket.c:1999 1999 for (r = res->ai_next; r; r = r->ai_next) { (gdb) p res $1 = (struct addrinfo__compat *) 0x0 (gdb) p ((struct RString *)sa)->basic.flags & 0x7f $2 = 7 (gdb)
Sun Jun 25 00:55:03 2000 Katsuyuki Komatsu <komatsu / sarion.co.jp> * ext/socket/socket.c (sock_s_getnameinfo): `res' would not be assigned if TYPE(sa) == T_STRING.
diff -ru1p ruby-1.4.5.dist/ext/socket/socket.c ruby-1.4.5/ext/socket/socket.c --- ruby-1.4.5.dist/ext/socket/socket.c Wed May 31 17:10:04 2000 +++ ruby-1.4.5/ext/socket/socket.c Sun Jun 25 00:55:03 2000 @@ -1960,15 +1960,17 @@ sock_s_getnameinfo(argc, argv) if (error) goto error_exit; - for (r = res->ai_next; r; r = r->ai_next) { - char hbuf2[1024], pbuf2[1024]; + if (res) { + for (r = res->ai_next; r; r = r->ai_next) { + char hbuf2[1024], pbuf2[1024]; - sap = r->ai_addr; - error = getnameinfo(sap, SA_LEN(sap), hbuf2, sizeof(hbuf2), - pbuf2, sizeof(pbuf2), fl); - if (error) goto error_exit; - if (strcmp(hbuf, hbuf2) != 0|| strcmp(pbuf, pbuf2) != 0) { - freeaddrinfo(res); - rb_raise(rb_eSocket, "sockaddr resolved to multiple nodename"); + sap = r->ai_addr; + error = getnameinfo(sap, SA_LEN(sap), hbuf2, sizeof(hbuf2), + pbuf2, sizeof(pbuf2), fl); + if (error) goto error_exit; + if (strcmp(hbuf, hbuf2) != 0|| strcmp(pbuf, pbuf2) != 0) { + freeaddrinfo(res); + rb_raise(rb_eSocket, "sockaddr resolved to multiple nodename"); + } } + freeaddrinfo(res); } - freeaddrinfo(res); return rb_assoc_new(rb_tainted_str_new2(hbuf), rb_tainted_str_new2(pbuf)); -- 小松克行 / Katsuyuki Komatsu <komatsu / sarion.co.jp>