Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: JRuby 1.6.3
    • Fix Version/s: None
    • Component/s: Ruby 1.9.2
    • Labels:
      None
    • Environment:
      Kubuntu 11.04 x64, Oracle Java 6 64bit, JRuby 1.6.3
    • Number of attachments :
      0

      Description

      RubyGems 1.8.8 breaks because JRuby doesn't support the same arguments as standard 1.9.2. This commit, https://github.com/rubygems/rubygems/commit/0825eb33a1f53ae6b5eee0c3a34b832c5837c04b#diff-0, is exposing a problem with JRuby where starting with 1.9.2 a hash or arguments can be passed to the constructor of GzipReader with the io object. See http://www.ruby-doc.org/stdlib/libdoc/zlib/rdoc/classes/Zlib/GzipReader.html#M010126

      Zlib::GzipReader.new(*args)
      ArgumentError: wrong number of arguments (2 for 1)
      from (irb):5:in `evaluate'
      from org/jruby/RubyKernel.java:1093:in `eval'
      from org/jruby/RubyKernel.java:1419:in `loop'
      from org/jruby/RubyKernel.java:1205:in `catch'
      from org/jruby/RubyKernel.java:1205:in `catch'
      from /home/arthur/bin/jruby/bin/irb:13:in `(root)'

      I've filed a bug with RubyGems here https://github.com/rubygems/rubygems/issues/157 but I'm not sure where the issue should get fixed as the ability to pass arguments to GzipReader.new is an undocumented feature.

        Activity

        Hide
        Bruce Burdick added a comment -

        +1
        Interested in this.

        Show
        Bruce Burdick added a comment - +1 Interested in this.
        Hide
        Arthur Shagall added a comment -

        I looked at what it would take to patch RubyZlib.java. Didn't look too difficult, but I don't entirely understand the implications for the rest of the code that expects GzipReader.new to only take one argument.

        Show
        Arthur Shagall added a comment - I looked at what it would take to patch RubyZlib.java. Didn't look too difficult, but I don't entirely understand the implications for the rest of the code that expects GzipReader.new to only take one argument.
        Hide
        Nate Murray added a comment - - edited

        +1

        As baburdick says here: https://github.com/rubygems/rubygems/issues/157 . This hack will let you limp along until the fix is in place:

            # Strip superfluous args from Zlib::GzipReader instantiation:
            if defined? RUBY_ENGINE and 
               RUBY_ENGINE == 'jruby' and
               JRUBY_VERSION =~ /\A1.6.[0123]\Z/ and
               RUBY_VERSION =~ /\A1.9.[12]\Z/ then
              module Zlib
                class GzipReader
                  alias :old_initialize :initialize
                  def initialize *args
                    old_initialize [*args][0]
                  end
                end
              end
            end
        
        Show
        Nate Murray added a comment - - edited +1 As baburdick says here: https://github.com/rubygems/rubygems/issues/157 . This hack will let you limp along until the fix is in place: # Strip superfluous args from Zlib::GzipReader instantiation: if defined? RUBY_ENGINE and RUBY_ENGINE == 'jruby' and JRUBY_VERSION =~ /\A1.6.[0123]\Z/ and RUBY_VERSION =~ /\A1.9.[12]\Z/ then module Zlib class GzipReader alias :old_initialize :initialize def initialize *args old_initialize [*args][0] end end end end
        Hide
        Charles Oliver Nutter added a comment -

        We patched around this in jruby-1_6/cc2c489 for JRUBY-5778, but it is not a complete implementation. I'm going to mark this as a duplicate of that one, since that one is still open pending a complete implementation.

        Show
        Charles Oliver Nutter added a comment - We patched around this in jruby-1_6/cc2c489 for JRUBY-5778 , but it is not a complete implementation. I'm going to mark this as a duplicate of that one, since that one is still open pending a complete implementation.

          People

          • Assignee:
            Charles Oliver Nutter
            Reporter:
            Arthur Shagall
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: