Hello all,

Well, I'm sorry to start my contribution to ruby-talk with a problem report,
therefore I would first like to say that I'm very pleased with Ruby, it's
sound design and great usability.

(and now, the serious matter)


My development environment is:

- SuSE Linux 7.2 (kernel 2.4.4)
- ruby 1.6.4
- drb-1.3.2 (distributed ruby)

The problem:

When  I start scripts from the sample distribution of druby, I get an error
like the following:

-------------------------------------------------------------------
[bctpc112:16:cboos ...y/drb-1.3.2/sample] ruby darrayc.rb \
druby://bctpc112:1234

/usr/local/lib/ruby/site_ruby/1.6/drb/drb.rb:260:in `addr': getnameinfo:
ai_family not supported (SocketError)
        from /usr/local/lib/ruby/site_ruby/1.6/drb/drb.rb:260:in `initialize'
        from /usr/local/lib/ruby/site_ruby/1.6/drb/drb.rb:390:in `new'
        from /usr/local/lib/ruby/site_ruby/1.6/drb/drb.rb:390:in
`start_service'        from darrayc.rb:11
--------------------------------

The relevant code is:

-------------------------------------------------------------------
darrayc.rb:11  	DRb.start_service(nil, nil)
...
drb.rb:260	      port = @soc.addr[1] if @soc
--------------------------------

The problem is reproductible within this short session:

-------------------------------------------------------------------
irb(main):001:0> require 'socket'
true
irb(main):002:0> soc = TCPServer.open(0)
#<TCPServer:0x401dbe4c>
irb(main):003:0> soc.addr[1]
SocketError: getnameinfo: ai_family not supported
        from (irb):6:in `addr'
        from (irb):6
--------------------------------

Suggested fix:

The problem appears to be related to the use of the constant PF_UNSPEC,
line 809 in 'open_inet()' from file "ext/socket/socket.c".
Changing it to PF_INET solves to problem, however I don't know enough about
the code to see if this is a proper fix. or just a hack :)

I will follow up with similar experiments on a W2K platform.

-- Christian Boos
-- BCT Technology AG