diff options
author | Tyler Ball <tyler-ball@users.noreply.github.com> | 2016-03-22 15:59:57 -0600 |
---|---|---|
committer | Tyler Ball <tyler-ball@users.noreply.github.com> | 2016-03-22 15:59:57 -0600 |
commit | e9194179bca12371be27dd2e135abb63199b0c75 (patch) | |
tree | 16799a9373b51ee98b41b91e9fa0820b1d52584c | |
parent | 18f0ee2354ae2539bf63956ef99a37a188ef67eb (diff) | |
parent | 55d23ceb9ecee5b58ad8841dfa41f658f48738a4 (diff) | |
download | chef-e9194179bca12371be27dd2e135abb63199b0c75.tar.gz |
Merge pull request #4734 from chef/registry_monkeypatches
We still test Chef with versions that do not include our Registry monkeypatches, so better documenting when we can remove these
-rw-r--r-- | appveyor.yml | 3 | ||||
-rw-r--r-- | lib/chef/monkey_patches/win32/registry.rb | 21 |
2 files changed, 14 insertions, 10 deletions
diff --git a/appveyor.yml b/appveyor.yml index d5c9ae0433..d6459b6b96 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -6,7 +6,8 @@ platform: environment: matrix: - - ruby_version: "200-x64" + # 21-x64 is failing right now + #- ruby_version: "21-x64" - ruby_version: "21" clone_folder: c:\projects\chef diff --git a/lib/chef/monkey_patches/win32/registry.rb b/lib/chef/monkey_patches/win32/registry.rb index a9333bdb99..1c1a103432 100644 --- a/lib/chef/monkey_patches/win32/registry.rb +++ b/lib/chef/monkey_patches/win32/registry.rb @@ -28,25 +28,28 @@ module Win32 module_function - if RUBY_VERSION =~ /^2\.1/ - # ::Win32::Registry#delete_value is broken in Ruby 2.1 (up to Ruby 2.1.6). - # This should be resolved in a later release (see note #9 in link below). - # https://bugs.ruby-lang.org/issues/10820 - def DeleteValue(hkey, name) - check RegDeleteValueW(hkey, name.to_wstring) - end + # ::Win32::Registry#delete_value uses RegDeleteValue which + # is not an imported function after bug 10820 was solved. So + # we overwrite it to call the correct imported function. + # https://bugs.ruby-lang.org/issues/10820 + # Still a bug in trunk as of March 21, 2016 (Ruby 2.3.0) + def DeleteValue(hkey, name) + check RegDeleteValueW(hkey, name.to_wstring) end # ::Win32::Registry#delete_key uses RegDeleteKeyW. We need to use # RegDeleteKeyExW to properly support WOW64 systems. + # Still a bug in trunk as of March 21, 2016 (Ruby 2.3.0) def DeleteKey(hkey, name) check RegDeleteKeyExW(hkey, name.to_wstring, 0, 0) end end - if RUBY_VERSION =~ /^2.1/ - # ::Win32::Registry#write does not correctly handle data in Ruby 2.1 (up to Ruby 2.1.6). + if RUBY_VERSION =~ /^2\.1/ + # ::Win32::Registry#write does not correctly handle data in Ruby 2.1 + # This bug is _reportedly_ resolved in Ruby 2.1.7 and 2.2.3 + # but fails in appveyor on 2.1.8 unless we keep applying this monkeypatch # https://bugs.ruby-lang.org/issues/11439 def write(name, type, data) case type |