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