Thank you for looking into this. I tried both yours and Sean quick fix and neither helped.

here is the full stack

Parameters: {"action"=>"remove", "authenticity_token"=>"b3c11c1f1191103da344cae2345c5beb9a7654d", "id"=>"11", "controller"=>"assets"}
[paperclip] Paperclip attachment asset on Asset initialized.
[paperclip] Deleting attachments.
[paperclip] Queueing the existing files for asset for deletion.
[paperclip] Deleting files for asset
[paperclip] -> /users/home/...../web/public/assets/11/testimage.jpg


Errno::EEXIST (File exists - /users/home/..../web/public/assets/11):
    /usr/local/lib/ruby/1.8/fileutils.rb:264:in `rmdir'
    /usr/local/lib/ruby/1.8/fileutils.rb:264:in `rmdir'
    /usr/local/lib/ruby/1.8/fileutils.rb:263:in `each'
    /usr/local/lib/ruby/1.8/fileutils.rb:263:in `rmdir'
/vendor/extensions/paperclipped/vendor/plugins/paperclip/lib/ paperclip/storage.rb:62:in `flush_deletes' /vendor/extensions/paperclipped/vendor/plugins/paperclip/lib/ paperclip/storage.rb:52:in `each' /vendor/extensions/paperclipped/vendor/plugins/paperclip/lib/ paperclip/storage.rb:52:in `flush_deletes' /vendor/extensions/paperclipped/vendor/plugins/paperclip/lib/ paperclip.rb:301:in `send' /vendor/extensions/paperclipped/vendor/plugins/paperclip/lib/ paperclip.rb:301:in `destroy_attached_files' /vendor/extensions/paperclipped/vendor/plugins/paperclip/lib/ paperclip.rb:286:in `each_attachment' /vendor/extensions/paperclipped/vendor/plugins/paperclip/lib/ paperclip.rb:285:in `each' /vendor/extensions/paperclipped/vendor/plugins/paperclip/lib/ paperclip.rb:285:in `each_attachment' /vendor/extensions/paperclipped/vendor/plugins/paperclip/lib/ paperclip.rb:299:in `destroy_attached_files' /vendor/rails/activerecord/lib/../../activesupport/lib/ active_support/callbacks.rb:173:in `send' /vendor/rails/activerecord/lib/../../activesupport/lib/ active_support/callbacks.rb:173:in `evaluate_method' /vendor/rails/activerecord/lib/../../activesupport/lib/ active_support/callbacks.rb:161:in `call' /vendor/rails/activerecord/lib/../../activesupport/lib/ active_support/callbacks.rb:93:in `run' /vendor/rails/activerecord/lib/../../activesupport/lib/ active_support/callbacks.rb:92:in `each' /vendor/rails/activerecord/lib/../../activesupport/lib/ active_support/callbacks.rb:92:in `send' /vendor/rails/activerecord/lib/../../activesupport/lib/ active_support/callbacks.rb:92:in `run' /vendor/rails/activerecord/lib/../../activesupport/lib/ active_support/callbacks.rb:272:in `run_callbacks' /vendor/rails/activerecord/lib/active_record/callbacks.rb:298:in `callback' /vendor/rails/activerecord/lib/active_record/callbacks.rb:288:in `destroy_without_transactions' /vendor/rails/activerecord/lib/active_record/transactions.rb: 102:in `destroy' /vendor/rails/activerecord/lib/active_record/connection_adapters/ abstract/database_statements.rb:66:in `transaction' /vendor/rails/activerecord/lib/active_record/transactions.rb: 79:in `transaction' /vendor/rails/activerecord/lib/active_record/transactions.rb: 98:in `transaction' /vendor/rails/activerecord/lib/active_record/transactions.rb: 102:in `destroy' /vendor/extensions/paperclipped/app/controllers/ assets_controller.rb:110:in `remove' /vendor/rails/actionpack/lib/action_controller/base.rb:1166:in `send' /vendor/rails/actionpack/lib/action_controller/base.rb:1166:in `perform_action_without_filters' /vendor/rails/actionpack/lib/action_controller/filters.rb:579:in `call_filters' /vendor/rails/actionpack/lib/action_controller/filters.rb:572:in `perform_action_without_benchmark' /vendor/rails/actionpack/lib/action_controller/benchmarking.rb: 68:in `perform_action_without_rescue'
    /usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'
