Skip to content

Loading…

bundle install: tar_input.rb:111:in `initialize': No metadata found! #704

Closed
powcloud opened this Issue · 13 comments

6 participants

@powcloud

Here is the command and stack trace. The offending gem seems to be 'shoulda':

Gemfile:

group :test do
  gem "shoulda"
end

$ bundle install
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.rb:111:in `initialize': No metadata found! (Gem::Package::FormatError)
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.rb:17:in `new'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.rb:17:in `open'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems/package.rb:58:in `open'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems/format.rb:63:in `from_io'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems/format.rb:51:in `from_file_by_path'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/1.8/open-uri.rb:32:in `open_uri_original_open'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/1.8/open-uri.rb:32:in `open'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems/format.rb:50:in `from_file_by_path'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/source.rb:198:in `cached_specs'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/source.rb:196:in `each'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/source.rb:196:in `cached_specs'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/source.rb:195:in `each'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/source.rb:195:in `cached_specs'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/source.rb:157:in `fetch_specs'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/index.rb:7:in `build'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/source.rb:155:in `fetch_specs'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/source.rb:70:in `specs'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/definition.rb:161:in `index'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/definition.rb:160:in `each'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/definition.rb:160:in `index'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/index.rb:7:in `build'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/definition.rb:159:in `index'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/definition.rb:153:in `resolve'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/definition.rb:93:in `specs'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/definition.rb:88:in `resolve_remotely!'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/installer.rb:35:in `run'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/installer.rb:8:in `install'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/cli.rb:217:in `install'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/vendor/thor/task.rb:22:in `send'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/vendor/thor/task.rb:22:in `run'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/vendor/thor.rb:246:in `dispatch'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/vendor/thor/base.rb:389:in `start'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.0/bin/bundle:13
from /opt/ruby-enterprise-1.8.7-2010.02/bin/bundle:19:in `load'
from /opt/ruby-enterprise-1.8.7-2010.02/bin/bundle:19
@radar

I cannot reproduce this.

@powcloud

I tracked this down to a corrupt .gem file in rubygems/cache folder. I submitted a patch to the rubygems team to provide better diagnostic output message which identifies the offending file. It still doesn't address the root cause, but should help people find the problem faster.

At line 111 in /rubygems/package/tar_input.rb, change to:

unless has_meta
puts "#{io.path} may be corrupt! Delete it and retry the operation"
raise Gem::Package::FormatError, "No metadata found!"
end

@rslifka

Yep, same thing happened to me. "gem list" showed 2 gems, yet there were 3 in $GEM_HOME/cache. Deleted the odd man out and voila! Thanks :)

@mazuhl

I had the same issue caused by a failed install of Capybara 0.4.0 sitting in the cache. To get Capybara working (on Snow Leopard) I'd dropped down to 0.3.9. Going into the Rubygems cache and deleting the 0.4.0 gem and re-running 'bundle install' solved the problem.

@shedd

I've been hitting this issue with the htmlentities gem - putting a fresh copy of the gemfile into the cache didn't help.

I'm attempting to install the htmlentities gem onto a new system via Bundler.

When running bundle install I keep hitting this error:

bundle install --deployment --local
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.rb:111:in initialize': No metadata found! (Gem::Package::FormatError)
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.rb:17:in
new'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.rb:17:in open'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems/package.rb:58:in
open'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems/format.rb:63:in from_io'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems/format.rb:51:in
from_file_by_path'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/1.8/open-uri.rb:32:in open_uri_original_open'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/1.8/open-uri.rb:32:in
open'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems/format.rb:50:in from_file_by_path'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.2/lib/bundler/source.rb:197:in
cached_specs'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.2/lib/bundler/source.rb:195:in each'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.2/lib/bundler/source.rb:195:in
cached_specs'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.2/lib/bundler/source.rb:194:in each'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.2/lib/bundler/source.rb:194:in
cached_specs'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.2/lib/bundler/source.rb:157:in fetch_specs'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.2/lib/bundler/index.rb:7:in
build'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.2/lib/bundler/source.rb:155:in fetch_specs'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.2/lib/bundler/source.rb:70:in
specs'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.2/lib/bundler/lazy_specification.rb:48:in __materialize__'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.2/lib/bundler/spec_set.rb:83:in
materialize'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.2/lib/bundler/spec_set.rb:81:in map!'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.2/lib/bundler/spec_set.rb:81:in
materialize'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.2/lib/bundler/definition.rb:93:in specs'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.2/lib/bundler/definition.rb:81:in
resolve_with_cache!'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.2/lib/bundler/installer.rb:34:in run'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.2/lib/bundler/installer.rb:8:in
install'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.2/lib/bundler/cli.rb:217:in install'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.2/lib/bundler/vendor/thor/task.rb:22:in
send'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.2/lib/bundler/vendor/thor/task.rb:22:in run'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.2/lib/bundler/vendor/thor/invocation.rb:118:in
invoke_task'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.2/lib/bundler/vendor/thor.rb:246:in dispatch'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.2/lib/bundler/vendor/thor/base.rb:389:in
start'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.2/bin/bundle:13
from /opt/REE/bin/bundle:19:in `load'
from /opt/REE/bin/bundle:19

