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

minitar.rb gives undefined method `size' for nil:NilClass (NoMethodError) #6

Closed
halostatue opened this issue Jul 31, 2011 · 3 comments

Comments

@halostatue
Copy link
Owner

Submitted by Takaaki Kato (http://rubyforge.org/users/samuraicoder)

I was running the following script.

require 'rubygems'
require 'archive/tar/minitar'
file = "Amazon.com- Mind Performance Hacks- Tips & Tools for Overclocking Your Brain (Hacks)- Books- Ron
Hale-Evans.webloc"

out = Archive::Tar::Minitar::Output.new("compress.tar")
  Archive::Tar::Minitar::pack_file(file, out)
out.close

I get the errors as seen below:

/opt/local/lib/ruby/gems/1.8/gems/archive-tar-minitar-0.5.2/lib/archive/tar/minitar.rb:432:in `split_name': undefined
method `size' for nil:NilClass (NoMethodError)
    from /opt/local/lib/ruby/gems/1.8/gems/archive-tar-minitar-0.5.2/lib/archive/tar/minitar.rb:430:in `loop'
    from /opt/local/lib/ruby/gems/1.8/gems/archive-tar-minitar-0.5.2/lib/archive/tar/minitar.rb:430:in `split_name'
    from /opt/local/lib/ruby/gems/1.8/gems/archive-tar-minitar-0.5.2/lib/archive/tar/minitar.rb:329:in `add_file_simple'
    from /opt/local/lib/ruby/gems/1.8/gems/archive-tar-minitar-0.5.2/lib/archive/tar/minitar.rb:914:in `pack_file'
    from compress.rb:34

Something seems to be wrong with the filename of my file.
The script I used and the file to be compressed are under the same directory.
archive-tar-minitar (0.5.2)
ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-darwin9]

@bhavinkamani
Copy link

I am facing the same issue on archive-tar-minitar (0.5.2). I am using ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin10.8.0]

@sundbp
Copy link

sundbp commented Oct 26, 2011

I've got a fix for the problem. Will create a pull request soon. Just needs a " unless ret.nil?" since @io.read can return nil on EOF.

@halostatue
Copy link
Owner Author

Note that this will still error out, but it will now correctly raise Archive::Tar::Minitar::FileNameTooLong. The filename is 114 characters long in the example provided; in default tar behaviour, files can only be 100 characters long.

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

3 participants