Getcwd not found: rails 1.1.6, file_column (svn)


#1

Hi,

I get an “Errno::ENOENT No such file or directory - getcwd”, after
finishing an upload process by the file_column plugin, and just before
a redirection.

The action which receives the POST with the upload information is

def presentation
(…)
save_file(@presentation, params[:presentation])
(…)
redirect_to :action => ‘admin’
end

If I comment the save_file statement, redirect_to works, and no file
is uploaded, as expected. If I leave it uncommented, that’s what it is
supposed to do:

def save_file(array, parameters)
if array.update_attributes(parameters)
name = File.basename(array.file)
name.gsub(/[^\w._-]/,’’)
array.name = name
if array.save
else
flash[:notice] = “Error: array.save”
return false
end
else
flash[:notice] = “Error: array.update_attributes”
return false
end
return true
end

What it happens, instead, is: the file is uploaded, the database is
filled, but something goes wrong as the ENOENT error message appears
before the redirection is completed. I must restart lighttpd to reach
again the app.

It’s really a weird problem. I have another file upload field under
the same controller and it just works fine…

The exception, exactly, claims:

Errno::ENOENT
No such file or directory - getcwd
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/
action_controller/routing.rb:269:in expand_path' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/ action_controller/routing.rb:269:insafe_load_paths’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/
action_controller/routing.rb:268:in select' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/ action_controller/routing.rb:268:insafe_load_paths’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/
action_controller/routing.rb:281:in attempt_load' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/ action_controller/routing.rb:237:intraverse_to_controller’
generated/routing/recognition.rb:3:in recognize_path' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/ action_controller/routing.rb:511:inrecognize!’
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/dispatcher.rb:38:in
dispatch' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/fcgi_handler.rb: 150:inprocess_request’
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/fcgi_handler.rb:
54:in process!' /usr/local/lib/ruby/site_ruby/1.8/fcgi.rb:600:ineach_cgi’
/usr/local/lib/ruby/site_ruby/1.8/fcgi.rb:117:in session' /usr/local/lib/ruby/site_ruby/1.8/fcgi.rb:104:ineach_request’
/usr/local/lib/ruby/site_ruby/1.8/fcgi.rb:36:in each' /usr/local/lib/ruby/site_ruby/1.8/fcgi.rb:597:ineach_cgi’
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/fcgi_handler.rb:
53:in process!' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/fcgi_handler.rb: 23:inprocess!’

I don’t know if it has to do with the safe_load_paths in routing.rb of
actionpack-1.12.5… if I should then upgrade to 1.2.3 of if there’s
something I’m missing.

I’ve someone has encountered something similar, any help or insight is
much appreciated.

Thank you,
abelardo