ruby-changes:66809
From: Andre <ko1@a...>
Date: Fri, 16 Jul 2021 15:40:23 +0900 (JST)
Subject: [ruby-changes:66809] a3d2200b2a (master): [rubygems/rubygems] test loading bad plugins with nil/empty names
https://git.ruby-lang.org/ruby.git/commit/?id=a3d2200b2a From a3d2200b2ab29d4b8a127993254c34e90a5f341f Mon Sep 17 00:00:00 2001 From: Andre Arko <andre@a...> Date: Tue, 13 Jul 2021 02:25:09 -0700 Subject: [rubygems/rubygems] test loading bad plugins with nil/empty names https://github.com/rubygems/rubygems/commit/e64b1f3497 --- lib/bundler/plugin.rb | 2 ++ spec/bundler/bundler/plugin_spec.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/bundler/plugin.rb b/lib/bundler/plugin.rb index 023c25b..bfe4fd7 100644 --- a/lib/bundler/plugin.rb +++ b/lib/bundler/plugin.rb @@ -309,6 +309,8 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/plugin.rb#L309 # # @param [String] name of the plugin def load_plugin(name) + return unless name && !name.empty? + # Need to ensure before this that plugin root where the rest of gems # are installed to be on load path to support plugin deps. Currently not # done to avoid conflicts diff --git a/spec/bundler/bundler/plugin_spec.rb b/spec/bundler/bundler/plugin_spec.rb index cc28382..d1a05bb 100644 --- a/spec/bundler/bundler/plugin_spec.rb +++ b/spec/bundler/bundler/plugin_spec.rb @@ -277,7 +277,7 @@ RSpec.describe Bundler::Plugin do https://github.com/ruby/ruby/blob/trunk/spec/bundler/bundler/plugin_spec.rb#L277 Bundler::Plugin::Events.send(:define, :EVENT_2, "event-2") allow(index).to receive(:hook_plugins).with(Bundler::Plugin::Events::EVENT_1). - and_return(["foo-plugin"]) + and_return(["foo-plugin", "", nil]) allow(index).to receive(:hook_plugins).with(Bundler::Plugin::Events::EVENT_2). and_return(["foo-plugin"]) allow(index).to receive(:plugin_path).with("foo-plugin").and_return(path) -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/