Skip to content

Zlib::GzipWriter#<< wrongly returns nil #1623

Closed
myronmarston opened this Issue Mar 19, 2012 · 1 comment

3 participants

@myronmarston
# use_zlib.rb

require 'stringio'
require 'zlib'

io = StringIO.new
content = "abc"
Zlib::GzipWriter.new(io).<<(content).close

puts io.string

MRI 1.8.7:

➜ rvm use 1.8.7
Using /Users/myron/.rvm/gems/ruby-1.8.7-p352
➜ ruby --version
ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-darwin10.8.0]
➜ ruby use_zlib.rb 
??fOKLJ?A$5

MRI 1.9.2:

➜ rvm use 1.9.2
Using /Users/myron/.rvm/gems/ruby-1.9.2-p290
➜ ruby --version
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin10.8.0]
➜ ruby use_zlib.rb 
6?fOKLJ?A$5

Rubinius:

➜ rvm use rbx
Using /Users/myron/.rvm/gems/rbx-head
➜ ruby --version
rubinius 2.0.0dev (1.8.7 66086cff yyyy-mm-dd JI) [x86_64-apple-darwin10.8.0]
➜ ruby use_zlib.rb 
An exception occurred running use_zlib.rb
    undefined method `close' on nil:NilClass. (NoMethodError)

Backtrace:
  Kernel(NilClass)#close (method_missing) at kernel/delta/kernel.rb:81
                     Object#__script__ at use_zlib.rb:6
      Rubinius::CodeLoader#load_script at kernel/delta/codeloader.rb:67
      Rubinius::CodeLoader.load_script at kernel/delta/codeloader.rb:109
               Rubinius::Loader#script at kernel/loader.rb:630
                 Rubinius::Loader#main at kernel/loader.rb:834
@jc00ke
Rubinius member
jc00ke commented Mar 19, 2012

@myronmarston thanks, looks like it's broken in both 1.8 & 1.9 mode (which tracks 1.9.3, not 1.9.2 fyi)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.