summaryrefslogtreecommitdiff
path: root/lib/rubygems/package/tar_input.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-04-17 20:50:00 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-04-17 20:50:00 +0000
commit22d9456b7917fe96fa81fd1d994073312753af8b (patch)
treebe157928ed84f75988ceb82a070797c3482b66a6 /lib/rubygems/package/tar_input.rb
parent22263729af357eb86e8bc2165a9eaa6f25eec8a6 (diff)
* lib/rubygems: Update to RubyGems 1.8.22 plus r33517 and r35337 which
were ported to the rubygems git repository. See https://github.com/rubygems/rubygems/blob/1.8/History.txt for changes since 1.8.11. * test/rubygems: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35370 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/package/tar_input.rb')
-rw-r--r--lib/rubygems/package/tar_input.rb32
1 files changed, 18 insertions, 14 deletions
diff --git a/lib/rubygems/package/tar_input.rb b/lib/rubygems/package/tar_input.rb
index 5ac93ff336..77b4d698da 100644
--- a/lib/rubygems/package/tar_input.rb
+++ b/lib/rubygems/package/tar_input.rb
@@ -210,21 +210,25 @@ 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)
- 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
+ Zlib::GzipReader.new entry
end
end