Red Hat Bugzilla – Bug 808573
rubygems passes an unsupported argument to File.read in ruby 1.8.7
Last modified: 2013-08-13 02:23:50 EDT
Description of problem:
The rubygems package seems to conflict with the version of ruby that is provided in RHEL6.
In /usr/lib/ruby/site_ruby/1.8/rubygems/source_index.rb, "File.read file_name, :encoding => 'UTF-8'" is used in the load_specification() method, but IO.read() in Ruby 1.8.7 does not support the passing of the :encoding hash.
Here is the code snippet:
return nil unless file_name and File.exist? file_name
spec_code = if defined? Encoding then
File.read file_name, :encoding => 'UTF-8'
And the reproducer:
[mkrysiak@unixdeva16 tmp]$ touch x.rb
[mkrysiak@unixdeva16 tmp]$ irb
irb(main):001:0> File.read 'x.rb', :encoding => 'UTF-8'
TypeError: can't convert Hash into Integer
from (irb):1:in `read'
It looks like this feature was added in Ruby 1.9.
Version-Release number of selected component (if applicable):
(In reply to comment #0)
Could you please be more specific? Under what circumstances it bites you? The Encoding class is not defined by default in Ruby 1.8.7, so it should use the "else" branch and works just fine IMO.
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unable to address this
request at this time.
Red Hat invites you to ask your support representative to
propose this request, if appropriate, in the next release of
Red Hat Enterprise Linux.
I am not able to reproduce this issue and no additional info was provided in year. I am closing this ticket as "WORKSFORME". Please feel free to reopen this ticket if you have more information.