This file is indexed.

/usr/lib/ruby/vendor_ruby/thread_safe/mri_cache_backend.rb is in ruby-thread-safe 0.3.6-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
module ThreadSafe
  class MriCacheBackend < NonConcurrentCacheBackend
    # We can get away with a single global write lock (instead of a per-instance
    # one) because of the GVL/green threads.
    #
    # NOTE: a neat idea of writing a c-ext to manually perform atomic
    # put_if_absent, while relying on Ruby not releasing a GVL while calling a
    # c-ext will not work because of the potentially Ruby implemented `#hash`
    # and `#eql?` key methods.
    WRITE_LOCK = Mutex.new

    def []=(key, value)
      WRITE_LOCK.synchronize { super }
    end

    def compute_if_absent(key)
      if stored_value = _get(key) # fast non-blocking path for the most likely case
        stored_value
      else
        WRITE_LOCK.synchronize { super }
      end
    end

    def compute_if_present(key)
      WRITE_LOCK.synchronize { super }
    end

    def compute(key)
      WRITE_LOCK.synchronize { super }
    end

    def merge_pair(key, value)
      WRITE_LOCK.synchronize { super }
    end

    def replace_pair(key, old_value, new_value)
      WRITE_LOCK.synchronize { super }
    end

    def replace_if_exists(key, new_value)
      WRITE_LOCK.synchronize { super }
    end

    def get_and_set(key, value)
      WRITE_LOCK.synchronize { super }
    end

    def delete(key)
      WRITE_LOCK.synchronize { super }
    end

    def delete_pair(key, value)
      WRITE_LOCK.synchronize { super }
    end

    def clear
      WRITE_LOCK.synchronize { super }
    end
  end
end