mirror of
https://github.com/inspec/inspec
synced 2024-11-22 12:43:07 +00:00
bugfix: specinfra file type detection
mask & tmask returns non-zero values, if some bits fit the file-type. this leads to overlapping results. make sure the mask result has the full mask present, then use it. Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
This commit is contained in:
parent
d3d91c8c3f
commit
f618fa391b
3 changed files with 10 additions and 3 deletions
|
@ -171,7 +171,7 @@ module Vulcano::Backends
|
|||
path = Shellwords.escape(@path)
|
||||
raw_type = Specinfra::Runner.run_command("stat -c %f #{path}").stdout
|
||||
tmask = raw_type.to_i(16)
|
||||
res = TYPES.find{|name, mask| mask & tmask}
|
||||
res = TYPES.find{|name, mask| mask & tmask == mask}
|
||||
return :unknown if res.nil?
|
||||
res[0]
|
||||
end
|
||||
|
|
|
@ -2,8 +2,11 @@ require 'docker'
|
|||
require 'yaml'
|
||||
require_relative '../lib/vulcano'
|
||||
|
||||
tests = ARGV.drop(1)
|
||||
exit 0 if tests.empty?
|
||||
tests = ARGV
|
||||
if tests.empty?
|
||||
puts 'Nothing to do.'
|
||||
exit 0
|
||||
end
|
||||
|
||||
class DockerTester
|
||||
def initialize(tests)
|
||||
|
|
4
test/resource/file.rb
Normal file
4
test/resource/file.rb
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
describe file('/tmp') do
|
||||
its(:type) { should eq :directory }
|
||||
end
|
Loading…
Reference in a new issue