From 23eb13d49daccd06e56d82884ac4bfd433f1b7be Mon Sep 17 00:00:00 2001 From: Imir Kiyamov Date: Sun, 27 Aug 2023 21:45:57 +0400 Subject: [PATCH] [rubygems/rubygems] Fixed malformed lockfile version on installing https://github.com/rubygems/rubygems/commit/c969a192bf --- lib/bundler/self_manager.rb | 2 ++ spec/bundler/runtime/self_management_spec.rb | 7 +++++++ 2 files changed, 9 insertions(+) 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)