{"action":"created","issue":{"url":"https://api.github.com/repos/badgerious/puppet-windows-env/issues/8","labels_url":"https://api.github.com/repos/badgerious/puppet-windows-env/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/badgerious/puppet-windows-env/issues/8/comments","events_url":"https://api.github.com/repos/badgerious/puppet-windows-env/issues/8/events","html_url":"https://github.com/badgerious/puppet-windows-env/issues/8","id":56600816,"number":8,"title":"Upcoming Puppet 4 / Ruby 2.1.5 Registry compatibility changes","user":{"login":"Iristyle","id":394081,"avatar_url":"https://avatars.githubusercontent.com/u/394081?v=3","gravatar_id":"","url":"https://api.github.com/users/Iristyle","html_url":"https://github.com/Iristyle","followers_url":"https://api.github.com/users/Iristyle/followers","following_url":"https://api.github.com/users/Iristyle/following{/other_user}","gists_url":"https://api.github.com/users/Iristyle/gists{/gist_id}","starred_url":"https://api.github.com/users/Iristyle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Iristyle/subscriptions","organizations_url":"https://api.github.com/users/Iristyle/orgs","repos_url":"https://api.github.com/users/Iristyle/repos","events_url":"https://api.github.com/users/Iristyle/events{/privacy}","received_events_url":"https://api.github.com/users/Iristyle/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-02-04T22:55:53Z","updated_at":"2015-08-08T23:07:15Z","closed_at":"2015-08-08T16:33:24Z","body":"As part of making Puppet 4 compatible with Ruby 2.1.5, we have discovered a couple of bugs inside Ruby that will affect your module.  The two primary issues are:\r\n\r\n* When enumerating keys with `#each_key` / `#keys` or values with `#each_value` / `#values`, Ruby will take a `UTF-16LE` string and [roundtrip it through the local codepage unnecessarily](https://github.com/ruby/ruby/blob/v2_1_5/ext/win32/lib/win32/registry.rb#L361-L367), which may cause encoding exceptions.  Our prime example of this is when a Unicode en-dash `U+2013` appears in a registry value, and the local codepage is `IBM437`, which has no equivalent character.  This is just one of many potential examples that may trigger this behavior.  NOTE: Normal registry reads of a value at a particular key are not problematic - the bad behavior is only triggered during enumeration.  We have not yet filed this bug with Ruby.\r\n* When using the `#delete_key` and `#delete_value` methods, Ruby is passing wide character `UTF-16LE` strings to [ANSI APIs](https://github.com/ruby/ruby/blob/v2_1_5/ext/win32/lib/win32/registry.rb#L225-L226).  We have filed this bug with Ruby at https://bugs.ruby-lang.org/issues/10820\r\n\r\nThere are additional technical details that can be found in [PUP-3837](https://tickets.puppetlabs.com/browse/PUP-3837), the ticket we're using to track changes that we've made to Puppet.  Our resolution for these issues was merged to Puppet at https://github.com/puppetlabs/puppet/commit/c610cd01eeef3fafa7aa2761a3435dd6c1b0d8d4\r\n\r\nWe don't have Puppet 4 builds released yet, but keep an eye on https://groups.google.com/forum/#!forum/puppet-announce\r\n\r\nI have identified issues with the code in this module that will require some updating to ensure it maintains compatibility with both existing Puppet releases and the upcoming releases. I'm getting in touch with you now, so that you're not caught off guard, and so that your module is ready to go by the time 4.0 ships.\r\n\r\nIssues:\r\n\r\n* `delete_value` is called at https://github.com/badgerious/puppet-windows-env/blob/master/lib/puppet/provider/windows_env/windows_env.rb#L196 and should instead use an internal definition for the `RegDeleteValueW` API call like we've done inside Puppet.\r\n* You might want to also verify the module by hand using a Ruby 2.1.5 runtime.  To do this requires modifying `registry.rb`, present at `c:\\tools\\ruby215\\lib\\ruby\\2.1.0\\win32\\registry.rb` in my install.  Some simple warnings may be emitted in several locations where problematic behavior can occur.  Then you can exercise your module / run specs for a full validation.\r\n\r\n    * https://github.com/ruby/ruby/blob/v2_1_5/ext/win32/lib/win32/registry.rb#L815 should have `puts \"BUG: RegDeleteValue called with #{name} against #{@keyname}\"`\r\n    * https://github.com/ruby/ruby/blob/v2_1_5/ext/win32/lib/win32/registry.rb#L836 and https://github.com/ruby/ruby/blob/v2_1_5/ext/win32/lib/win32/registry.rb#L841 should have `puts \"BUG: RegDeleteKey called with #{name} against #{@keyname}\"` added\r\n    * https://github.com/ruby/ruby/blob/v2_1_5/ext/win32/lib/win32/registry.rb#L895 should have `puts \"BUG: export_string triggered with #{str} to #{enc.to_s}\"`\r\n    * Optionally https://github.com/ruby/ruby/blob/v2_1_5/ext/win32/lib/win32/registry.rb#L363 can have `puts \"BUG: expand_environ triggered with #{str}\"` - while this behavior does trigger a string re-encode to the current codepage, we view it as less problematic as it requires `REG_MULTI_SZ` and environment variable expansion - where the values will typically be in the current codepage on a default system.\r\n\r\n\r\nWe will be making an announcement to the puppet-dev list shortly mentioning some of these upcoming changes.\r\nhttps://groups.google.com/forum/#!forum/puppet-dev\r\n\r\nLet me know if you have any questions.\r\n\r\nThanks!"},"comment":{"url":"https://api.github.com/repos/badgerious/puppet-windows-env/issues/comments/129064355","html_url":"https://github.com/badgerious/puppet-windows-env/issues/8#issuecomment-129064355","issue_url":"https://api.github.com/repos/badgerious/puppet-windows-env/issues/8","id":129064355,"user":{"login":"badgerious","id":4565376,"avatar_url":"https://avatars.githubusercontent.com/u/4565376?v=3","gravatar_id":"","url":"https://api.github.com/users/badgerious","html_url":"https://github.com/badgerious","followers_url":"https://api.github.com/users/badgerious/followers","following_url":"https://api.github.com/users/badgerious/following{/other_user}","gists_url":"https://api.github.com/users/badgerious/gists{/gist_id}","starred_url":"https://api.github.com/users/badgerious/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/badgerious/subscriptions","organizations_url":"https://api.github.com/users/badgerious/orgs","repos_url":"https://api.github.com/users/badgerious/repos","events_url":"https://api.github.com/users/badgerious/events{/privacy}","received_events_url":"https://api.github.com/users/badgerious/received_events","type":"User","site_admin":false},"created_at":"2015-08-08T23:07:15Z","updated_at":"2015-08-08T23:07:15Z","body":"@ferventcoder Cool. Based on the way you're using windows_env, you may want to have a look at #11, a long standing issue I've not bothered to address since no one has complained. But it might affect you here."}}