Ftp/socket problem on OSX

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:inmakeport’
from /usr/lib/ruby/1.9/net/ftp.rb:329:in transfercmd' from /usr/lib/ruby/1.9/net/ftp.rb:421:inretrlines’
from /usr/lib/ruby/1.9/net/ftp.rb:419:in synchronize' from /usr/lib/ruby/1.9/net/ftp.rb:419:inretrlines’
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?

Cheers

Dave

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

/usr/lib/ruby/1.6/net/ftp.rb:175:in addr': getnameinfo: nodename nor servname provided, or not known (SocketError) from /usr/lib/ruby/1.6/net/ftp.rb:175:inmakeport’
from /usr/lib/ruby/1.6/net/ftp.rb:209:in transfercmd' from /usr/lib/ruby/1.6/net/ftp.rb:286:inretrlines’
from /usr/lib/ruby/1.6/net/ftp.rb:285:in mon_synchronize' from /usr/lib/ruby/1.6/net/ftp.rb:285:inretrlines’
from /usr/lib/ruby/1.6/net/ftp.rb:447:in `list’
from rt:6

On my Linux box I get

/usr/lib/ruby/1.6/net/ftp.rb:129:in `getresp’: 500 Illegal PORT command.
(Net::FTPPermError)

    from /usr/lib/ruby/1.6/net/ftp.rb:137:in `voidresp'
    from /usr/lib/ruby/1.6/net/ftp.rb:154:in `voidcmd'
    from /usr/lib/ruby/1.6/net/ftp.rb:153:in `mon_synchronize'
    from /usr/lib/ruby/1.6/net/ftp.rb:153:in `voidcmd'
    from /usr/lib/ruby/1.6/net/ftp.rb:170:in `sendport'
    from /usr/lib/ruby/1.6/net/ftp.rb:178:in `makeport'
    from /usr/lib/ruby/1.6/net/ftp.rb:209:in `transfercmd'
    from /usr/lib/ruby/1.6/net/ftp.rb:286:in `retrlines'
    from /usr/lib/ruby/1.6/net/ftp.rb:285:in `mon_synchronize'
    from /usr/lib/ruby/1.6/net/ftp.rb:285:in `retrlines'
    from /usr/lib/ruby/1.6/net/ftp.rb:447:in `list'
    from rt:6

maybe it is not an OSX error?

···

From my OSX box I get

I’ve tried rebuilding with --with-lookup-order-hack=INET: made no
difference.

Any ideas?

I’d like to echo your woes and point to my own look into the problem:

http://groups.google.com/groups?selm=26074B0E-6148-11D8-A281
-000A958E6254%40loudthinking.com

It didn’t get any traction at the time of posting, though. Hopefully
yours will do better :slight_smile:

···


David Heinemeier Hansson,
http://rails.nextangle.com/ – Rails: Web-applications in Ruby
http://www.basecamphq.com/ – Web-based Project Management
http://www.loudthinking.com/ – Broadcasting Brain