Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoMethodError: undefined method `pos' for #<Bzip2::Reader:0xaa2bf5c> #11

Open
dadooda opened this issue Nov 21, 2011 · 0 comments
Open

Comments

@dadooda
Copy link

dadooda commented Nov 21, 2011

Hi

I'm trying to use bzip2-ruby to stream-in .tar.bz2 files via Gem::Package::TarReader.

BRIEF: It doesn't work yet due to this:

NoMethodError: undefined method `pos' for #<Bzip2::Reader:0xaa2bf5c>

Details follow.

require "bzip2-ruby"
require "rubygems/package"

#fn = "/path/to/file.tar"
fn = "/path/to/file.tar.bz2"
#fn = "/path/to/file.tar.gz"

stream = if fn.match /\.bz2\z/
  Bzip2::Reader.open(fn)
elsif fn.match /\.gz\z/
  Zlib::GzipReader.open(fn)
elsif fn.match /\.tar\z/
  File.open(fn)
else
  raise "Error: Don't know how to handle '#{fn}', aborting"
end

untar = Gem::Package::TarReader.new(stream)
untar.each do |entry|
  ...
end

Plain tar and .tar.gz work. .tar.bz2 doesn't, here's the exception info:

NoMethodError: undefined method `pos' for #<Bzip2::Reader:0xaad6394>
        from /home/rbdev/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/package/tar_reader.rb:42:in `initialize'
        from /home/rbdev/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/package/tar_reader.rb:23:in `new'
        from /home/rbdev/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/package/tar_reader.rb:23:in `new'

Thank you.

Alex

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant