summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorImir Kiyamov <imir@MacBook-Pro-Imir-2.local>2023-08-27 21:45:57 +0400
committergit <svn-admin@ruby-lang.org>2023-08-28 07:41:51 +0000
commit23eb13d49daccd06e56d82884ac4bfd433f1b7be (patch)
tree07301ca739743b4888c08d8dd1470d47890ab67b
parentb0ec1db8a72c530460abd9462ac75845362886bd (diff)
[rubygems/rubygems] Fixed malformed lockfile version on installing
https://github.com/rubygems/rubygems/commit/c969a192bf
-rw-r--r--lib/bundler/self_manager.rb2
-rw-r--r--spec/bundler/runtime/self_management_spec.rb7
2 files changed, 9 insertions, 0 deletions
diff --git a/lib/bundler/self_manager.rb b/lib/bundler/self_manager.rb
index 5d7546e926..1925a266d9 100644
--- a/lib/bundler/self_manager.rb
+++ b/lib/bundler/self_manager.rb
@@ -170,6 +170,8 @@ module Bundler
parsed_version = Bundler::LockfileParser.bundled_with
@lockfile_version = parsed_version ? Gem::Version.new(parsed_version) : nil
+ rescue ArgumentError
+ @lockfile_version = nil
end
def restart_version
diff --git a/spec/bundler/runtime/self_management_spec.rb b/spec/bundler/runtime/self_management_spec.rb
index 976437c332..3e49db4f32 100644
--- a/spec/bundler/runtime/self_management_spec.rb
+++ b/spec/bundler/runtime/self_management_spec.rb
@@ -129,6 +129,13 @@ RSpec.describe "Self management", :rubygems => ">= 3.3.0.dev", :realworld => tru
expect(out).to eq(Bundler::VERSION[0] == "2" ? "Bundler version #{Bundler::VERSION}" : Bundler::VERSION)
end
+ it "ignores malformed lockfile version" do
+ lockfile_bundled_with("2.3.")
+
+ bundle "install --verbose"
+ expect(out).to include("Using bundler #{Bundler::VERSION}")
+ end
+
private
def lockfile_bundled_with(version)