Bugs item #5627, was opened at 2006-09-05 00:48
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1698&aid=5627&group_id=426

Category: Standard Library
Group: 1.8.5
Status: Open
Resolution: None
Priority: 3
Submitted By: Roy Wright (royw)
Assigned to: Nobody (None)
Summary: gem_server fails with getnameinfo: ai_family not supported

Initial Comment:
system info:
gentoo x86
dev-lang/ruby-1.8.5  USE="doc examples socks5 tcltk threads -cjk -debug -ipv6"

If gem_server is ran on a system without IPV6 support it will generate the following error:

2006-09-04 16:49:30] INFO  WEBrick 1.3.1
[2006-09-04 16:49:30] INFO  ruby 1.8.5 (2006-08-25) [i686-linux]
/usr/lib/ruby/1.8/webrick/utils.rb:63:in `getaddrinfo': getnameinfo: ai_family
not supported (SocketError)
        from /usr/lib/ruby/1.8/webrick/utils.rb:63:in `create_listeners'
        from /usr/lib/ruby/1.8/webrick/server.rb:75:in `listen'
        from /usr/lib/ruby/1.8/webrick/server.rb:63:in `initialize'
        from /usr/lib/ruby/1.8/webrick/httpserver.rb:24:in `initialize'
        from /usr/bin/gem_server:351:in `new'
        from /usr/bin/gem_server:351

The cause is this line in /usr/lib/ruby/1.8/webrick/utils.rb:

      res = Socket::getaddrinfo(address, port,
                                Socket::AF_UNSPEC,   # address family
                                Socket::SOCK_STREAM, # socket type
                                0,                   # protocol
                                Socket::AI_PASSIVE)  # flag

The problem is the Socket::AF_UNSPEC which is apparently causing getaddrinfo to
try some IPv6 processing.  Substituting Socket::AF_INET will let gem_server run just fine.

According to the Socket.getaddrinfo documentation, "You will usually pass either nil or Socket::AF_UNSPEC, allowing the IPv6 information to be returned first if host is reachable via IPv6, and IPv4 information otherwise."  I think this is assuming that the underlying OS has IPv6 support.

Thank you,
Roy


----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1698&aid=5627&group_id=426