Issue #17010 has been reported by Ed Sumerfield.

----------------------------------------
Bug #17010: Puppet 3.0 - Windows - Char Encoding Path Problem
https://projects.puppetlabs.com/issues/17010

Author: Ed Sumerfield
Status: Unreviewed
Priority: Normal
Assignee: 
Category: 
Target version: 
Affected Puppet version: 
Keywords: 
Branch: 


Problem originally defined by this exception:

: 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
 `<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 `<main>'

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.

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


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