view · edit · sidebar · attach · print · history

Rubygems 1.3.7

File.read in source_index.rb uses Ruby 1.9 syntax, breaks in 1.8

 http://rubyforge.org/tracker/?func=detail&atid=577&aid=28644&group_id=126

the error I get is

 [Fri Dec 17 08:13:39 2010] [error] mod_ruby: error in ruby
 [Fri Dec 17 08:13:39 2010] [error] mod_ruby: /usr/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:89:in `read': can't convert Hash into Integer (TypeError)
 [Fri Dec 17 08:13:39 2010] [error] mod_ruby:   from /usr/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:89:in `load_specification'
 [Fri Dec 17 08:13:39 2010] [error] mod_ruby:   from /usr/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:153:in `load_gems_in'
 [Fri Dec 17 08:13:39 2010] [error] mod_ruby:   from /usr/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:152:in `each'
 [Fri Dec 17 08:13:39 2010] [error] mod_ruby:   from /usr/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:152:in `load_gems_in'
 [Fri Dec 17 08:13:39 2010] [error] mod_ruby:   from /usr/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:149:in `reverse_each'
 [Fri Dec 17 08:13:39 2010] [error] mod_ruby:   from /usr/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:149:in `load_gems_in'
 [Fri Dec 17 08:13:39 2010] [error] mod_ruby:   from /usr/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:345:in `refresh!'
 [Fri Dec 17 08:13:39 2010] [error] mod_ruby:   from /usr/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:78:in `from_gems_in'
 [Fri Dec 17 08:13:39 2010] [error] mod_ruby:    ... 17 levels...
 [Fri Dec 17 08:13:39 2010] [error] mod_ruby:   from /var/www/janico.ywesee.com/doc/geh.rbx:7:in `require'
 [Fri Dec 17 08:13:39 2010] [error] mod_ruby:   from /var/www/janico.ywesee.com/doc/geh.rbx:7
 [Fri Dec 17 08:13:39 2010] [error] mod_ruby:   from /usr/lib/ruby/1.8/apache/ruby-run.rb:53:in `load'
 [Fri Dec 17 08:13:39 2010] [error] mod_ruby:   from /usr/lib/ruby/1.8/apache/ruby-run.rb:53:in `handler'

the patch is

 --- rubygems-1.3.7/lib/rubygems/source_index.rb.orig    2010-10-12 14:30:44.255712000 -0400
 +++ rubygems-1.3.7/lib/rubygems/source_index.rb 2010-10-12 14:33:31.317356000 -0400
  -85,7 +85,7  class Gem::SourceIndex
     def load_specification(file_name)
       return nil unless file_name and File.exist? file_name

 -      spec_code = if defined? Encoding then
 +      spec_code = if defined? Encoding and RUBY_VERSION.to_f >= 1.9 then
                     File.read file_name, :encoding => 'UTF-8'
                   else
                     File.read file_name

I edited this file on whitie:

 /usr/lib/ruby/site_ruby/1.8/rubygems/source_index.rb

Ruby on Rails also seems to have the issue:

 http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/6dbab55a2a105dde?pli=1
view · edit · sidebar · attach · print · history
Page last modified on January 03, 2011, at 02:55 PM