[MacPorts] #15528: ruby @1.8.6-p114 patch to get Ruby's Socket classes to work with getaddrinfo under 10.5.3
MacPorts
noreply at macports.org
Thu Jun 5 23:46:53 PDT 2008
#15528: ruby @1.8.6-p114 patch to get Ruby's Socket classes to work with
getaddrinfo under 10.5.3
---------------------------------------------------+------------------------
Reporter: aguynamedryan+macports at gmail.com | Owner: macports-tickets at lists.macosforge.org
Type: defect | Status: new
Priority: Normal | Milestone: Port Bugs
Component: ports | Version: 1.6.0
Keywords: ruby getaddrinfo 10.5.3 drb TCPServer |
---------------------------------------------------+------------------------
Kurt Schrader posted in [http://www.ruby-forum.com/topic/154556 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.
--
Ticket URL: <http://trac.macports.org/ticket/15528>
MacPorts <http://www.macports.org/>
Ports system for Mac OS
More information about the macports-tickets
mailing list