Skip to content

Commit

Permalink
bugfix: inspec archive for tgz files on windows
Browse files Browse the repository at this point in the history
On Windows, `inspec archive` would sometimes produce incorrect archive files. These would look fine, as tgz files, but would not execute correctly. This would lead to bewildering error messages like this one:

```
Unable to parse inspec.yml: line 1, control characters are not allowed
```

Fix it by treating the files as binary before writing them to get around any encoding issues, since the stream handler is a raw io object anyway.

Closely related to #1906
  • Loading branch information
arlimus committed Jun 8, 2017
1 parent 1c55d12 commit 547670e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/inspec/archive/tar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def archive(base_dir, files, archive)
tar.mkdir(input_filename, stat.mode)
else
tar.add_file_simple(input_filename, stat.mode, stat.size) do |io|
io.write(File.read(path))
io.write(File.binread(path))
end
end
end
Expand Down

0 comments on commit 547670e

Please sign in to comment.