From 02a6c1066c7c369c05340ecd4e597b581cf5dc45 Mon Sep 17 00:00:00 2001 From: Homu Date: Sun, 9 Oct 2016 09:04:22 +0900 Subject: Auto merge of #5064 - bundler:aa-debug-etag-mismatch, r=indirect MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit change checksum warning to debug print This was super helpful when the server was continuously returning bad checksums, but it’s a scary warning to see anytime we update the versions file. And we’re going to need to update the versions file at least twice a year, so it seems like a good idea to head off users worrying about a message that is actually things working as intended. --- lib/bundler/fetcher/compact_index.rb | 27 ++++++++++++---------- .../lib/compact_index_client/updater.rb | 2 +- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/lib/bundler/fetcher/compact_index.rb b/lib/bundler/fetcher/compact_index.rb index fb77451822..ae464b6970 100644 --- a/lib/bundler/fetcher/compact_index.rb +++ b/lib/bundler/fetcher/compact_index.rb @@ -66,7 +66,7 @@ module Bundler # Read info file checksums out of /versions, so we can know if gems are up to date fetch_uri.scheme != "file" && compact_index_client.update_and_parse_checksums! rescue CompactIndexClient::Updater::MisMatchedChecksumError => e - Bundler.ui.warn(e.message) + Bundler.ui.debug(e.message) nil end compact_index_request :available? @@ -78,9 +78,9 @@ module Bundler private def compact_index_client - @compact_index_client ||= + @compact_index_client ||= begin SharedHelpers.filesystem_access(cache_path) do - CompactIndexClient.new(cache_path, compact_fetcher) + CompactIndexClient.new(cache_path, client_fetcher) end.tap do |client| client.in_parallel = lambda do |inputs, &blk| func = lambda {|object, _index| blk.call(object) } @@ -89,6 +89,7 @@ module Bundler inputs.map { worker.deq } end end + end end def bundle_worker(func = nil) @@ -105,15 +106,17 @@ module Bundler Bundler.user_cache.join("compact_index", remote.cache_slug) end - def compact_fetcher - lambda do |path, headers| - begin - downloader.fetch(fetch_uri + path, headers) - rescue NetworkDownError => e - raise unless Bundler.settings[:allow_offline_install] && headers["If-None-Match"] - Bundler.ui.warn "Using the cached data for the new index because of a network error: #{e}" - Net::HTTPNotModified.new(nil, nil, nil) - end + def client_fetcher + ClientFetcher.new(self, Bundler.ui) + end + + ClientFetcher = Struct.new(:fetcher, :ui) do + def call(path, headers) + fetcher.downloader.fetch(fetcher.fetch_uri + path, headers) + rescue NetworkDownError => e + raise unless Bundler.feature_flag.allow_offline_install? && headers["If-None-Match"] + ui.warn "Using the cached data for the new index because of a network error: #{e}" + Net::HTTPNotModified.new(nil, nil, nil) end end end diff --git a/lib/bundler/vendor/compact_index_client/lib/compact_index_client/updater.rb b/lib/bundler/vendor/compact_index_client/lib/compact_index_client/updater.rb index a410dd423c..6c5a4da57a 100644 --- a/lib/bundler/vendor/compact_index_client/lib/compact_index_client/updater.rb +++ b/lib/bundler/vendor/compact_index_client/lib/compact_index_client/updater.rb @@ -29,7 +29,7 @@ class Bundler::CompactIndexClient Dir.mktmpdir(local_path.basename.to_s, local_path.dirname) do |local_temp_dir| local_temp_path = Pathname.new(local_temp_dir).join(local_path.basename) - # download new file if retrying + # first try to fetch any new bytes on the existing file if retrying.nil? && local_path.file? FileUtils.cp local_path, local_temp_path headers["If-None-Match"] = etag_for(local_temp_path) -- cgit v1.2.1 From 9a4345220fa48a2d7cc748276ab8f03247404d05 Mon Sep 17 00:00:00 2001 From: Homu Date: Wed, 5 Oct 2016 07:10:45 +0900 Subject: Auto merge of #5043 - bundler:aa-use-tmp, r=segiddins use /tmp for mktmpdir As we noticed in #4519, we need to use a temporary directory to hold compact index downloads so that multiple processes don't write to the same files at the same time and break everything. The fix for that was #4561, which added temporary directories to hold all files as they download, and then uses the (atomic) `FileUtils.cp` to move the completed downloads into place, so there is never a point where multiple processes are trying to write into the file at once. Unfortunately, using `Dir.mktmpdir` requires that the parent directory be _either_ world writable or sticky, but not both. Based on #4599, it looks like it's common for home directories to be both world writable and sticky. While that's a security problem by itself, it's not a big concern for Bundler and the compact index. So we want to let users continue to use Bundler, even with the compact index, without having to change the permissions on their home directories. This commit changes the `mktmpdir` call to create the temporary directory inside the default OS tempdir, which is typically `/tmp` or `/var/tmp` depending on distro. Since that directory is designed to hold other temporary directories, that change should (theoretically) reduce or eliminate the problem reported in #4599. --- .../compact_index_client/lib/compact_index_client/updater.rb | 2 +- spec/install/gems/compact_index_spec.rb | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/bundler/vendor/compact_index_client/lib/compact_index_client/updater.rb b/lib/bundler/vendor/compact_index_client/lib/compact_index_client/updater.rb index 6c5a4da57a..40c61644e3 100644 --- a/lib/bundler/vendor/compact_index_client/lib/compact_index_client/updater.rb +++ b/lib/bundler/vendor/compact_index_client/lib/compact_index_client/updater.rb @@ -26,7 +26,7 @@ class Bundler::CompactIndexClient def update(local_path, remote_path, retrying = nil) headers = {} - Dir.mktmpdir(local_path.basename.to_s, local_path.dirname) do |local_temp_dir| + Dir.mktmpdir("bundler-compact-index-") do |local_temp_dir| local_temp_path = Pathname.new(local_temp_dir).join(local_path.basename) # first try to fetch any new bytes on the existing file diff --git a/spec/install/gems/compact_index_spec.rb b/spec/install/gems/compact_index_spec.rb index 0edd1d20e7..b34d9e872d 100644 --- a/spec/install/gems/compact_index_spec.rb +++ b/spec/install/gems/compact_index_spec.rb @@ -695,4 +695,12 @@ The checksum of /versions does not match the checksum provided by the server! So expect(File.read(versions)).to start_with("created_at") expect(the_bundle).to include_gems "rack 1.0.0" end + + it "works when cache dir is world-writable" do + install_gemfile! <<-G, :artifice => "compact_index" + File.umask(0000) + source "#{source_uri}" + gem "rack" + G + end end -- cgit v1.2.1 From 3fc5032860acc5f31c6c65788db4720f49ee1ba7 Mon Sep 17 00:00:00 2001 From: Homu Date: Mon, 3 Oct 2016 16:19:16 +0900 Subject: Auto merge of #5010 - aycabta:use-require-instead-of-autoload-for-plugin-api, r=indirect [workaround] Use `require` instead of `autoload` for bundler/plugin/api Please read https://github.com/bundler/bundler/pull/4981#issuecomment-248674155. > But it's elusive reproduction (and lack of test case) makes me think that the problem is a bit deeper and may recur. I think so. This Pull Request is just *workaround*. --- lib/bundler/plugin.rb | 2 +- lib/bundler/plugin/api.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/bundler/plugin.rb b/lib/bundler/plugin.rb index 1f0297f29b..06f0317786 100644 --- a/lib/bundler/plugin.rb +++ b/lib/bundler/plugin.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true +require "bundler/plugin/api" module Bundler module Plugin - autoload :API, "bundler/plugin/api" autoload :DSL, "bundler/plugin/dsl" autoload :Index, "bundler/plugin/index" autoload :Installer, "bundler/plugin/installer" diff --git a/lib/bundler/plugin/api.rb b/lib/bundler/plugin/api.rb index 5bd8792e55..bd7cef5382 100644 --- a/lib/bundler/plugin/api.rb +++ b/lib/bundler/plugin/api.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true +require "bundler/plugin/api/source" module Bundler # This is the interfacing class represents the API that we intend to provide @@ -23,7 +24,6 @@ module Bundler # and hooks). module Plugin class API - autoload :Source, "bundler/plugin/api/source" # The plugins should declare that they handle a command through this helper. # # @param [String] command being handled by them -- cgit v1.2.1 From 8019bce7820904689b1812adf9d7aa60bb0929db Mon Sep 17 00:00:00 2001 From: Homu Date: Wed, 14 Sep 2016 03:02:00 +0900 Subject: Auto merge of #4977 - chrismo:cons_lock_shared_deps, r=segiddins Fix #4934. Make GVP _after_ eager unlock. When Definition creates the GemVersionPromoter, it needs to do so _after_ it's performed the eager_unlock so the GVP gets the correct list of unlocked gems. Prior to this fix, it had a stricter list of gems being updated with the new `--patch` or `--minor` options used with `bundle update` and in some cases would have inconsistent results when used without a conservative switch or the `--major` option. See #4934 for details. --- lib/bundler/definition.rb | 4 +-- spec/bundler/definition_spec.rb | 69 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 70 insertions(+), 3 deletions(-) diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb index 05d4c4cddb..f14085f60a 100644 --- a/lib/bundler/definition.rb +++ b/lib/bundler/definition.rb @@ -103,8 +103,6 @@ module Bundler end @unlocking ||= @unlock[:ruby] ||= (!@locked_ruby_version ^ !@ruby_version) - @gem_version_promoter = create_gem_version_promoter - current_platform = Bundler.rubygems.platforms.map {|p| generic(p) }.compact.last add_platform(current_platform) @@ -112,6 +110,8 @@ module Bundler eager_unlock = expand_dependencies(@unlock[:gems]) @unlock[:gems] = @locked_specs.for(eager_unlock).map(&:name) + @gem_version_promoter = create_gem_version_promoter + @source_changes = converge_sources @dependency_changes = converge_dependencies @local_changes = converge_locals diff --git a/spec/bundler/definition_spec.rb b/spec/bundler/definition_spec.rb index c72f50f0d1..71e5bb00aa 100644 --- a/spec/bundler/definition_spec.rb +++ b/spec/bundler/definition_spec.rb @@ -137,7 +137,7 @@ describe Bundler::Definition do describe "initialize" do context "gem version promoter" do context "with lockfile" do - before :each do + before do install_gemfile <<-G source "file://#{gem_repo1}" gem "foo" @@ -159,6 +159,73 @@ describe Bundler::Definition do end end + context "shared dependent gems" do + before do + build_repo4 do + build_gem "isolated_owner", %w(1.0.1 1.0.2) do |s| + s.add_dependency "isolated_dep", "~> 2.0" + end + build_gem "isolated_dep", %w(2.0.1 2.0.2) + + build_gem "shared_owner_a", %w(3.0.1 3.0.2) do |s| + s.add_dependency "shared_dep", "~> 5.0" + end + build_gem "shared_owner_b", %w(4.0.1 4.0.2) do |s| + s.add_dependency "shared_dep", "~> 5.0" + end + build_gem "shared_dep", %w(5.0.1 5.0.2) + end + + gemfile <<-G + source "file://#{gem_repo4}" + gem 'isolated_owner' + + gem 'shared_owner_a' + gem 'shared_owner_b' + G + + lockfile <<-L + GEM + remote: file://#{gem_repo4} + specs: + isolated_dep (2.0.1) + isolated_owner (1.0.1) + isolated_dep (~> 2.0) + shared_dep (5.0.1) + shared_owner_a (3.0.1) + shared_dep (~> 5.0) + shared_owner_b (4.0.1) + shared_dep (~> 5.0) + + PLATFORMS + ruby + + DEPENDENCIES + shared_owner_a + shared_owner_b + isolated_owner + + BUNDLED WITH + 1.13.0 + L + end + + it "should unlock isolated and shared dependencies equally" do + # setup for these test costs about 3/4 of a second, much faster to just jam them all in here. + # the global before :each defeats any ability to have re-usable setup for many examples in a + # single context by wiping out the tmp dir and contents. + + unlock_deps_test(%w(isolated_owner), %w(isolated_dep isolated_owner)) + unlock_deps_test(%w(isolated_owner shared_owner_a), %w(isolated_dep isolated_owner shared_dep shared_owner_a)) + end + + def unlock_deps_test(passed_unlocked, expected_calculated) + definition = Bundler::Definition.new(bundled_app("Gemfile.lock"), [], Bundler::SourceList.new, :gems => passed_unlocked) + unlock_gems = definition.gem_version_promoter.unlock_gems + expect(unlock_gems.sort).to eq expected_calculated + end + end + def mock_source_list Class.new do def all_sources -- cgit v1.2.1 From 3aaa3e36990ca223e0de2e55f7d0da905e407521 Mon Sep 17 00:00:00 2001 From: Andre Arko Date: Tue, 11 Oct 2016 01:01:07 -0700 Subject: Version 1.13.4 with changelog --- CHANGELOG.md | 9 +++++++++ lib/bundler/version.rb | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e3c138be22..7afabe0967 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +## 1.13.4 (2016-10-11) + +Bugfixes: + + - stop printing warning when compact index versions file is rewritten (#5064, @indirect) + - fix `parent directory is world writable but not sticky` error on install (#5043, @indirect) + - fix for `uninitialized constant Bundler::Plugin::API::Source` error (#5010, @hsbt, @aycabta) + - make `update` options for major, minor, and patch updates consistent (#5043, @chrismo) + ## 1.13.3 (2016-10-10) Bugfixes: diff --git a/lib/bundler/version.rb b/lib/bundler/version.rb index 159148372e..823045b3f8 100644 --- a/lib/bundler/version.rb +++ b/lib/bundler/version.rb @@ -7,5 +7,5 @@ module Bundler # We're doing this because we might write tests that deal # with other versions of bundler and we are unsure how to # handle this better. - VERSION = "1.13.3" unless defined?(::Bundler::VERSION) + VERSION = "1.13.4" unless defined?(::Bundler::VERSION) end -- cgit v1.2.1 From 013b4a7b19a9114fb6154e33a363094ec40128cd Mon Sep 17 00:00:00 2001 From: Homu Date: Wed, 12 Oct 2016 16:06:10 +0900 Subject: Auto merge of #5077 - bundler:aa-revert-4998, r=indirect Revert "::Rake::CommandFailedError doesn't exist." This reverts commit c5a889ce865cc0314597e9de11e2bee366e797ac. --- lib/bundler/deployment.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bundler/deployment.rb b/lib/bundler/deployment.rb index a62fa232fb..94f2fac620 100644 --- a/lib/bundler/deployment.rb +++ b/lib/bundler/deployment.rb @@ -15,7 +15,7 @@ module Bundler else context_name = "vlad" role_default = "[:app]" - error_type = ::Vlad::CommandFailedError + error_type = ::Rake::CommandFailedError end roles = context.fetch(:bundle_roles, false) -- cgit v1.2.1 From 85bccc602d3e460f9f9e9e3f52f1ca935b03c67f Mon Sep 17 00:00:00 2001 From: Andre Arko Date: Wed, 12 Oct 2016 00:18:10 -0700 Subject: oops, backported something that doesn't exist --- lib/bundler/fetcher/compact_index.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bundler/fetcher/compact_index.rb b/lib/bundler/fetcher/compact_index.rb index ae464b6970..34391bc260 100644 --- a/lib/bundler/fetcher/compact_index.rb +++ b/lib/bundler/fetcher/compact_index.rb @@ -114,7 +114,7 @@ module Bundler def call(path, headers) fetcher.downloader.fetch(fetcher.fetch_uri + path, headers) rescue NetworkDownError => e - raise unless Bundler.feature_flag.allow_offline_install? && headers["If-None-Match"] + raise unless Bundler.settings[:allow_offline_install] && headers["If-None-Match"] ui.warn "Using the cached data for the new index because of a network error: #{e}" Net::HTTPNotModified.new(nil, nil, nil) end -- cgit v1.2.1 From 3a82c5fbf05230e2274b6cefe9f833e7275690e8 Mon Sep 17 00:00:00 2001 From: Andre Arko Date: Wed, 12 Oct 2016 11:59:03 -0700 Subject: use realworld versions in realworld tests --- spec/realworld/edgecases_spec.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/spec/realworld/edgecases_spec.rb b/spec/realworld/edgecases_spec.rb index 06e588044c..6d01675e1f 100644 --- a/spec/realworld/edgecases_spec.rb +++ b/spec/realworld/edgecases_spec.rb @@ -2,6 +2,14 @@ require "spec_helper" describe "real world edgecases", :realworld => true, :sometimes => true do + def rubygems_version(name, requirement) + source = Bundler::Source::Rubygems::Remote.new(URI('https://rubygems.org')) + fetcher = Bundler::Fetcher.new(source) + index = fetcher.specs([name], nil) + rubygem = index.search(Gem::Dependency.new(name, requirement)).last + "#{name} (#{rubygem.version})" + end + # there is no rbx-relative-require gem that will install on 1.9 it "ignores extra gems with bad platforms", :ruby => "~> 1.8.7" do gemfile <<-G @@ -84,8 +92,8 @@ describe "real world edgecases", :realworld => true, :sometimes => true do gem "builder", "~> 2.1.2" G bundle :lock - expect(lockfile).to include("i18n (0.6.11)") - expect(lockfile).to include("activesupport (3.0.5)") + expect(lockfile).to include(rubygems_version("i18n", "~> 0.6.0")) + expect(lockfile).to include(rubygems_version("activesupport", "~> 3.0")) end # https://github.com/bundler/bundler/issues/1500 -- cgit v1.2.1 From 064393118c2cf25711f35f3bf530b236d60d6f41 Mon Sep 17 00:00:00 2001 From: Andre Arko Date: Wed, 12 Oct 2016 11:59:09 -0700 Subject: initialize ivar before use --- lib/bundler/vendor/compact_index_client/lib/compact_index_client.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/bundler/vendor/compact_index_client/lib/compact_index_client.rb b/lib/bundler/vendor/compact_index_client/lib/compact_index_client.rb index 9ab2722f18..26e555236b 100644 --- a/lib/bundler/vendor/compact_index_client/lib/compact_index_client.rb +++ b/lib/bundler/vendor/compact_index_client/lib/compact_index_client.rb @@ -22,6 +22,7 @@ class Bundler::CompactIndexClient @cache = Cache.new(@directory) @endpoints = Set.new @info_checksums_by_name = {} + @parsed_checksums = nil @in_parallel = lambda do |inputs, &blk| inputs.map(&blk) end -- cgit v1.2.1 From 90c2960024cefdce469fd89a81ac8f15f3cef499 Mon Sep 17 00:00:00 2001 From: Andre Arko Date: Wed, 12 Oct 2016 16:11:00 -0700 Subject: :cop: --- spec/realworld/edgecases_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/realworld/edgecases_spec.rb b/spec/realworld/edgecases_spec.rb index 6d01675e1f..cb698ee569 100644 --- a/spec/realworld/edgecases_spec.rb +++ b/spec/realworld/edgecases_spec.rb @@ -3,7 +3,7 @@ require "spec_helper" describe "real world edgecases", :realworld => true, :sometimes => true do def rubygems_version(name, requirement) - source = Bundler::Source::Rubygems::Remote.new(URI('https://rubygems.org')) + source = Bundler::Source::Rubygems::Remote.new(URI("https://rubygems.org")) fetcher = Bundler::Fetcher.new(source) index = fetcher.specs([name], nil) rubygem = index.search(Gem::Dependency.new(name, requirement)).last -- cgit v1.2.1 From cd536e0f7551f9503af8f37be1b5cb304b9729be Mon Sep 17 00:00:00 2001 From: Andre Arko Date: Wed, 12 Oct 2016 16:13:20 -0700 Subject: setup that matches the expectations --- spec/realworld/edgecases_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/realworld/edgecases_spec.rb b/spec/realworld/edgecases_spec.rb index cb698ee569..0fcacdebc8 100644 --- a/spec/realworld/edgecases_spec.rb +++ b/spec/realworld/edgecases_spec.rb @@ -40,8 +40,8 @@ describe "real world edgecases", :realworld => true, :sometimes => true do source "https://rubygems.org" gem 'i18n', '~> 0.6.0' - gem 'activesupport', '~> 3.0' - gem 'activerecord', '~> 3.0' + gem 'activesupport', '~> 3.0.5' + gem 'activerecord', '~> 3.0.5' gem 'builder', '~> 2.1.2' G bundle :lock -- cgit v1.2.1 From f8a6a45ea7885b140eaf8507b197cab9fb19b5d7 Mon Sep 17 00:00:00 2001 From: Andre Arko Date: Wed, 12 Oct 2016 17:08:12 -0700 Subject: fix a bad find and replace --- spec/realworld/edgecases_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/realworld/edgecases_spec.rb b/spec/realworld/edgecases_spec.rb index 0fcacdebc8..8ef49d4391 100644 --- a/spec/realworld/edgecases_spec.rb +++ b/spec/realworld/edgecases_spec.rb @@ -23,7 +23,7 @@ describe "real world edgecases", :realworld => true, :sometimes => true do # https://github.com/bundler/bundler/issues/1202 it "bundle cache works with rubygems 1.3.7 and pre gems", - :ruby => "~> 1.8.7", "https://rubygems.org" => "~> 1.3.7" do + :ruby => "~> 1.8.7", :rubygems => "~> 1.3.7" do install_gemfile <<-G source "https://rubygems.org" gem "rack", "1.3.0.beta2" -- cgit v1.2.1 From 089cdbcab3fccf33ec81cea40e5f3d37b0f41509 Mon Sep 17 00:00:00 2001 From: Andre Arko Date: Wed, 12 Oct 2016 17:08:32 -0700 Subject: use the method now that we have it --- spec/realworld/edgecases_spec.rb | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/spec/realworld/edgecases_spec.rb b/spec/realworld/edgecases_spec.rb index 8ef49d4391..a1d44daa47 100644 --- a/spec/realworld/edgecases_spec.rb +++ b/spec/realworld/edgecases_spec.rb @@ -57,15 +57,7 @@ describe "real world edgecases", :realworld => true, :sometimes => true do gem 'rack-cache', '1.2.0' # last version that works on Ruby 1.9 G bundle! :lock - rails_version = ruby(<<-R) - require 'rubygems' - require 'bundler' - fetcher = Bundler::Fetcher.new(Bundler::Source::Rubygems::Remote.new(URI('https://rubygems.org'))) - index = fetcher.specs(%w(rails), nil) - rails = index.search(Gem::Dependency.new("rails", "~> 3.0")).last - puts rails.version - R - expect(lockfile).to include("rails (#{rails_version})") + expect(lockfile).to include(rubygems_version("rails", "~> 3.0")) expect(lockfile).to include("capybara (2.2.1)") end -- cgit v1.2.1 From 2d038e4a315edc0427bd9dbea0c28e64b6632463 Mon Sep 17 00:00:00 2001 From: Andre Arko Date: Wed, 12 Oct 2016 17:29:25 -0700 Subject: debug info for error on travis --- spec/realworld/edgecases_spec.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spec/realworld/edgecases_spec.rb b/spec/realworld/edgecases_spec.rb index a1d44daa47..81fe3d77b0 100644 --- a/spec/realworld/edgecases_spec.rb +++ b/spec/realworld/edgecases_spec.rb @@ -3,10 +3,16 @@ require "spec_helper" describe "real world edgecases", :realworld => true, :sometimes => true do def rubygems_version(name, requirement) + require "bundler/source/rubygems/remote" + require "bundler/fetcher" source = Bundler::Source::Rubygems::Remote.new(URI("https://rubygems.org")) fetcher = Bundler::Fetcher.new(source) index = fetcher.specs([name], nil) rubygem = index.search(Gem::Dependency.new(name, requirement)).last + if rubygem.nil? + raise "Could not find #{name} (#{requirement}) on rubygems.org!\n" \ + "Found specs:\n#{index.send(:specs).inspect}" + end "#{name} (#{rubygem.version})" end -- cgit v1.2.1 From 54ab8af9c613e0d644a37255ee523c2ba333100a Mon Sep 17 00:00:00 2001 From: Andre Arko Date: Wed, 12 Oct 2016 21:27:20 -0700 Subject: correct PR number, ht @chrismo --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7afabe0967..d3f6ae5e23 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ Bugfixes: - stop printing warning when compact index versions file is rewritten (#5064, @indirect) - fix `parent directory is world writable but not sticky` error on install (#5043, @indirect) - fix for `uninitialized constant Bundler::Plugin::API::Source` error (#5010, @hsbt, @aycabta) - - make `update` options for major, minor, and patch updates consistent (#5043, @chrismo) + - make `update` options for major, minor, and patch updates consistent (#4934, @chrismo) ## 1.13.3 (2016-10-10) -- cgit v1.2.1 From 2b63fe92fe36f4726505b719f6c5fdb9e767b0ae Mon Sep 17 00:00:00 2001 From: Andre Arko Date: Thu, 13 Oct 2016 15:38:38 -0700 Subject: holy crap, what a subtle bug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit THANK YOU RSPEC BISECT also THANK YOU @SAMPHIPPEN So it turns out that the realworld specs make real life network requests to the real life rubygems.org. But we have some other “realworld” tests that spin up a webrick server to recreate specific pathological server behaviors. And those webrick servers might be able to answer requests from later realworld tests that are expecting the actual rubygems.org, but instead are getting our fake gem server because Artifice was never stopped. :O --- spec/realworld/dependency_api_spec.rb | 1 + spec/realworld/gemfile_source_header_spec.rb | 1 + spec/realworld/mirror_probe_spec.rb | 1 + 3 files changed, 3 insertions(+) diff --git a/spec/realworld/dependency_api_spec.rb b/spec/realworld/dependency_api_spec.rb index 9823cf8c76..ea02adfe4b 100644 --- a/spec/realworld/dependency_api_spec.rb +++ b/spec/realworld/dependency_api_spec.rb @@ -26,6 +26,7 @@ describe "gemcutter's dependency API", :realworld => true do end after do + Artifice.deactivate @t.kill @t.join end diff --git a/spec/realworld/gemfile_source_header_spec.rb b/spec/realworld/gemfile_source_header_spec.rb index 1c39fe97bb..95935f76f7 100644 --- a/spec/realworld/gemfile_source_header_spec.rb +++ b/spec/realworld/gemfile_source_header_spec.rb @@ -12,6 +12,7 @@ describe "fetching dependencies with a mirrored source", :realworld => true, :ru end after do + Artifice.deactivate @t.kill @t.join end diff --git a/spec/realworld/mirror_probe_spec.rb b/spec/realworld/mirror_probe_spec.rb index bb2be7f232..0fb93b8ab1 100644 --- a/spec/realworld/mirror_probe_spec.rb +++ b/spec/realworld/mirror_probe_spec.rb @@ -15,6 +15,7 @@ describe "fetching dependencies with a not available mirror", :realworld => true end after do + Artifice.deactivate @server_thread.kill @server_thread.join end -- cgit v1.2.1 From b74caccd9d6c76d2fd99ed8c49a94820570edf9b Mon Sep 17 00:00:00 2001 From: Andre Arko Date: Thu, 13 Oct 2016 17:13:25 -0700 Subject: ruby 1.8 can't even give exit statuses how did this ever pass even once :astonished: --- spec/runtime/with_clean_env_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/runtime/with_clean_env_spec.rb b/spec/runtime/with_clean_env_spec.rb index 752754be39..294233a581 100644 --- a/spec/runtime/with_clean_env_spec.rb +++ b/spec/runtime/with_clean_env_spec.rb @@ -116,14 +116,14 @@ describe "Bundler.with_env helpers" do end end - describe "Bundler.clean_system" do + describe "Bundler.clean_system", :ruby => ">= 1.9" do it "runs system inside with_clean_env" do Bundler.clean_system(%(echo 'if [ "$BUNDLE_PATH" = "" ]; then exit 42; else exit 1; fi' | /bin/sh)) expect($?.exitstatus).to eq(42) end end - describe "Bundler.clean_exec" do + describe "Bundler.clean_exec", :ruby => ">= 1.9" do it "runs exec inside with_clean_env" do pid = Kernel.fork do Bundler.clean_exec(%(echo 'if [ "$BUNDLE_PATH" = "" ]; then exit 42; else exit 1; fi' | /bin/sh)) -- cgit v1.2.1 From a7834e47e420b4fb1c41a5a8e7adec1a2fa03481 Mon Sep 17 00:00:00 2001 From: Andre Arko Date: Thu, 13 Oct 2016 19:29:44 -0700 Subject: initialize ivar correctly /ht @segiddins --- lib/bundler/vendor/compact_index_client/lib/compact_index_client.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bundler/vendor/compact_index_client/lib/compact_index_client.rb b/lib/bundler/vendor/compact_index_client/lib/compact_index_client.rb index 26e555236b..257e4c109e 100644 --- a/lib/bundler/vendor/compact_index_client/lib/compact_index_client.rb +++ b/lib/bundler/vendor/compact_index_client/lib/compact_index_client.rb @@ -22,7 +22,7 @@ class Bundler::CompactIndexClient @cache = Cache.new(@directory) @endpoints = Set.new @info_checksums_by_name = {} - @parsed_checksums = nil + @parsed_checksums = false @in_parallel = lambda do |inputs, &blk| inputs.map(&blk) end -- cgit v1.2.1