Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

same gem version with different content #4461

Closed
gingerlime opened this issue Apr 24, 2016 · 7 comments
Closed

same gem version with different content #4461

gingerlime opened this issue Apr 24, 2016 · 7 comments

Comments

@gingerlime
Copy link

I already posted it here but I'm not sure where the problem lies exactly, and looking for at least a safe workaround.

TL;DR we are using the same Gemfile, Gemfile.lock and same version of bundler (1.11.2) in two different environments, but we're seeing different actual content (files, directories) inside the Gem.

This seems rather weird and also we're now a little scared to deploy, in case we'll get a different version and things will break. We currently see this difference between our dev and continuous integration environment (Semaphore).

Even if it's possible that the same Gem version gets mutated, is there a bundle command to pull the gem again even if it's already installed?

@indirect
Copy link
Member

So, chances seem high that there is a corrupt cache involved here somewhere. The canonical version of the gem can be downloaded from rubygems.org/gems/GEMNAME. You can find cached gems in $GEM_HOME/cache/GEMNAME-VERSION.gem, and replace the cached gem with the correct .gem file.

You can tell Bundler to download and re-install by running bundle install --force, as long as you're using Bundler 1.11.

@gingerlime
Copy link
Author

gingerlime commented Apr 24, 2016

Thanks for the quick reply, @indirect!

I think in this particular case, rails-assets use their own source - i.e. it's not on rubygems.org (?)

Thanks for the tip about --force. It should at least ensure we overwrite any caches.

Just curious - but isn't there some way to fingerprint gems with a hash digest? So at least you can detect potential corruptions?

@indirect
Copy link
Member

@gingerlime since rails assets runs their own server, I don't know whether they guarantee that a gem version will always have the same contents.

The new index project that we've been working on for a few years now does include a hash of every gem. You can try out a version of Bundler that includes the new index by running gem install bundler --pre. That said, it's a prerelease and I'm honestly not sure if we actually use the gem hash to throw an exception yet.

@gingerlime
Copy link
Author

Thanks again, @indirect. Really good to know. I'll take a look. Hope this becomes stable and a more reliable way of using gems with bundler. It can certainly help avoid any surprises like we're seeing now :)

I'm closing this one, since the issue is quite clearly not in bundler.

@gingerlime
Copy link
Author

I just tried bundle install --force but it didn't change the content of the gem. If I install it on a clean environment however, it uses a slightly different version... Any clues why this might happen? or am I doing something wrong?

@coilysiren
Copy link
Contributor

related: #4464

@segiddins
Copy link
Member

New index format now has this, and given rails-assets says they don't guarantee stable gem contents, I don't see there's anything for us to do.

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

No branches or pull requests

4 participants