Issue #17010 has been updated by Josh Cooper.

Status changed from Accepted to Merged - Pending Release
Target version changed from 3.x to 3.2.4

This will be fixed in 3.2.4 as the win32-dir gem has been updated to 0.4.3. 
Alternatively, you can do a `gem update win32-dir`.

See also #21285 (same bug in facter)

----------------------------------------
Bug #17010: win32-dir gem returns a string whose encoding is not 
`ascii_compatible?`
https://projects.puppetlabs.com/issues/17010#change-95802

* Author: Ed Sumerfield
* Status: Merged - Pending Release
* Priority: Normal
* Assignee: Josh Cooper
* Category: 
* Target version: 3.2.4
* Affected Puppet version: 3.0.0
* Keywords: windows
* Branch: 
----------------------------------------
Problem originally defined by this exception:

<pre>
: irb
irb(main):001:0> require "rspec-puppet"
Failed to load feature test for root: uninitialized constant 
Windows::Synchronize
ArgumentError: string contains null byte
        from 
C:/ruby193/lib/ruby/gems/1.9.1/gems/puppet-3.0.0/lib/puppet/util/run_mode.rb:67:in
 `join'
        from 
C:/ruby193/lib/ruby/gems/1.9.1/gems/puppet-3.0.0/lib/puppet/util/run_mode.rb:67:in
 `conf_dir'
        from 
C:/ruby193/lib/ruby/gems/1.9.1/gems/puppet-3.0.0/lib/puppet/settings.rb:495:in 
`user_config_file'
        from 
C:/ruby193/lib/ruby/gems/1.9.1/gems/puppet-3.0.0/lib/puppet/settings.rb:1234:in 
`which_configuration_file'
        from 
C:/ruby193/lib/ruby/gems/1.9.1/gems/puppet-3.0.0/lib/puppet/settings.rb:475:in 
`parse_config_files'
        from 
C:/ruby193/lib/ruby/gems/1.9.1/gems/puppet-3.0.0/lib/puppet/settings.rb:147:in 
`initialize_global_settings'

        from 
C:/ruby193/lib/ruby/gems/1.9.1/gems/puppet-3.0.0/lib/puppet.rb:135:in 
`do_initialize_settings_for_run_mode'

        from 
C:/ruby193/lib/ruby/gems/1.9.1/gems/puppet-3.0.0/lib/puppet.rb:123:in 
`initialize_settings'
        from 
C:/ruby193/lib/ruby/gems/1.9.1/gems/rspec-puppet-0.1.5/lib/rspec-puppet.rb:10:in
 `&lt;top (required)>'
        from 
C:/ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `require'
        from 
C:/ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in 
require'
        from 
C:/ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
        from (irb):1
        from C:/ruby193/bin/irb:12:in `&lt;main>'
</pre>

Research concluded that ruby 1.9.3 does not support File.join of strings that 
are not UTF-8.  There is a ruby fix associated with this problem mentioned here:

<https://bugs.ruby-lang.org/issues/7168>

Since this fix is not useful for 1.9.3 the following patch is a possible way 
around it.

<pre>
class File
  class << self
    alias_method :original_join, :join
  end

  def self.join(*args)
    new_args = args.collect { |questionableEncoding|
      join_encoding_fix(questionableEncoding)
    }
    self.send(:original_join, new_args)
  end

  def self.join_encoding_fix(value)
    if (value.instance_of?(String))
      value = value.encode("UTF-8")
    elsif (value.instance_of?(Array))
      value = value.collect { |subValue|
        join_encoding_fix(subValue)
      }
    end
    value
  end
end
</pre>


-- 
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