# Open-uri behaviour change

**URL:** <https://www.ruby-forum.com/t/open-uri-behaviour-change/129485>\
**Category:** Ruby\
**Created:** [February 19, 2008, 12:04am UTC](https://www.ruby-forum.com/t/open-uri-behaviour-change/129485 "2008-02-19T00:04:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sclaerhout](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/85f322/32.png) [@sclaerhout](https://www.ruby-forum.com/u/sclaerhout)\
**Post date:** [February 19, 2008, 12:04am UTC](https://www.ruby-forum.com/t/open-uri-behaviour-change/129485/1 "2008-02-19T00:04:15Z")

</div>

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
