{"action":"opened","issue":{"url":"https://api.github.com/repos/chef/inspec/issues/2938","repository_url":"https://api.github.com/repos/chef/inspec","labels_url":"https://api.github.com/repos/chef/inspec/issues/2938/labels{/name}","comments_url":"https://api.github.com/repos/chef/inspec/issues/2938/comments","events_url":"https://api.github.com/repos/chef/inspec/issues/2938/events","html_url":"https://github.com/chef/inspec/issues/2938","id":312970340,"number":2938,"title":"Character encoding error when exec'ing a tar.gz && control code is missing UTF-8 declaration","user":{"login":"james-stocks","id":12136665,"avatar_url":"https://avatars1.githubusercontent.com/u/12136665?v=4","gravatar_id":"","url":"https://api.github.com/users/james-stocks","html_url":"https://github.com/james-stocks","followers_url":"https://api.github.com/users/james-stocks/followers","following_url":"https://api.github.com/users/james-stocks/following{/other_user}","gists_url":"https://api.github.com/users/james-stocks/gists{/gist_id}","starred_url":"https://api.github.com/users/james-stocks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/james-stocks/subscriptions","organizations_url":"https://api.github.com/users/james-stocks/orgs","repos_url":"https://api.github.com/users/james-stocks/repos","events_url":"https://api.github.com/users/james-stocks/events{/privacy}","received_events_url":"https://api.github.com/users/james-stocks/received_events","type":"User","site_admin":false},"labels":[{"id":832497818,"url":"https://api.github.com/repos/chef/inspec/labels/bug","name":"bug","color":"ee0701","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-04-10T15:17:11Z","updated_at":"2018-04-10T15:17:11Z","closed_at":null,"author_association":"NONE","body":"### 🎛 Description\r\n\r\nGiven the following control code:\r\n\r\n```\r\n# copyright: 2017, The Authors\r\n\r\ntitle 'sample section'\r\n\r\n# you can also use plain tests\r\ndescribe file('/tmp/foo') do\r\n  skip 'There is no cow file inside sam´s home directory.'\r\nend\r\n```\r\n\r\nThe control works when executed from source but throws an error when executed from .tar.gz:\r\n\r\n```\r\n➜  /tmp > inspec exec test_profile\r\n\r\nProfile: InSpec Profile (test_profile)\r\nVersion: 0.1.0\r\nTarget:  local://\r\n\r\n  File /tmp/foo\r\n     ↺  There is no cow file inside sam´s home directory.\r\n\r\nTest Summary: 0 successful, 0 failures, 1 skipped\r\n➜  /tmp > inspec archive test_profile\r\nI, [2018-04-10T15:20:15.057507 #52365]  INFO -- : Checking profile in test_profile\r\nI, [2018-04-10T15:20:15.057675 #52365]  INFO -- : Metadata OK.\r\nI, [2018-04-10T15:20:15.058602 #52365]  INFO -- : Found 1 controls.\r\nI, [2018-04-10T15:20:15.058631 #52365]  INFO -- : Control definitions OK.\r\nI, [2018-04-10T15:20:15.058740 #52365]  INFO -- : Generate archive /private/tmp/test_profile-0.1.0.tar.gz.\r\nI, [2018-04-10T15:20:15.060838 #52365]  INFO -- : Finished archive generation.\r\n➜  /tmp > inspec exec test_profile-0.1.0.tar.gz\r\n/opt/inspec/embedded/lib/ruby/gems/2.4.0/gems/inspec-2.1.30/lib/inspec/reporters/cli.rb:144:in `format_message': incompatible character encodings: UTF-8 and ASCII-8BIT (Encoding::CompatibilityError)\r\n\tfrom /opt/inspec/embedded/lib/ruby/gems/2.4.0/gems/inspec-2.1.30/lib/inspec/reporters/cli.rb:128:in `format_result'\r\n\tfrom /opt/inspec/embedded/lib/ruby/gems/2.4.0/gems/inspec-2.1.30/lib/inspec/reporters/cli.rb:91:in `block (2 levels) in print_anonymous_control_results'\r\n\tfrom /opt/inspec/embedded/lib/ruby/gems/2.4.0/gems/inspec-2.1.30/lib/inspec/reporters/cli.rb:90:in `each'\r\n\tfrom /opt/inspec/embedded/lib/ruby/gems/2.4.0/gems/inspec-2.1.30/lib/inspec/reporters/cli.rb:90:in `block in print_anonymous_control_results'\r\n\tfrom /opt/inspec/embedded/lib/ruby/gems/2.4.0/gems/inspec-2.1.30/lib/inspec/reporters/cli.rb:86:in `each'\r\n\tfrom /opt/inspec/embedded/lib/ruby/gems/2.4.0/gems/inspec-2.1.30/lib/inspec/reporters/cli.rb:86:in `print_anonymous_control_results'\r\n\tfrom /opt/inspec/embedded/lib/ruby/gems/2.4.0/gems/inspec-2.1.30/lib/inspec/reporters/cli.rb:51:in `block in render'\r\n\tfrom /opt/inspec/embedded/lib/ruby/gems/2.4.0/gems/inspec-2.1.30/lib/inspec/reporters/cli.rb:46:in `each'\r\n\tfrom /opt/inspec/embedded/lib/ruby/gems/2.4.0/gems/inspec-2.1.30/lib/inspec/reporters/cli.rb:46:in `render'\r\n\tfrom /opt/inspec/embedded/lib/ruby/gems/2.4.0/gems/inspec-2.1.30/lib/inspec/reporters.rb:30:in `render'\r\n\tfrom /opt/inspec/embedded/lib/ruby/gems/2.4.0/gems/inspec-2.1.30/lib/inspec/runner.rb:111:in `block in render_output'\r\n\tfrom /opt/inspec/embedded/lib/ruby/gems/2.4.0/gems/inspec-2.1.30/lib/inspec/runner.rb:110:in `each'\r\n\tfrom /opt/inspec/embedded/lib/ruby/gems/2.4.0/gems/inspec-2.1.30/lib/inspec/runner.rb:110:in `render_output'\r\n\tfrom /opt/inspec/embedded/lib/ruby/gems/2.4.0/gems/inspec-2.1.30/lib/inspec/runner.rb:134:in `run_tests'\r\n\tfrom /opt/inspec/embedded/lib/ruby/gems/2.4.0/gems/inspec-2.1.30/lib/inspec/runner.rb:104:in `run'\r\n\tfrom /opt/inspec/embedded/lib/ruby/gems/2.4.0/gems/inspec-2.1.30/lib/inspec/cli.rb:168:in `exec'\r\n\tfrom /opt/inspec/embedded/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'\r\n\tfrom /opt/inspec/embedded/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'\r\n\tfrom /opt/inspec/embedded/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'\r\n\tfrom /opt/inspec/embedded/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/base.rb:466:in `start'\r\n\tfrom /opt/inspec/embedded/lib/ruby/gems/2.4.0/gems/inspec-2.1.30/bin/inspec:12:in `<top (required)>'\r\n\tfrom /usr/local/bin/inspec:72:in `load'\r\n\tfrom /usr/local/bin/inspec:72:in `<main>'\r\n➜  /tmp >\r\n```\r\n\r\nThe error does not occur if `# encoding: UTF-8` is placed at the top of the control file.\r\n\r\n### 🌍 InSpec and Platform Version\r\n\r\n2.1.30\r\nTesting directly against my OSX laptop, but issue was first seen on a RHEL7 host.\r\n\r\n\r\n\r\n"}}
{"actor":{"display_login":"james-stocks"}}