Issue #23185 has been updated by Josh Cooper.

Subject changed from puppet agent service can't start when current system 
locale is not english in windows environment to puppet agent service can't 
start when using GBK encoding in windows environment
Status changed from Duplicate to Accepted

This appears to be a variation of issue #22493, though slightly different, and 
a valid problem for puppet.

It seems very suspicious to me that the win32-dir gem is raising 
`UndefinedConversionError`. The gem queries the system for known folders, and 
then fails to transcode the string into the default external encoding (GBK). 
It's not like the gem accepted user-specified input.

I'm pretty sure the gem is confused about what encoding the string is currently 
in, and the fix that was applied in version 0.4.6 is masking the root cause.

One thing that seems wrong is that the `SHFILEINFO` structure's 
[szDisplayInfo](https://github.com/djberg96/win32-dir/blob/ffi/lib/win32/dir/structs.rb#L11)
 field is declared as `:char` array, but it MSDN defines it as a 
[TCHAR](http://msdn.microsoft.com/en-us/library/windows/desktop/bb759792(v=vs.85\).aspx).
 Typically when using ffi with wide-character strings, you need to use 
`:buffer` or `:pointer` types, otherwise ffi will stop at the first null byte.

For the time being we should update puppet to use the 0.4.6 or later of 
win32-dir, and spend some time trying to figure out what's wrong with the gem.

----------------------------------------
Bug #23185: puppet agent service can't start when using GBK encoding in windows 
environment
https://projects.puppetlabs.com/issues/23185#change-100986

* Author: liu changyuan
* Status: Accepted
* Priority: Normal
* Assignee: 
* Category: 
* Target version: 
* Affected Puppet version: 3.2.4
* Keywords: windows win32-dir
* Branch: 
----------------------------------------
First of all, I am Chinese.
my laptop os is windows 7, and the 'Language for non-Unicode programs' is set 
to 'Chinese(Simplified,PRC)'.

several days before, i started install puppet 3.2.4 to my laptop, the package 
downloaded from downloads.puppetlabs.com/windows.
in the install progress, installer tells me puppet agent can't started. i found 
the command of puppet agent is 'service/daemon.bat', so i tried run it in 
command prompt. the result is:

<pre>
C:/Puppet/sys/ruby/lib/ruby/gems/1.9.1/gems/win32-dir-0.4.3/lib/win32/dir.rb:95:
in `encode': "\xCB" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to GBK (Enco
ding::UndefinedConversionError)
        from C:/Puppet/sys/ruby/lib/ruby/gems/1.9.1/gems/win32-dir-0.4.3/lib/win
32/dir.rb:95:in `block in &lt;class:Dir&gt;'
        from C:/Puppet/sys/ruby/lib/ruby/gems/1.9.1/gems/win32-dir-0.4.3/lib/win
32/dir.rb:74:in `each'
        from C:/Puppet/sys/ruby/lib/ruby/gems/1.9.1/gems/win32-dir-0.4.3/lib/win
32/dir.rb:74:in `&lt;class:Dir&gt;'
        from C:/Puppet/sys/ruby/lib/ruby/gems/1.9.1/gems/win32-dir-0.4.3/lib/win
32/dir.rb:5:in `&lt;top (required)&gt;'
        from C:/Puppet/sys/ruby/lib/ruby/site_ruby/1.9.1/rubygems/custom_require
.rb:60:in `require'
        from C:/Puppet/sys/ruby/lib/ruby/site_ruby/1.9.1/rubygems/custom_require
.rb:60:in `rescue in require'
        from C:/Puppet/sys/ruby/lib/ruby/site_ruby/1.9.1/rubygems/custom_require
.rb:35:in `require'
        from C:/Puppet/service/daemon.rb:5:in `&lt;main&gt;'
</pre>
I googled, it's the win32-dir module's bug. after upgraded it to 0.4.6, problem 
solved.

bug issue: <https://github.com/djberg96/win32-dir/issues/7>


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to