Bug 808573 - rubygems passes an unsupported argument to File.read in ruby 1.8.7
rubygems passes an unsupported argument to File.read in ruby 1.8.7
Status: CLOSED WORKSFORME
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: rubygems (Show other bugs)
6.2
x86_64 Linux
unspecified Severity medium
: rc
: ---
Assigned To: Vít Ondruch
BaseOS QE - Apps
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-03-30 14:28 EDT by Mike
Modified: 2013-08-13 02:23 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-08-13 02:23:50 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Mike 2012-03-30 14:28:32 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:

    def load_specification(file_name)
      return nil unless file_name and File.exist? file_name

      spec_code = if defined? Encoding then
                    File.read file_name, :encoding => 'UTF-8'
                  else
                    File.read file_name
                  end.untaint


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'
        from (irb):1
        from :0

It looks like this feature was added in Ruby 1.9.
http://ruby-doc.org/core-1.8.7/IO.html#method-c-read
http://ruby-doc.org/core-1.9.3/IO.html#method-c-read

Version-Release number of selected component (if applicable):
ruby-1.8.7.299-7.el6.x86_64
rubygems-1.3.7-1.el6.noarch
Comment 2 Vít Ondruch 2012-07-24 04:51:11 EDT
(In reply to comment #0)

Hi Mike,

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.
Comment 3 RHEL Product and Program Management 2012-09-07 01:25:25 EDT
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.
Comment 4 Vít Ondruch 2013-08-13 02:23:50 EDT
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.

Note You need to log in before you can comment on or make changes to this bug.