Merge branch '21383-misc-fixes'. Refs #21383
[arvados.git] / services / api / lib / safer_file_store.rb
1 # Copyright (C) The Arvados Authors. All rights reserved.
2 #
3 # SPDX-License-Identifier: AGPL-3.0
4
5 class SaferFileStore < ActiveSupport::Cache::FileStore
6   private
7   def delete_empty_directories(dir)
8     # It is not safe to delete an empty directory. Another thread or
9     # process might be in write_entry(), having just created an empty
10     # directory via ensure_cache_path(). If we delete that empty
11     # directory, the other thread/process will crash in
12     # File.atomic_write():
13     #
14     # #<Errno::ENOENT: No such file or directory @ rb_sysopen - /.../tmp/cache/94F/070/.permissions_check.13730420.54542.801783>
15   end
16 end