Ticket #15528 (closed defect: fixed)
ruby @1.8.6-p114 patch to get Ruby's Socket classes to work with getaddrinfo under 10.5.3
|Reported by:||aguynamedryan+macports@…||Owned by:||pguyot@…|
|Keywords:||ruby getaddrinfo 10.5.3 drb TCPServer||Cc:|
Kurt Schrader posted in this thread, that after upgrading to Mac OS X 10.5.3 some calls to DRb fail with:
/opt/local/lib/ruby/1.8/drb/drb.rb:865:in `initialize': getaddrinfo: nodename nor servname provided, or not known (SocketError) from /opt/local/lib/ruby/1.8/drb/drb.rb:865:in `open' from /opt/local/lib/ruby/1.8/drb/drb.rb:865:in `open_server'
It appears that Ruby's calls to getaddrinfo which pass "0" for the servname argument are now returning EAI_NONAME instead of 0, which causes ruby to raise a SocketError
Andy Keep discovered that feeding nil in place of of "0" for the service number works:
irb(main):001:0> require 'socket' => true irb(main):011:0> Socket.getaddrinfo(Socket.gethostname, 0, Socket::AF_INET, Socket::SOCK_STREAM, nil, Socket::AI_CANONNAME) SocketError: getaddrinfo: nodename nor servname provided, or not known from (irb):11:in `getaddrinfo' from (irb):11 from :0 irb(main):012:0> Socket.getaddrinfo(Socket.gethostname, nil, Socket::AF_INET, Socket::SOCK_STREAM, nil, Socket::AI_CANONNAME) => [["AF_INET", 0, "192.168.1.95", "192.168.1.95", 2, 1, 6]]
I have discovered that TCPServer.open('localhost', 0) also fails under 10.5.3 both in MacPorts and in the Ruby installation that ships with Mac OS X Leopard.
I have very little socket programming experience, but I have made a patch that changes Socket's servname argument of "0" and replaces it with NULL before it is passed to getaddrinfo.
I have no idea what unintended effects this might cause, but it seems to have cleared up my problems with DRb and TCPServer for the time being.
- Cc aguynamedryan+macports@… removed
- Owner changed from macports-tickets@… to pguyot@…