[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

open-uri behaviour change

Scott Cook

2/18/2008 11:04:00 PM

I noticed a change in behaviour for open-uri when using it for automatic
ftp

It works fine in Ruby 1.8.1 as follows:......
[foo@bar ~]$ ruby -v
ruby 1.8.1 (2003-12-25) [x86_64-linux-gnu]
[foo@bar ~]$ ruby -le 'require "open-uri"; gg =
open("ftp://user:password@server:/tmp/ftptest/file1.txt;type=i")'
[foo@bar ~]$

But it's broken in 1.8.6:............
[foo@bar ~]$ ruby -v
ruby 1.8.6 (2007-03-13 patchlevel 0) [x86_64-linux]
[foo@bar ~]$ ruby -le 'require "open-uri"; gg =
open("ftp://user:password@server:/tmp/ftptest/file1.txt;type=i")'
/usr/local/lib/ruby/1.8/net/ftp.rb:243:in `getresp': 550 tmp: No such
file or directory. (Net::FTPPermError)
from /usr/local/lib/ruby/1.8/net/ftp.rb:251:in `voidresp'
... blah blah blah ....
from -e:1
[foo@bar ~]$

After messing with it for a while, I found that the problem is that
open-uri now searches for "tmp" starting from the home directory of the
user that it logs in as (instead of from root, which would be logical
since the filename starts with "/")

a "workaround" is:
[foo@bar ~]$ ruby -le 'require "open-uri"; gg =
open("ftp://user:password@server:/../../../tmp/ftptest/file1.txt;type=i")'

which forces it to go to root and then find "tmp"


Where do I post this so that someone can do something about it?
Thanks!
Scott
--
Posted via http://www.ruby-....