summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortyler-ball <tyleraball@gmail.com>2016-03-21 14:39:00 -0600
committertyler-ball <tyleraball@gmail.com>2016-03-22 14:18:34 -0600
commit72633ba8d42109419c619ba933a70ae2640ce83b (patch)
treeb3ce6e3c432720e74e5ef854a46559e28fae039b
parent18f0ee2354ae2539bf63956ef99a37a188ef67eb (diff)
downloadchef-72633ba8d42109419c619ba933a70ae2640ce83b.tar.gz
Better documenting our Registry monkeypatches so we will know in the
future whether they can be removed.
-rw-r--r--lib/chef/monkey_patches/win32/registry.rb21
1 files changed, 12 insertions, 9 deletions
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