Issue #17010 has been updated by Andrew Parker.

Target version changed from 3.0.x to 3.x

As the 3.0.x line is winding down with the impending release of 3.1.0, I am 
removing the target at 3.0.x from tickets in the system and targeting them at 
3.x instead.
----------------------------------------
Bug #17010: win32-dir gem returns a string whose encoding is not 
`ascii_compatible?`
https://projects.puppetlabs.com/issues/17010#change-80563

Author: Ed Sumerfield
Status: Accepted
Priority: Normal
Assignee: Josh Cooper
Category: 
Target version: 3.x
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to