This file is indexed.

/usr/lib/ruby/vendor_ruby/serverspec/type/file.rb is in ruby-serverspec 2.18.0-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
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
require 'date'

module Serverspec::Type
  class File < Base
    attr_accessor :content

    def file?
      cmd = Specinfra.command.get(:check_file_is_file, @name)
      @inspection = Specinfra.backend.build_command(cmd)
      @runner.check_file_is_file(@name)
    end

    def block_device?
      @runner.check_file_is_block_device(@name)
    end

    def character_device?
      @runner.check_file_is_character_device(@name)
    end

    def socket?
      @runner.check_file_is_socket(@name)
    end

    def directory?
      @runner.check_file_is_directory(@name)
    end

    def symlink?
      @runner.check_file_is_symlink(@name)
    end

    def pipe?
      @runner.check_file_is_pipe(@name)
    end

    def contain(pattern, from, to)
      if pattern.is_a?(Array)
        @runner.check_file_contains_lines(@name, pattern, from, to)
      else
        if (from || to).nil?
          @runner.check_file_contains(@name, pattern)
        else
          @runner.check_file_contains_within(@name, pattern, from, to)
        end
      end
    end

    def mode?(mode)
      @runner.check_file_has_mode(@name, mode)
    end

    def owned_by?(owner)
      @runner.check_file_is_owned_by(@name, owner)
    end

    def grouped_into?(group)
      @runner.check_file_is_grouped(@name, group)
    end

    def linked_to?(target)
      @runner.check_file_is_linked_to(@name, target)
    end

    def readable?(by_whom, by_user)
      if by_user != nil
        @runner.check_file_is_accessible_by_user(@name, by_user, 'r')
      else
        @runner.check_file_is_readable(@name, by_whom)
      end
    end

    def writable?(by_whom, by_user)
      if by_user != nil
        @runner.check_file_is_accessible_by_user(@name, by_user, 'w')
      else
        @runner.check_file_is_writable(@name, by_whom)
      end
    end

    def executable?(by_whom, by_user)
      if by_user != nil
        @runner.check_file_is_accessible_by_user(@name, by_user, 'x')
      else
        @runner.check_file_is_executable(@name, by_whom)
      end
    end

    def mounted?(attr, only_with)
      @runner.check_file_is_mounted(@name, attr, only_with)
    end

    def immutable?
      @runner.check_file_is_immutable(@name)
    end

    def exists?
      @runner.check_file_exists(@name)
    end

    def md5sum
      @runner.get_file_md5sum(@name).stdout.strip
    end

    def sha256sum
      @runner.get_file_sha256sum(@name).stdout.strip
    end

    def content
      if @content.nil?
        @content = @runner.get_file_content(@name).stdout
      end
      @content
    end

    def version?(version)
      @runner.check_file_has_version(@name, version)
    end

    def mtime
      d = @runner.get_file_mtime(@name).stdout.strip
      DateTime.strptime(d, '%s').new_offset(DateTime.now.offset)
    end

    def size
      @runner.get_file_size(@name).stdout.strip.to_i
    end

    def selinux_label
      @runner.get_file_selinuxlabel(@name).stdout.strip
    end
  end
end