diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-04-17 21:17:56 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-04-17 21:17:56 +0000 |
commit | 0ebe38eedd3b0b0771f57e1d4a85d472a1b6b64f (patch) | |
tree | 3fd875633a962ad584d787f536e5ced1697e058e /lib/rubygems/package | |
parent | 02dc9ae773d458be60f3fa656d5bb50f41a1c9e2 (diff) | |
download | ruby-0ebe38eedd3b0b0771f57e1d4a85d472a1b6b64f.tar.gz |
Revert r35370 due to bad source branch
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/package')
-rw-r--r-- | lib/rubygems/package/tar_input.rb | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/lib/rubygems/package/tar_input.rb b/lib/rubygems/package/tar_input.rb index 77b4d698da..5ac93ff336 100644 --- a/lib/rubygems/package/tar_input.rb +++ b/lib/rubygems/package/tar_input.rb @@ -210,25 +210,21 @@ class Gem::Package::TarInput # the unpacking speed) we threw our hands in the air and declared that # this method would use the String IO approach on all platforms at all # times. And that's the way it is. - # - # Revisited. Here's the beginning of the long story. - # http://osdir.com/ml/lang.ruby.gems.devel/2007-06/msg00045.html - # - # StringIO wraping has never worked as a workaround by definition. Skipping - # initial 10 bytes and passing -MAX_WBITS to Zlib::Inflate luckily works as - # gzip reader, but it only works if the GZip header is 10 bytes long (see - # below) and it does not check inflated stream consistency (CRC value in the - # Gzip trailer.) - # - # RubyGems generated Gzip Header: 10 bytes - # magic(2) + method(1) + flag(1) + mtime(4) + exflag(1) + os(1) + - # orig_name(0) + comment(0) - # - # Ideally, it must return a GZipReader without meaningless buffering. We - # have lots of CRuby committers around so let's fix windows build when we - # received an error. + def zipped_stream(entry) - Zlib::GzipReader.new entry + if defined? Rubinius or defined? Maglev then + # these implementations have working Zlib + zis = Zlib::GzipReader.new entry + dis = zis.read + is = StringIO.new(dis) + else + # This is Jamis Buck's Zlib workaround for some unknown issue + entry.read(10) # skip the gzip header + zis = Zlib::Inflate.new(-Zlib::MAX_WBITS) + is = StringIO.new(zis.inflate(entry.read)) + end + ensure + zis.finish if zis end end |