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  <m...@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/


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

>Comment By: Randall Lucas (rlucas)
Date: 2010-05-01 10:48

Message:
This appears to have been fixed in trunk.  Current code
takes the better approach of testing for the "Encoding"
class name symbol, and specifying encoding if it exists (as
it does in 1.9.1 and above).

Lurking cousin errors to this, with the version check
assumption of consistent behavior for >= 1.9 (when in fact,
1.9.0 and 1.9.1 have pretty major API diffs), may linger here:

rubygems/commands/install_command.rb:112:    ENV.delete
'GEM_PATH' if options[:install_dir].nil? and RUBY_VERSION >
'1.9'

rubygems/config_file.rb:54:      if RUBY_VERSION > '1.9' then

rubygems/validator.rb:168:  if RUBY_VERSION < '1.9' then

rubygems/validator.rb:215:    if RUBY_VERSION < '1.9' then

rubygems.rb:500:    unless RUBY_VERSION > '1.9' then

rubygems.rb:1135:require 'rubygems/custom_require' if
gem_disabled or RUBY_VERSION < '1.9'


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

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=575&aid=28155&group_id=126
_______________________________________________
Rubygems-developers mailing list
http://rubyforge.org/projects/rubygems
Rubygems-developers@rubyforge.org
http://rubyforge.org/mailman/listinfo/rubygems-developers

Reply via email to