Based on the suggestion at this page - http://codebeef.com/bundler-no-metadata-found-problem - we have patched tar_input.rb to provide further details.

This yields the following:

/opt/www/appname/vendor/cache/htmlentities-4.2.1.gem may be corrupt! Delete it and retry the operation

Based on this error message, I had Bundler recache the gem, but hit the same issue again. I don't believe htmlentities to actually be corrupt, especially as I've run into this issue with a fresh cache of the gem file. Why would it appear as corrupt to Bundler?

@shedd

Thanks to a fast resolution from the author of htmlentities, version 4.2.2 of that specific gem resolves this issue.

His fix:

I think the problem was a reference to README.txt in the gem specification, when the file is actually README.rdoc. I've fixed it and pushed a new version, which I successfully installed into a test project using Bundler.

However, now I'm running into this issue with another gem - json_pure-1.4.6.gem

Is there any hope of getting a broader resolution to this issue, which is currently preventing bundle install from running? Thanks!

@indirect
Bundler member

I'm pretty sure this is a bug in REE that has just recently been fixed: http://code.google.com/p/rubyenterpriseedition/issues/detail?id=45

@shedd

Thanks - we'll give the fix a try and will report back.

@shedd

We are still having an issue - I don't believe that this is related to the REE bug as suggested.

We updated zlib to latest release ‘libz.so.1.2.5’, rebuilt REE again and still get the same error.

Any other ideas?

bundle install
/opt/www/vendor/cache/json_pure-1.4.6.gem may be corrupt! Delete it and retry the operation
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.rb:113:in initialize': No metadata found! (Gem::Package::FormatError)
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.rb:17:in
new'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.rb:17:in open'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems/package.rb:58:in
open'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems/format.rb:63:in from_io'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems/format.rb:51:in
from_file_by_path'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/1.8/open-uri.rb:32:in open_uri_original_open'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/1.8/open-uri.rb:32:in
open'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems/format.rb:50:in from_file_by_path'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.3/lib/bundler/source.rb:197:in
cached_specs'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.3/lib/bundler/source.rb:195:in each'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.3/lib/bundler/source.rb:195:in
cached_specs'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.3/lib/bundler/source.rb:194:in each'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.3/lib/bundler/source.rb:194:in
cached_specs'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.3/lib/bundler/source.rb:157:in fetch_specs'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.3/lib/bundler/index.rb:7:in
build'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.3/lib/bundler/source.rb:155:in fetch_specs'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.3/lib/bundler/source.rb:70:in
specs'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.3/lib/bundler/lazy_specification.rb:48:in __materialize__'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.3/lib/bundler/spec_set.rb:83:in
materialize'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.3/lib/bundler/spec_set.rb:81:in map!'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.3/lib/bundler/spec_set.rb:81:in
materialize'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.3/lib/bundler/definition.rb:93:in specs'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.3/lib/bundler/definition.rb:88:in
resolve_remotely!'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.3/lib/bundler/installer.rb:35:in run'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.3/lib/bundler/installer.rb:8:in
install'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.3/lib/bundler/cli.rb:221:in install'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.3/lib/bundler/vendor/thor/task.rb:22:in
send'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.3/lib/bundler/vendor/thor/task.rb:22:in run'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.3/lib/bundler/vendor/thor/invocation.rb:118:in
invoke_task'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.3/lib/bundler/vendor/thor.rb:246:in dispatch'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.3/lib/bundler/vendor/thor/base.rb:389:in
start'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/bundler-1.0.3/bin/bundle:13
from /opt/REE/bin/bundle:19:in `load'
from /opt/REE/bin/bundle:19

@indirect
Bundler member

Have you tried deleting json_pure-1.4.6.gem and fetching a new copy with gem fetch json_pure? Either your .gem file is corrupted, or REE can't read it successfully.

@shedd

Thanks for the response. See above - I got a similar error message from htmlentities - it was not corrupt. I redownloaded it and tried again and still had the same issue. The author of the gem had to make a modification to prevent the error message. My gem cache is stored in git, so I don't think corruption is likely in this case.

I don't get this error message for any of these gems on OS X, only on Linux with this REE install.

Is there another way to confirm what the source of this error is?

@indirect
Bundler member

Unfortunately, there is no "broader resolution" possible for this issue -- you're seeing unique issues with individual, specific gems. The best I can do inside Bundler is just rescue the error and let you know which gem can't be read. It's not possible to "recover" from an invalid .gem file error.

If you'd like to try it yourself, you can run this in e.g. irb:

Gem::Format.from_file_by_path("/path/to/gemfile.gem").spec

The output should let you know exactly what the problem is.

@shedd

Thanks - what I don't understand, though, is why does this issue exist only on my Linux server? The Gemfile runs fine on Mac OS X? I have seen 0 of these gem format errors on the Mac.

@joevandyk joevandyk pushed a commit to joevandyk/bundler that referenced this issue
@indirect indirect Catch errors reading .gem files and report them with the path
This allows users with genuinely corrupt .gem files to know where they
are located and delete them so Bundler can continue installing.

Closes #704
cc0f24c
This issue was closed.
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.