Zlib::GzipWriter.wrap in 1.9 mode accepts only one argument #552

Closed
drbrain opened this Issue Feb 27, 2013 · 2 comments

Projects

None yet

3 participants

@drbrain
drbrain commented Feb 27, 2013

It seems this was fixed once upon a time in http://jira.codehaus.org/browse/JRUBY-2405 but it seems that change was lost some time over the past five years.

This is related to rubygems/rubygems#472, so jruby users in 1.9 mode can't install gems with RubyGems 2.0.0.

Here is an example to reproduce with:

require 'stringio'
require 'zlib'

io = StringIO.new \
       "\x1F\x8B\b\0ou-Q\0\x03\xCBH\xCD\xC9\xC9\a\0\x86\xA6\x106\x05\0\0\0"

Zlib::GzipReader.wrap io, external_encoding: Encoding::UTF_8 do |gzio|
  puts gzio.read
end

This should print "hello"

@enebo enebo was assigned Feb 27, 2013
@BanzaiMan
Member

https://github.com/jruby/jruby/blob/master/src/org/jruby/ext/zlib/RubyGzipFile.java#L67-L80

We just need to pass an optional external encoding. It should be straightforward.

http://jira.codehaus.org/browse/JRUBY-2405 changed the method from 2-args to 1-arg, by the way.

@enebo
Member
enebo commented Feb 28, 2013

Thanks for reporting this Eric. As Hiro said this was both simple and was not a regression of JRUBY-2405 (that was well before 1.9 support was even under way for us).

@enebo enebo closed this Feb 28, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment