Dave Thomas <dave / pragprog.com> writes:

> The following code
> 
>        require 'net/ftp'
> 
>        ftp = Net::FTP.new('www.ruby-lang.org')
>        ftp.login
>        ftp.chdir('pub/ruby/contrib')
>        files = ftp.list('n*')
> 
> Generates
> 
>          /usr/lib/ruby/1.9/net/ftp.rb:279:in `peeraddr': getnameinfo: 
> System error (SocketError)
>          from /usr/lib/ruby/1.9/net/ftp.rb:279:in `sendport'
>          from /usr/lib/ruby/1.9/net/ftp.rb:298:in `makeport'
>          from /usr/lib/ruby/1.9/net/ftp.rb:329:in `transfercmd'
>          from /usr/lib/ruby/1.9/net/ftp.rb:421:in `retrlines'
>          from /usr/lib/ruby/1.9/net/ftp.rb:419:in `synchronize'
>          from /usr/lib/ruby/1.9/net/ftp.rb:419:in `retrlines'
>          from /usr/lib/ruby/1.9/net/ftp.rb:628:in `list'
>          from t.rb:8
> 
> I've tried rebuilding with --with-lookup-order-hack=INET: made no 
> difference.
> 
> Any ideas?

No ideas, but here is another data point. I ran the code on my Mac OS X
machine running Panther and saw slightly different results:

/tmp> ./ftp_test.rb
/usr/local/lib/ruby/1.9/net/ftp.rb:295:in `addr': getnameinfo: nodename nor
servname provided, or not known (SocketError)
        from /usr/local/lib/ruby/1.9/net/ftp.rb:295:in `makeport'
        from /usr/local/lib/ruby/1.9/net/ftp.rb:329:in `transfercmd'
        from /usr/local/lib/ruby/1.9/net/ftp.rb:421:in `retrlines'
        from /usr/local/lib/ruby/1.9/net/ftp.rb:419:in `synchronize'
        from /usr/local/lib/ruby/1.9/net/ftp.rb:419:in `retrlines'
        from /usr/local/lib/ruby/1.9/net/ftp.rb:628:in `list'
        from ./ftp_test.rb:8

Jim
-- 
Jim Menard, jimm / io.com, http://www.io.com/~jimm/
"College students tend to rate all knowledge based on its ability to supply
them with beer. (There's an implicit conversion between money and beer that
occurs in there - but its transparent to the thought process)."
    -- Todd Blanchard