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

bundle update is not updating vendor cached git gems #5423

Closed
bughit opened this issue Feb 10, 2017 · 5 comments · Fixed by #5602
Closed

bundle update is not updating vendor cached git gems #5423

bughit opened this issue Feb 10, 2017 · 5 comments · Fixed by #5602

Comments

@bughit
Copy link

bughit commented Feb 10, 2017

in this example timecop is locked at 6773a731104c96142e207bbc20a24c9a2d012081 which is the penultimate commit, bundle update should update it to the last commit b0a84cd674a380fb76285320b6d73088fc87f5df, but does nothing.

related to #5398.

bundle update timecop
Resolving dependencies...
Using timecop 0.8.0 from git://github.com/travisjeffery/timecop.git (at /tmp/bundler_cache_bug/vendor/cache/timecop-6773a731104c@6773a73)
Using bundler 1.14.3
Updating files in vendor/cache
Bundle updated!

Environment

Bundler   1.14.3
Rubygems  2.6.8
Ruby      2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux]
Git       2.11.0
Platform  x86_64-linux

Bundler settings

git.allow_insecure
  Set for the current user (/home/alex/.bundle/config): "true"
cache_all
  Set for your local app (/tmp/bundler_cache_bug/.bundle/config): "true"

Gemfile

Gemfile

gem 'timecop', github: 'travisjeffery/timecop'

Gemfile.lock

GIT
  remote: git://github.com/travisjeffery/timecop.git
  revision: 6773a731104c96142e207bbc20a24c9a2d012081
  specs:
    timecop (0.8.0)

GEM
  specs:

PLATFORMS
  ruby

DEPENDENCIES
  timecop!

BUNDLED WITH
   1.14.3
@bughit
Copy link
Author

bughit commented Feb 10, 2017

if you delete timecop-6773a731104c from the cache, bundle update does fetch the latest commit but caches it the wrong folder (timecop-6773a731104c)

so here's what's currently required to update a cached git gem

  1. manually delete it from the cache
  2. bundle update it
  3. since its cache folder is wrong, delete it again from the cache
  4. bundle install
  5. now it's cached in the right place

@colby-swandale
Copy link
Member

Sorry for the delay!

I ran through your instructions but was unable to replicate your problem

› cat Gemfile
source 'https://rubygems.org'

gem 'timecop', github: 'travisjeffery/timecop'

› cat Gemfile.lock
GIT
  remote: git://github.com/travisjeffery/timecop.git
  revision: 6773a731104c96142e207bbc20a24c9a2d012081
  specs:
    timecop (0.8.0)

GEM
  remote: https://rubygems.org/
  specs:

PLATFORMS
  ruby

DEPENDENCIES
  timecop!

BUNDLED WITH
   1.14.3

› bundle
The git source `git://github.com/travisjeffery/timecop.git` uses the `git` protocol, which transmits data without encryption. Disable this warning with `bundle config git.allow_insecure true`, or switch to the `https` protocol to keep your data secure.
Using timecop 0.8.0 from git://github.com/travisjeffery/timecop.git (at master@6773a73)
Using bundler 1.14.3
Bundle complete! 1 Gemfile dependency, 2 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.

Bundle Update

› bundle update
The git source `git://github.com/travisjeffery/timecop.git` uses the `git` protocol, which transmits data without encryption. Disable this warning with `bundle config git.allow_insecure true`, or switch to the `https` protocol to keep your data secure.
Fetching git://github.com/travisjeffery/timecop.git
Fetching gem metadata from https://rubygems.org/
Fetching version metadata from https://rubygems.org/
Resolving dependencies...
Using timecop 0.8.0 from git://github.com/travisjeffery/timecop.git (at master@b0a84cd)
Using bundler 1.14.3
Bundle updated!

› cat Gemfile.lock
GIT
  remote: git://github.com/travisjeffery/timecop.git
  revision: b0a84cd674a380fb76285320b6d73088fc87f5df
  specs:
    timecop (0.8.0)

GEM
  remote: https://rubygems.org/
  specs:

PLATFORMS
  ruby

DEPENDENCIES
  timecop!

