Skip to content
This repository has been archived by the owner on Jul 14, 2021. It is now read-only.

FATAL: ArgumentError: invalid Unicode escape on Windows because of recipe name #389

Closed
kaltokri opened this issue May 9, 2015 · 3 comments

Comments

@kaltokri
Copy link

kaltokri commented May 9, 2015

Situation:

  • On Windows create a cookbook. Name does't matter (but avoid the letter u at the beginning). My test cookbook is named testunicodeproblem.
  • Add recipe with the name update.rb and add this resource:
execute "doesnotexists.exe"
  • Create default.rb with this:
include_recipe "testunicodeproblem::update"
  • Create metadata.rb with:
name "testunicodeproblem"
version "0.0.1"
  • Run chef-solo -o testunicodeproblem.
    You will get FATAL: ArgumentError: invalid Unicode escape.

Now rename update.rb to myupdate.rb and change default.rb to use the new name.
This time you'll get the right error FATAL: Mixlib::ShellOut::ShellCommandFailed...

Problem occur only if: on Windows AND recipe (or cookbook) begins with u AND you have an error in your recipe. If Chef tries to analyse the problem the \u in the path will be interpreted as unicode escape.

I'll spend 3 days until I found the problematic combination.
I can reproduce it on Windows 8, 8.1 and Windows Server 2003 with Chef-Dk 0.4.0 & 0.5.1.

@jaym
Copy link
Contributor

jaym commented May 9, 2015

This issue belongs in the chef repo and is probably related to chef/chef#3055 and chef/chef#3343

However, to be sure, you need to post the stacktrace

@kaltokri
Copy link
Author

kaltokri commented May 9, 2015

I think you are right. This seems to be a duplicate of chef/chef#3055 and can be closed.
Thank you for your fast response!
Here is the stacktrace.out:

Generated at 2015-05-09 16:39:12 +0200
ArgumentError: invalid Unicode escape
C:/opscode/chefdk/embedded/apps/chef/lib/chef/formatters/error_inspectors/resource_failure_inspector.rb:66:in `recipe_snippet'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/formatters/error_inspectors/resource_failure_inspector.rb:43:in `add_explanation'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/formatters/error_mapper.rb:72:in `resource_failed'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/formatters/base.rb:139:in `resource_failed'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/formatters/doc.rb:179:in `resource_failed'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/event_dispatch/dispatcher.rb:29:in `block in resource_failed'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/event_dispatch/dispatcher.rb:29:in `each'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/event_dispatch/dispatcher.rb:29:in `resource_failed'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/resource.rb:594:in `rescue in run_action'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/resource.rb:603:in `run_action'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/runner.rb:49:in `run_action'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/runner.rb:81:in `block (2 levels) in converge'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/runner.rb:81:in `each'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/runner.rb:81:in `block in converge'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/resource_collection/resource_list.rb:83:in `block in execute_each_resource'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/resource_collection/stepable_iterator.rb:116:in `call'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/resource_collection/stepable_iterator.rb:116:in `call_iterator_block'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/resource_collection/stepable_iterator.rb:85:in `step'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/resource_collection/stepable_iterator.rb:104:in `iterate'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/resource_collection/resource_list.rb:81:in `execute_each_resource'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/runner.rb:80:in `converge'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/client.rb:315:in `converge'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/client.rb:400:in `block in run'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/client.rb:399:in `catch'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/client.rb:399:in `run'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/application.rb:243:in `run_with_graceful_exit_option'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/application.rb:220:in `block in run_chef_client'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/local_mode.rb:38:in `with_server_connectivity'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/application.rb:201:in `run_chef_client'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/application/solo.rb:245:in `block in interval_run_chef_client'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/application/solo.rb:234:in `loop'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/application/solo.rb:234:in `interval_run_chef_client'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/application/solo.rb:224:in `run_application'
C:/opscode/chefdk/embedded/apps/chef/lib/chef/application.rb:58:in `run'
C:/opscode/chefdk/embedded/apps/chef/bin/chef-solo:25:in `<top (required)>'
C:/opscode/chefdk/bin/chef-solo:52:in `load'
C:/opscode/chefdk/bin/chef-solo:52:in `<main>'

@danielsdeleo
Copy link
Contributor

Closing as a duplicate per the discussion above.

ksubrama pushed a commit that referenced this issue Jan 11, 2016
@chef-boneyard chef-boneyard locked and limited conversation to collaborators Feb 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

3 participants