diff options
author | Claire McQuin <claire@getchef.com> | 2014-05-13 15:53:35 -0700 |
---|---|---|
committer | Claire McQuin <claire@getchef.com> | 2014-05-13 15:53:35 -0700 |
commit | 7db7152f3a86ea568b09db458165715bd791c608 (patch) | |
tree | 62ffd69e2ce4ae9622f70934cd479b4fbfaed78b | |
parent | 0f37f11f913c7865165f1e39a97291f382b77888 (diff) | |
download | chef-7db7152f3a86ea568b09db458165715bd791c608.tar.gz |
Comment threadsafe change.
-rw-r--r-- | lib/chef/mixin/create_path.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/chef/mixin/create_path.rb b/lib/chef/mixin/create_path.rb index 31ef81e4be..ef8f381635 100644 --- a/lib/chef/mixin/create_path.rb +++ b/lib/chef/mixin/create_path.rb @@ -46,6 +46,14 @@ class Chef create_path = File.join(file_path[0, i + 1]) unless File.directory?(create_path) begin + # In multithreaded environments, the following interleaving raises + # an error here: + # + # thread1 thread2 + # File.directory?(create_path) <- false + # File.directory?(create_path) <- false + # Dir.mkdir(create_path) + # Dir.mkdir(create_path) <- raises Errno::EEXIST Chef::Log.debug("Creating directory #{create_path}") Dir.mkdir(create_path) rescue Errno::EEXIST |