/usr/lib/ruby/vendor_ruby/mixlib/archive.rb is in ruby-mixlib-archive 0.2.0-1+deb9u1.
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 | require "mixlib/archive/tar"
require "mixlib/archive/version"
require "mixlib/log"
module Mixlib
class Archive
attr_reader :extractor
def initialize(archive, empty: false)
@empty = empty
archive = File.expand_path(archive)
# for now we only support Tar format archives.
@extractor = Mixlib::Archive::Tar.new(archive)
end
class Log
extend Mixlib::Log
end
Log.level = :error
def extract(destination, perms: true, ignore: [])
ignore = [/^\.$/, /\.{2}/] + ignore
create_and_empty(destination)
extractor.extract(destination, perms: perms, ignore: ignore)
end
private
def create_and_empty(destination)
FileUtils.mkdir_p(destination)
if @empty
Dir.foreach(destination) do |entry|
next if entry == "." || entry == ".."
FileUtils.remove_entry_secure(File.join(destination, entry))
end
end
end
end
end
|