/vendor/rails/actionpack/lib/action_controller/benchmarking.rb: 68:in `perform_action_without_rescue' /vendor/rails/actionpack/lib/action_controller/rescue.rb:201:in `perform_action_without_caching' /vendor/rails/actionpack/lib/action_controller/caching/ sql_cache.rb:13:in `perform_action' /vendor/rails/activerecord/lib/active_record/connection_adapters/ abstract/query_cache.rb:33:in `cache' /vendor/rails/activerecord/lib/active_record/query_cache.rb:8:in `cache' /vendor/rails/actionpack/lib/action_controller/caching/ sql_cache.rb:12:in `perform_action' /vendor/rails/actionpack/lib/action_controller/base.rb:529:in `send' /vendor/rails/actionpack/lib/action_controller/base.rb:529:in `process_without_filters' /vendor/rails/actionpack/lib/action_controller/filters.rb:568:in `process_without_session_management_support' /vendor/rails/actionpack/lib/action_controller/ session_management.rb:130:in `sass_old_process'
    /vendor/plugins/haml/lib/sass/plugin/rails.rb:19:in `process'
/vendor/rails/actionpack/lib/action_controller/base.rb:389:in `process' /vendor/rails/actionpack/lib/action_controller/dispatcher.rb: 149:in `handle_request' /vendor/rails/actionpack/lib/action_controller/dispatcher.rb: 107:in `dispatch' /vendor/rails/actionpack/lib/action_controller/dispatcher.rb: 104:in `synchronize' /vendor/rails/actionpack/lib/action_controller/dispatcher.rb: 104:in `dispatch' /vendor/rails/actionpack/lib/action_controller/dispatcher.rb: 120:in `dispatch_cgi' /vendor/rails/actionpack/lib/action_controller/dispatcher.rb: 35:in `dispatch' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/ mongrel/rails.rb:76:in `process' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/ mongrel/rails.rb:74:in `synchronize' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/ mongrel/rails.rb:74:in `process' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/ mongrel.rb:159:in `process_client' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/ mongrel.rb:158:in `each' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/ mongrel.rb:158:in `process_client' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/ mongrel.rb:285:in `run' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/ mongrel.rb:285:in `initialize' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/ mongrel.rb:285:in `new' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/ mongrel.rb:285:in `run' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/ mongrel.rb:268:in `initialize' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/ mongrel.rb:268:in `new' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/ mongrel.rb:268:in `run' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/ mongrel/configurator.rb:282:in `run' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/ mongrel/configurator.rb:281:in `each' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/ mongrel/configurator.rb:281:in `run' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails: 133:in `run' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/ mongrel/command.rb:212:in `run' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails: 286
    /usr/local/bin/mongrel_rails:19:in `load'
    /usr/local/bin/mongrel_rails:19

Rendering /users/home/....../web/public/500.html (500 Internal Server Error)


This is what the access_log said:

"POST /admin/assets/14/remove HTTP/1.1" 500 256 "http://...../admin/ assets/14/remove"

The error_log or the mongrel.log said nothing at all about it.




On Jan 28, 2009, at 1:03 PM, C. R. Oldham wrote:


On Jan 28, 2009, at 11:49 AM, Sean Cribbs wrote:

Sounds like paperclip should use FileUtils.rm_rf instead of rm_dir.

It doesn't, at least if it is the same as the one I have installed. Here's the code:

     def flush_deletes #:nodoc:
       logger.info("[paperclip] Deleting files for #{name}")
       @queued_for_delete.each do |path|
         begin
           logger.info("[paperclip] -> #{path}")
           FileUtils.rm(path) if File.exist?(path)
         rescue Errno::ENOENT => e
           # ignore file-not-found, let everything else pass
         end
       end
       @queued_for_delete = []
     end
   end

File.exist? returns true for files and directories. But unless I have an old version of paperclipped that doesn't call FileUtils.rm, the Ruby docs say specifically that FileUtils.rm does not remove directories. And to be really safe, it should use FileUtils.remove_entry_secure.

Steven, you might try a quick patch and change FileUtils.rm to FileUtils.remove_entry_secure (or FileUtils.rm_rf like Sean suggests if you are not terribly worried about security) in vendor/extensions/ paperclipped/vendor/plugins/paperclip/lib/paperclip/storage.rb

--cro

_______________________________________________
Radiant mailing list
Post:   Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

_______________________________________________
Radiant mailing list
Post:   Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Reply via email to