[Rubygems-developers] [ rubygems-Bugs-28155 ] source_index.rb uses 1.9.1 IO#read API under RUBY_VERSION 1.9.0; other 1.9.0 issues

noreply at rubyforge.org noreply at rubyforge.org
Thu Apr 29 15:10:35 EDT 2010


Bugs item #28155, was opened at 2010-04-29 12:10
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=575&aid=28155&group_id=126

Category: other
Group: v1.3.x
Status: Open
Resolution: None
Priority: 3
Submitted By: Randall Lucas (rlucas)
Assigned to: Nobody (None)
Summary: source_index.rb uses 1.9.1 IO#read API under RUBY_VERSION 1.9.0; other 1.9.0 issues

Initial Comment:
Facially, this looks like an argument TypeError, and manifests thus:

/usr/local/lib/site_ruby/1.9/rubygems/source_index.rb:91:in `IO#read': can't convert Hash into Integer (TypeError)

In fact, it's a very similar issue to #28154.

source_index.rb at line 88 checks RUBY_VERSION < '1.9' before using the new :encoding => 'UTF-8' calling syntax for File.read (IO#read).

However, this change didn't make it into Ruby 1.9.0 (see below from core Changelog).

Again, the fix here is to check RUBY_VERSION < '1.9.1'

Similar errors may be lurking in config_file.rb, defaults.rb, vanidator.rb, and in the tests.


---
$ irb1.9
irb(main):001:0> File.open '/tmp/thing.txt' , :encoding => 'UTF-8'
TypeError: can't convert Hash into String
        from (irb):1:in `initialize'
        from (irb):1:in `Kernel#binding'

---
Fri Feb 15 16:22:49 2008  Yukihiro Matsumoto  <matz at ruby-lang.org>

    * io.c (open_key_args): allow specifying both :mode and :encoding.
---
$ ruby -v
ruby 1.9.0 (2006-06-08) [x86_64-linux]

$ gem ENV
RubyGems Environment:
  - RUBYGEMS VERSION: 1.3.6
  - RUBY VERSION: 1.9.0 (2006-06-08) [x86_64-linux]
  - INSTALLATION DIRECTORY: /usr/lib/ruby1.9/gems/1.9
  - RUBY EXECUTABLE: /usr/bin/ruby1.9
  - EXECUTABLE DIRECTORY: /usr/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /usr/lib/ruby1.9/gems/1.9
     - /home/rlucas/.gem/ruby/1.9
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/


----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=575&aid=28155&group_id=126


More information about the Rubygems-developers mailing list