This file is indexed.

/usr/lib/ruby/vendor_ruby/log4r/MDC.rb is in ruby-log4r 1.1.10-3.

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
# :include: rdoc/MDC
#
# == Other Info
# 
# Version:: $Id$
# Author:: Colby Gutierrez-Kraybill <colby(at)astro.berkeley.edu>

require 'monitor'

module Log4r
  MDCNAME = "log4rMDC"
  MDCNAMEMAXDEPTH = "log4rMDCMAXDEPTH"
  $globalMDCLock = Monitor.new

  # See log4r/MDC.rb
  class MDC < Monitor
    private_class_method :new

    def self.check_thread_instance()
      # need to interlock here, so that if
      # another thread is entering this section
      # of code before the main thread does,
      # then the main thread copy of the MDC
      # is setup before then attempting to clone
      # it off
      if ( Thread.current[MDCNAME] == nil ) then
	$globalMDCLock.synchronize do 
	  if ( Thread.main[MDCNAME] == nil ) then
	    Thread.main[MDCNAME] = Hash.new
	  end
	  if ( Thread.current != Thread.main ) then
	    Thread.current[MDCNAME] = Hash.new
	    Thread.main[MDCNAME].each{ |k,v| Thread.current[MDCNAME][k] = v }
	  end
	end
      end
    end

    def self.get( a_key )
      self.check_thread_instance()
      Thread.current[MDCNAME].fetch(a_key, "");
    end

    def self.get_context()
      self.check_thread_instance()
      return Thread.current[MDCNAME].clone
    end

    def self.put( a_key, a_value )
      self.check_thread_instance()
      Thread.current[MDCNAME][a_key] = a_value
    end

    def self.remove( a_key )
      self.check_thread_instance()
      Thread.current[MDCNAME].delete( a_key )
    end
  end
end