Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
-
-
Agent
-
2
-
AP 2017-01-11
-
Bug Fix
-
Prior to Puppet 4.9.0, if a puppet agent was run in a non-UTF-8 locale, puppet would fail to apply a change to a user comment on linux and Windows if the change included UTF-8 comments. This has been resolved in Puppet 4.9.0.
-
No Action
-
Well-tested in spec
Description
Given `puppet apply` this manifest:
user { 'foo' :
|
comment => "\u2603",
|
ensure => present,
|
}
|
The following change happens on every puppet run:
Notice: /Stage[main]/Main/User[foo]/comment: comment changed '?' to '☃'
|
Different unicode characters have the same result:
...
|
comment => "\u{2070E}"
|
...
|
results in:
Notice: /Stage[main]/Main/User[foo]/comment: comment changed '??' to '𠜎'
|
A quick investigation makes it appear we're failing to correctly round-trip the unicode to/from Windows in https://github.com/puppetlabs/puppet/blob/master/lib/puppet/util/windows/adsi.rb#L197-L206:
From: C:/Users/moses/development/puppet/lib/puppet/util/windows/adsi.rb @ line 207 Puppet::Util::Windows::ADSI::User#[]=:
|
|
205: def []=(attribute, value)
|
206: require 'pry';binding.pry
|
=> 207: native_user.Put(attribute, value)
|
208: end
|
|
[18] pry(#<Puppet::Util::Windows::ADSI::User>)> attribute
|
=> "Description"
|
[19] pry(#<Puppet::Util::Windows::ADSI::User>)> value
|
=> "\u{2070E}"
|
[20] pry(#<Puppet::Util::Windows::ADSI::User>)> value.bytes
|
=> [240, 160, 156, 142]
|
[21] pry(#<Puppet::Util::Windows::ADSI::User>)> native_user.Put(attribute, value)
|
=> nil
|
[22] pry(#<Puppet::Util::Windows::ADSI::User>)> is = native_user.Get(attribute)
|
=> "??"
|
[23] pry(#<Puppet::Util::Windows::ADSI::User>)> is.bytes
|
=> [63, 63]
|
[24] pry(#<Puppet::Util::Windows::ADSI::User>)> Encoding.default_external
|
=> #<Encoding:IBM437>
|
[25] pry(#<Puppet::Util::Windows::ADSI::User>)> value.encoding
|
=> #<Encoding:UTF-8>
|
[26] pry(#<Puppet::Util::Windows::ADSI::User>)> is.encoding
|
=> #<Encoding:IBM437>
|
Note that the bytes read back via `Get` are not the same as the value we `Put`