Project

General

Profile

Actions

Bug #3124

closed

SocketError on SnowLeopard (during make test-all)

Added by tenderlovemaking (Aaron Patterson) about 14 years ago. Updated almost 13 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 1.9.2dev (2010-04-11 trunk 27293) [x86_64-darwin10.2.0]
Backport:
[ruby-core:29427]

Description

=begin
make test-all can't be run on Snow Leopard due to an error with TCPServer. The following code, when run on Snow Leopard will result in an error:

 require 'socket'
 TCPServer.new('localhost', 0)

It raises:

 $ ruby test.rb
 test.rb:2:in `initialize': getaddrinfo: nodename nor servname provided, or not known (SocketError)
 	from test.rb:2:in `new'
 	from test.rb:2:in `<main>'

I've attached a script to reproduce.
=end


Files

test.rb (47 Bytes) test.rb tenderlovemaking (Aaron Patterson), 04/11/2010 09:56 AM
patch-ruby_core_29427.diff (2.02 KB) patch-ruby_core_29427.diff fix this problem kimuraw (Wataru Kimura), 06/18/2010 01:00 AM
test_getaddrinfo.c (1.32 KB) test_getaddrinfo.c test code for getaddrinfo(3) kimuraw (Wataru Kimura), 06/18/2010 01:00 AM
patch-ruby_core_29427_2.diff (2.36 KB) patch-ruby_core_29427_2.diff rewrited patch kimuraw (Wataru Kimura), 06/18/2010 08:05 PM
patch-ruby_core_29427_3.diff (2.35 KB) patch-ruby_core_29427_3.diff kimuraw (Wataru Kimura), 06/22/2010 12:38 AM

Related issues 1 (0 open1 closed)

Related to Ruby 1.8 - Backport #3474: SocketError on SnowLeopard (during make test-all)Closedshyouhei (Shyouhei Urabe)Actions
Actions #1

Updated by naruse (Yui NARUSE) about 14 years ago

=begin
It is because of Mac OS X's getaddrinfo.
They raise error when it call getaddrinfo(3) with servname "0".
Whether it is Ruby's bug or Mac OS X's bug is still discussing.

see also: http://d.hatena.ne.jp/kimuraw/20100116/p1
=end

Actions #2

Updated by mame (Yusuke Endoh) almost 14 years ago

  • Assignee set to naruse (Yui NARUSE)

=begin
Hi, Naruse

It is because of Mac OS X's getaddrinfo.
They raise error when it call getaddrinfo(3) with servname "0".
Whether it is Ruby's bug or Mac OS X's bug is still discussing.

see also: http://d.hatena.ne.jp/kimuraw/20100116/p1

So what's the conclusion?

--
Yusuke Endoh
=end

Actions #3

Updated by kimuraw (Wataru Kimura) almost 14 years ago

=begin
I filed this problem of apple's ruby-1.8.7 as ID:7548770 to http://bugreport.apple.com/ at 2010-01-16.
The status the report is still "OPEN".

=end

Updated by kimuraw (Wataru Kimura) almost 14 years ago

=begin
I think this is a bug of Snow Leopard.

I checked results of getaddrinfo(3) with some pairs of hostname and servname.

Snow Leopard (10.6.4)

 host\serv   | "80"   "0"    ""    NULL 
 ------------+--------------------------- 
 "localhost" |  OK    NG(!)  OK    OK 
 ""          |  OK    OK     NG    NG 
 NULL        |  OK    OK     NG    NG 

Leopard (10.5.8)

 host\serv   | "80"   "0"    ""    NULL 
 ------------+--------------------------- 
 "localhost" |  OK    OK(!)  OK    OK 
 ""          |  OK    OK     NG    NG 
 NULL        |  OK    OK     NG    NG 

I make a patch for 1.9.2 r28350. this pacth makes "0" to NULL when hostname is given and servname is "0".
ruby-1.9.2dev with this patch passed all tests under test/socket/ on my Mac (10.6.4).

=end

Actions #5

Updated by akr (Akira Tanaka) almost 14 years ago

=begin
2010/6/18 Wataru Kimura :

Issue #3124 has been updated by Wataru Kimura.

File patch-ruby_core_29427.diff added
File test_getaddrinfo.c added

I think this is a bug of Snow Leopard.

I checked results of getaddrinfo(3) with some pairs of hostname and servname.

Your patch scatter MacOS X dependent code in raddrinfo.c.
I don't like it.

Is it possible to define getaddrinfo wrapper to fix the problem?
raddrinfo.c do it for AIX.
So AIX dependent code is not scattered.

Tanaka Akira

=end

Actions #6

Updated by kimuraw (Wataru Kimura) almost 14 years ago

=begin
Thanks for the advice!
I rewrite the patch as patch-ruby_core_29427_2.diff.

=end

Actions #7

Updated by akr (Akira Tanaka) almost 14 years ago

=begin
2010/6/18 Wataru Kimura :

I rewrite the patch as patch-ruby_core_29427_2.diff.

The patch for ext/socket/raddrinfo.c is acceptable.
But the patch for test/socket/test_socket.rb is not.

  • The result of Socket.gethostname may not be resolvable.
  • Opned IO should be closed.
    --
    Tanaka Akira

=end

Actions #8

Updated by kimuraw (Wataru Kimura) almost 14 years ago

=begin
I modified test/socket/test_socket.rb with tanaka-san's suggestions.
(attached file patch-ruby_core_29427_3.diff)

thanks again!

=end

Actions #9

Updated by akr (Akira Tanaka) almost 14 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

=begin
This issue was solved with changeset r28401.
Aaron, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0