Socket hang (was recursive call problem)

Ok…Here’s the new code…might be a bug in net/ftp or the socket code. The
exact same code (logically) modified runs like a champ under PHP. I’ve
tested this Ruby code on 1.8.0 on both Solaris and Windows. Same problem.
It hangs on a socket read…

---- trace error ----
call /usr/local/lib/ruby/1.8/net/ftp.rb:191 getline Net::FTP
line /usr/local/lib/ruby/1.8/net/ftp.rb:192 getline Net::FTP
c-call /usr/local/lib/ruby/1.8/net/ftp.rb:192 readline IO

···

CODE :

require ‘net/ftp’

set_trace_func proc { |event, file, line, id, binding, classname|
printf “%8s %s:%-2d %10s %8s\n”, event, file, line, id, classname
}

def reDir(ftp, dir)
ftp.chdir(dir)
puts ftp.pwd()

ftp.list('.') do |entry|
    puts caller.join("\n")
    tmp = entry.split(/ +/)
    newentry = tmp[8]
    ### result = ftp_site($con, "CHMOD 777 $newentry");
    result = 1
    puts "#{newentry} -- #{result}";
    if entry =~ /^d/
        reDir(ftp, newentry);
    end
end
ftp.chdir('..')

end

ftpServer = 'ftp.blah.com
ftpUser = 'blahuser’
ftpPass = ‘blahpass’

ftp = Net::FTP.new(ftpServer, ftpUser, ftpPass)
reDir(ftp, ‘/var/www/html/mambo’)
ftp.close()

Any help would be appreciated!!

thanks!
Greg Brondo

    ftp.list('.') do |entry|

       ftp.list('.').each do |entry|

        puts caller.join("\n")

Guy Decoux

Thanks! That worked. One more questions though…

Why is ftp.list so dog slow?

Thanks again! (This really is a great list)…

Greg B

“ts” decoux@moulon.inra.fr wrote in message
news:200401210935.i0L9ZEX27407@moulon.inra.fr

···
ftp.list('.') do |entry|
   ftp.list('.').each do |entry|
    puts caller.join("\n")

Guy Decoux