You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

92 lines
3.4 KiB

From c5197b2ab35ba389f48918e0c773b43b6dca2fa5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@riseup.net>
Date: Fri, 7 Feb 2020 17:16:05 +0100
Subject: [PATCH 1/3] Tweaks to get test passing more reliably
---
test/rubygems/test_require.rb | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/test/rubygems/test_require.rb b/test/rubygems/test_require.rb
index 7cffbfa7fe..67c55416d4 100644
--- a/test/rubygems/test_require.rb
+++ b/test/rubygems/test_require.rb
@@ -567,18 +567,20 @@ def util_install_extension_file(name)
write_file File.join(@tempdir, "extconf.rb") do |io|
io.write <<-RUBY
require "mkmf"
+ CONFIG['LDSHARED'] = '$(TOUCH) $@ ||'
create_makefile("#{name}")
RUBY
end
write_file File.join(@tempdir, "#{name}.c") do |io|
io.write <<-C
- #include <ruby.h>
void Init_#{name}() { }
C
end
- spec.files += ["extconf.rb", "#{name}.c"]
+ write_file File.join(@tempdir, "depend")
+
+ spec.files += ["extconf.rb", "depend", "#{name}.c"]
so = File.join(spec.gem_dir, "#{name}.#{RbConfig::CONFIG["DLEXT"]}")
refute_path_exists so
From 7bfd7319cd751837c3ccaf1d97b02846eaaf39d5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@riseup.net>
Date: Tue, 11 Feb 2020 11:56:06 +0100
Subject: [PATCH 2/3] Fix bug bug calculating $LOAD_PATH's to check in
`require`
In `Gem.load_path_insert_index` is not set, we end up having
`$LOAD_PATH[0...-1]`, unintentionally skipping the last $LOAD_PATH entry
from the check.
The correct thing to do in that case is to not even try since we have no
way of distinguisng default LOAD_PATH entries from those added with -I.
---
lib/rubygems/core_ext/kernel_require.rb | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lib/rubygems/core_ext/kernel_require.rb b/lib/rubygems/core_ext/kernel_require.rb
index 369f2c743e..a8d170f13a 100644
--- a/lib/rubygems/core_ext/kernel_require.rb
+++ b/lib/rubygems/core_ext/kernel_require.rb
@@ -44,7 +44,10 @@ def require(path)
resolved_path = begin
rp = nil
Gem.suffixes.each do |s|
- $LOAD_PATH[0...Gem.load_path_insert_index || -1].each do |lp|
+ load_path_insert_index = Gem.load_path_insert_index
+ break unless load_path_insert_index
+
+ $LOAD_PATH[0...load_path_insert_index].each do |lp|
safe_lp = lp.dup.tap(&Gem::UNTAINT)
begin
if File.symlink? safe_lp # for backward compatibility
From 4fc0ab21c0f7713829abb522ce3b6d8e24c126b3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@riseup.net>
Date: Fri, 14 Feb 2020 02:03:04 +0100
Subject: [PATCH 3/3] Exclude empty suffix from `-I` require loop
---
lib/rubygems/core_ext/kernel_require.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/rubygems/core_ext/kernel_require.rb b/lib/rubygems/core_ext/kernel_require.rb
index a8d170f13a..9712fb6ac0 100644
--- a/lib/rubygems/core_ext/kernel_require.rb
+++ b/lib/rubygems/core_ext/kernel_require.rb
@@ -43,7 +43,7 @@ def require(path)
# https://github.com/rubygems/rubygems/pull/1868
resolved_path = begin
rp = nil
- Gem.suffixes.each do |s|
+ Gem.suffixes[1..-1].each do |s|
load_path_insert_index = Gem.load_path_insert_index
break unless load_path_insert_index