BUNDLED WITH
   1.14.3

@bughit
Copy link
Author

bughit commented Feb 16, 2017

I don't think the gem was project vendor cached for you

you need to have `vendor\cache\timecop-6773a731104c' in the project folder, before you run bundle update timecop

bundle package --all should get it there

after that bundle show timecop' will point to vendor\cache\timecop-6773a731104c`

@colby-swandale
Copy link
Member

colby-swandale commented Feb 16, 2017

Thanks, i can replicate that behaviour now.

@mctaylorpants
Copy link
Contributor

I saw this over on #4871 - currently working on a fix.

bundlerbot added a commit that referenced this issue Apr 22, 2017
Ensure pre-existing Git caches are updated from remote sources

This will be my first contribution to Bundler. Thanks for the amazing dev setup guides!

This fixes issue #5423 where Git sources would not be updated if they were already cached in `vendor/cache`.

When we build a Git source from Gemfile.lock, we store the revision listed in the lockfile. However, when unlocking the source for an update, we don't clear that revision, and the update proceeds to grab the stale version from `vendor/cache`. Interestingly, this behaviour only occurs when updating a specific gem, i.e. `bundle update timecop`. This bug isn't present when doing a global `bundle update`, possibly because of the differences in how we build up the Definition between the two methods.

Closes #5423.
bundlerbot added a commit that referenced this issue Apr 22, 2017
Ensure pre-existing Git caches are updated from remote sources

This will be my first contribution to Bundler. Thanks for the amazing dev setup guides!

This fixes issue #5423 where Git sources would not be updated if they were already cached in `vendor/cache`.

When we build a Git source from Gemfile.lock, we store the revision listed in the lockfile. However, when unlocking the source for an update, we don't clear that revision, and the update proceeds to grab the stale version from `vendor/cache`. Interestingly, this behaviour only occurs when updating a specific gem, i.e. `bundle update timecop`. This bug isn't present when doing a global `bundle update`, possibly because of the differences in how we build up the Definition between the two methods.

Closes #5423.
segiddins pushed a commit that referenced this issue Apr 23, 2017
Ensure pre-existing Git caches are updated from remote sources

This will be my first contribution to Bundler. Thanks for the amazing dev setup guides!

This fixes issue #5423 where Git sources would not be updated if they were already cached in `vendor/cache`.

When we build a Git source from Gemfile.lock, we store the revision listed in the lockfile. However, when unlocking the source for an update, we don't clear that revision, and the update proceeds to grab the stale version from `vendor/cache`. Interestingly, this behaviour only occurs when updating a specific gem, i.e. `bundle update timecop`. This bug isn't present when doing a global `bundle update`, possibly because of the differences in how we build up the Definition between the two methods.

Closes #5423.

(cherry picked from commit 334b901)
philipefarias added a commit to dleemoo/rc-images that referenced this issue Jun 12, 2017
Changes since last version used (1.14.6):

== 1.15.1 (2017-06-02)

