[ARVADOS] created: d7b27f798a0298f5508842c5f7f03b8fccafa3ab

Git user git at public.curoverse.com
Wed Jan 4 18:12:17 EST 2017


        at  d7b27f798a0298f5508842c5f7f03b8fccafa3ab (commit)


commit d7b27f798a0298f5508842c5f7f03b8fccafa3ab
Author: Tom Clegg <tom at curoverse.com>
Date:   Wed Jan 4 18:12:13 2017 -0500

    10808: Avoid using the disk cache if a different user owns it (e.g., running a rake task or crunch-dispatch as root).

diff --git a/services/api/config/application.rb b/services/api/config/application.rb
index 4211df2..e7002dd 100644
--- a/services/api/config/application.rb
+++ b/services/api/config/application.rb
@@ -35,5 +35,15 @@ module Server
     config.filter_parameters += [:password]
 
     I18n.enforce_available_locales = false
+
+    default_cache_path = Rails.root.join('tmp', 'cache')
+    if not File.owned?(default_cache_path)
+      # If we don't own the cache dir, using it will either fail or
+      # (if we're root) pollute it so other processes fail later.
+      STDERR.puts("Defaulting to memory cache, because #{default_cache_path} " \
+                  "owner (uid=#{File::Stat.new(default_cache_path).uid}) " \
+                  "is not me (uid=#{Process.euid})")
+      config.cache_store = :memory_store
+    end
   end
 end

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list