Bugfixes:

  - `bundle lock --update GEM` will fail gracefully when the gem is not in the lockfile (rubygems/bundler#5693, @segiddins)
  - `bundle init --gemspec` will fail gracefully when the gemspec is invalid (@colby-swandale)
  - `bundle install --force` works when the gemfile contains git gems (rubygems/bundler#5678, @segiddins)
  - `bundle env` will print well-formed markdown when there are no settings (rubygems/bundler#5677, @segiddins)

== 1.15.0 (2017-05-19)

This space intentionally left blank.

== 1.15.0.pre.4 (2017-05-10)

Bugfixes:

  - avoid conflicts when `Gem.finish_resolve` is called after the bundle has been set up (@segiddins)
  - ensure that `Gem::Specification.find_by_name` always returns an object that can have `#to_spec` called on it (rubygems/bundler#5592, @jules2689)

== 1.15.0.pre.3 (2017-04-30)

Bugfixes:

  - avoid redundant blank lines in the readme generated by `bundle gem` (@koic)
  - ensure that `open-uri` is not loaded after `bundle exec` (@segiddins)
  - print a helpful error message when an activated default gem conflicts with
    a gem in the gemfile (@segiddins)
  - only shorten `ref` option for git gems when it is a SHA (rubygems/bundler#5620, @segiddins)

== 1.15.0.pre.2 (2017-04-23)

Bugfixes:

  - ensure pre-existing fit caches are updated from remote sources (rubygems/bundler#5423, @alextaylor000)
  - avoid duplicating specs in the lockfile after updating with the gem uninstalled (rubygems/bundler#5599, @segiddins)
  - ensure git gems have their extensions available at runtime (rubygems/bundler#5594, @jules2689, @segiddins)

== 1.15.0.pre.1 (2017-04-16)

Features:

  - print a notification when a newer version of bundler is available (rubygems/bundler#4683, @segiddins)
  - add man pages for all bundler commands (rubygems/bundler#4988, @feministy)
  - add the `bundle info` command (@fredrb, @colby-swandale)
  - all files created with `bundle gem` comply with the bundler style guide (@zachahn)
  - if installing a gem fails, print out the reason the gem needed to be installed (rubygems/bundler#5078, @segiddins)
  - allow setting `gem.push_key` to set the key used when running `rake release` (@DTrierweiler)
  - print gem versions that are regressing during `bundle update` in yellow (rubygems/bundler#5506, @brchristian)
  - avoid printing extraneous dependencies when the resolver encounters a conflict (@segiddins)
  - add the `bundle issue` command that prints instructions for reporting issues (rubygems/bundler#4871, @jonathanpike)
  - add `--source` and `--group` options to the `bundle inject` command (rubygems/bundler#5452, @Shekharrajak)
  - add the `bundle add` command to add a gem to the gemfile (@denniss)
  - add the `bundle pristine` command to re-install gems from cached `.gem` files (rubygems/bundler#4509, @denniss)
  - add a `--parseable` option for `bundle config` (@JuanitoFatas, @colby-swandale)

Performance:

  - speed up gemfile initialization by storing locked dependencies as a hash (@jules2689)
  - speed up gemfile initialization by making locked dependency comparison lazy, avoiding object allocation (@jules2689)
  - only validate git gems when they are downloaded, instead of every time `Bundler.setup` is run (@segiddins)
  - avoid regenerating the lockfile when nothing has changed (@segiddins)
  - avoid diffing large arrays when no sources in the gemfile have changed (@segiddins)
  - avoid evaluating full gemspecs when running with RubyGems 2.5+ (@segiddins)

Bugfixes:

  - fix cases where `bundle update` would print a resolver conflict instead of updating the selected gems (rubygems/bundler#5031, rubygems/bundler#5095, @segiddins)
  - print out a stack trace after an interrupt when running in debug mode (@segiddins)
  - print out when bundler starts fetching a gem from a remote server (@segiddins)
  - fix `bundle gem` failing when `git` is unavailable (rubygems/bundler#5458, @Shekharrajak, @colby-swandale)
  - suggest the appropriate command to unfreeze a bundle (rubygems/bundler#5009, @denniss)
  - ensure nested calls to `bundle exec` resolve default gems correctly (rubygems/bundler#5500, @segiddins)
  - ensure that a plugin failing to install doesn't uninstall other plugins (@kerrizor, @roseaboveit)
  - ensure `socket` is required before being referenced (rubygems/bundler#5533, @rafaelfranca)
  - allow running `bundle outdated` when gems aren't installed locally (rubygems/bundler#5553, @segiddins)
  - print a helpful error when `bundle exec`ing to a gem that isn't included in the bundle (rubygems/bundler#5487, @segiddins)
  - print an error message when a non-git gem is given a `branch` option (rubygems/bundler#5530, @colby-swandale)
  - allow interrupts to exit the process after gems have been installed (@segiddins)
  - print the underlying error when downloading gem metadata fails (rubygems/bundler#5579, @segiddins)
  - avoid deadlocking when installing with a lockfile that is missing dependencies (rubygems/bundler#5378, rubygems/bundler#5480, rubygems/bundler#5519, rubygems/bundler#5526, rubygems/bundler#5529, rubygems/bundler#5549, rubygems/bundler#5572, @segiddins)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants