Skip to content

Commit 9309f14

Browse files
committed
Merge remote-tracking branch 'upstream/master' into mb-only-some-locals
2 parents 4129769 + c272297 commit 9309f14

File tree

15 files changed

+5351
-4775
lines changed

15 files changed

+5351
-4775
lines changed

.github/dependabot.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ updates:
1515
directories:
1616
- '/yjit'
1717
- '/zjit'
18+
exclude-paths:
19+
- 'gc/mmtk/**'
1820
schedule:
1921
interval: 'daily'
2022
groups:

NEWS.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ releases.
6666
* resolv-replace 0.2.0
6767
* syslog 0.4.0
6868
* repl_type_completor 0.1.13
69-
* rdoc 7.1.0
69+
* rdoc 7.2.0
70+
* irb 1.17.0
7071

7172
### RubyGems and Bundler
7273

gems/bundled_gems

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ ostruct 0.6.3 https://github.com/ruby/ostruct
3939
pstore 0.2.0 https://github.com/ruby/pstore
4040
benchmark 0.5.0 https://github.com/ruby/benchmark
4141
logger 1.7.0 https://github.com/ruby/logger
42-
rdoc 7.1.0 https://github.com/ruby/rdoc
42+
rdoc 7.2.0 https://github.com/ruby/rdoc
4343
win32ole 1.9.2 https://github.com/ruby/win32ole
44-
irb 1.16.0 https://github.com/ruby/irb
44+
irb 1.17.0 https://github.com/ruby/irb
4545
reline 0.6.3 https://github.com/ruby/reline
4646
readline 0.0.4 https://github.com/ruby/readline
4747
fiddle 1.1.8 https://github.com/ruby/fiddle

ruby.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2301,6 +2301,16 @@ process_options_global_setup(const ruby_cmdline_options_t *opt, const rb_iseq_t
23012301
rb_exec_event_hook_script_compiled(ec, iseq, script);
23022302
}
23032303

2304+
static bool
2305+
has_dir_sep(const char *path)
2306+
{
2307+
if (strchr(path, '/')) return true;
2308+
#ifdef _WIN32
2309+
if (strchr(path, '\\')) return true;
2310+
#endif
2311+
return false;
2312+
}
2313+
23042314
static VALUE
23052315
process_options(int argc, char **argv, ruby_cmdline_options_t *opt)
23062316
{
@@ -2406,7 +2416,7 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt)
24062416
if (!opt->script || opt->script[0] == '\0') {
24072417
opt->script = "-";
24082418
}
2409-
else if (opt->do_search) {
2419+
else if (opt->do_search && !has_dir_sep(opt->script)) {
24102420
const char *path = getenv("RUBYPATH");
24112421

24122422
opt->script = 0;

spec/ruby/command_line/dash_upper_s_spec.rb

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,66 @@
22

33
describe 'The -S command line option' do
44
before :each do
5-
@path = [ENV['PATH'], fixture(__FILE__, "bin")].join(':')
5+
@bin = fixture(__FILE__, "bin")
6+
@path = [ENV['PATH'], @bin].join(File::PATH_SEPARATOR)
67
end
78

89
platform_is_not :windows do
910
# On VirtualBox shared directory (vboxsf) all files are world writable
1011
# and MRI shows warning when including world writable path in ENV['PATH'].
1112
# This is why we are using /success$/ matching in the following cases.
1213

14+
it "runs launcher found in RUBYPATH, but only code after the first /\#!.*ruby.*/-ish line in target file" do
15+
result = ruby_exe(nil, options: '-S hybrid_launcher.sh', env: { 'RUBYPATH' => @bin }, args: '2>&1')
16+
result.should =~ /success$/
17+
end
18+
1319
it "runs launcher found in PATH, but only code after the first /\#!.*ruby.*/-ish line in target file" do
1420
result = ruby_exe(nil, options: '-S hybrid_launcher.sh', env: { 'PATH' => @path }, args: '2>&1')
1521
result.should =~ /success$/
1622
end
1723

24+
it "runs launcher found in RUBYPATH" do
25+
result = ruby_exe(nil, options: '-S launcher.rb', env: { 'RUBYPATH' => @bin }, args: '2>&1')
26+
result.should =~ /success$/
27+
end
28+
1829
it "runs launcher found in PATH" do
1930
result = ruby_exe(nil, options: '-S launcher.rb', env: { 'PATH' => @path }, args: '2>&1')
2031
result.should =~ /success$/
2132
end
2233

34+
it "runs launcher found in RUBYPATH and sets the exit status to 1 if it fails" do
35+
result = ruby_exe(nil, options: '-S dash_s_fail', env: { 'RUBYPATH' => @bin }, args: '2>&1', exit_status: 1)
36+
result.should =~ /\bdie\b/
37+
$?.exitstatus.should == 1
38+
end
39+
2340
it "runs launcher found in PATH and sets the exit status to 1 if it fails" do
2441
result = ruby_exe(nil, options: '-S dash_s_fail', env: { 'PATH' => @path }, args: '2>&1', exit_status: 1)
2542
result.should =~ /\bdie\b/
2643
$?.exitstatus.should == 1
2744
end
45+
46+
ruby_version_is "4.1" do
47+
describe "if the script name contains separator" do
48+
before(:each) do
49+
@bin = File.dirname(@bin)
50+
@path = [ENV['PATH'], @bin].join(File::PATH_SEPARATOR)
51+
end
52+
53+
it "does not search launcher in RUBYPATH" do
54+
result = ruby_exe(nil, options: '-S bin/launcher.rb', env: { 'RUBYPATH' => @bin }, args: '2>&1', exit_status: 1)
55+
result.should =~ /LoadError/
56+
$?.should_not.success?
57+
end
58+
59+
it "does not search launcher in PATH" do
60+
result = ruby_exe(nil, options: '-S bin/launcher.rb', env: { 'PATH' => @path }, args: '2>&1', exit_status: 1)
61+
result.should =~ /LoadError/
62+
$?.should_not.success?
63+
end
64+
end
65+
end
2866
end
2967
end

spec/ruby/core/unboundmethod/equal_value_spec.rb

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@
3535

3636
@method_one = UnboundMethodSpecs::Methods.instance_method(:one)
3737
@method_two = UnboundMethodSpecs::Methods.instance_method(:two)
38+
39+
@mixin = UnboundMethodSpecs::Mixin.instance_method(:mixin_method)
40+
@includer_base = UnboundMethodSpecs::IncluderBase.new.method(:mixin_method).unbind
41+
@includer_child = UnboundMethodSpecs::IncluderChild.new.method(:mixin_method).unbind
42+
@extender_base = UnboundMethodSpecs::ExtenderBase.method(:mixin_method).unbind
43+
@extender_child = UnboundMethodSpecs::ExtenderChild.method(:mixin_method).unbind
3844
end
3945

4046
it "returns true if objects refer to the same method" do
@@ -91,6 +97,30 @@
9197
(@includer == @includee).should == true
9298
end
9399

100+
ruby_bug "#21873", ""..."4.1" do
101+
it "returns true if same method is present in an object through module inclusion" do
102+
(@mixin == @includer_base).should == true
103+
(@includer_base == @mixin).should == true
104+
105+
(@mixin == @includer_child).should == true
106+
(@includer_child == @mixin).should == true
107+
108+
(@includer_base == @includer_child).should == true
109+
(@includer_child == @includer_base).should == true
110+
end
111+
112+
it "returns true if same method is present in an object through module extension" do
113+
(@mixin == @extender_base).should == true
114+
(@extender_base == @mixin).should == true
115+
116+
(@mixin == @extender_child).should == true
117+
(@extender_child == @mixin).should == true
118+
119+
(@extender_base == @extender_child).should == true
120+
(@extender_child == @extender_base).should == true
121+
end
122+
end
123+
94124
it "returns false if both have same Module, same name, identical body but not the same" do
95125
class UnboundMethodSpecs::Methods
96126
def discard_1; :discard; end

spec/ruby/core/unboundmethod/fixtures/classes.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,22 @@ class << self
8080
end
8181
end
8282

83+
module Mixin
84+
def mixin_method; end
85+
end
86+
87+
class IncluderBase
88+
include Mixin
89+
end
90+
91+
class IncluderChild < IncluderBase; end
92+
93+
class ExtenderBase
94+
extend Mixin
95+
end
96+
97+
class ExtenderChild < ExtenderBase; end
98+
8399
class A
84100
def baz(a, b)
85101
return [__FILE__, self.class]

test/ruby/test_require.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def test_require_too_long_filename
5454
end;
5555

5656
begin
57-
assert_in_out_err(["-S", "-w", "foo/" * 1024 + "foo"], "") do |r, e|
57+
assert_in_out_err(["-S", "-w", (["foo"] * 1025).join("_")], "") do |r, e|
5858
assert_equal([], r)
5959
assert_operator(2, :<=, e.size)
6060
assert_match(/warning: openpath: pathname too long \(ignored\)/, e.first)

test/ruby/test_rubyoptions.rb

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -446,37 +446,28 @@ def test_rubyopt
446446
def test_search
447447
rubypath_orig = ENV['RUBYPATH']
448448
path_orig = ENV['PATH']
449+
libpath = (path_orig if path_orig && RbConfig::CONFIG['LIBPATHENV'] == 'PATH')
449450

450-
Tempfile.create(["test_ruby_test_rubyoption", ".rb"]) {|t|
451-
t.puts "p 1"
452-
t.close
453-
454-
@verbose = $VERBOSE
455-
$VERBOSE = nil
451+
Dir.mktmpdir("test_ruby_test_rubyoption") do |path|
452+
name = "test_rubyoption.rb"
453+
parent, dir = File.split(path)
454+
File.write("#{path}/#{name}", "p 1")
455+
load_error = %r[#{Regexp.quote dir}/#{Regexp.quote name} \(LoadError\)]
456456

457-
path, name = File.split(t.path)
458-
459-
ENV['PATH'] = (path_orig && RbConfig::CONFIG['LIBPATHENV'] == 'PATH') ?
460-
[path, path_orig].join(File::PATH_SEPARATOR) : path
457+
ENV['PATH'] = [path, *libpath].join(File::PATH_SEPARATOR)
461458
assert_in_out_err(%w(-S) + [name], "", %w(1), [])
459+
ENV['PATH'] = [parent, *libpath].join(File::PATH_SEPARATOR)
460+
assert_in_out_err(%W(-S) + ["#{dir}/#{name}"], "", [], load_error)
462461
ENV['PATH'] = path_orig
463462

464463
ENV['RUBYPATH'] = path
465464
assert_in_out_err(%w(-S) + [name], "", %w(1), [])
466-
}
467-
468-
ensure
469-
if rubypath_orig
465+
ENV['RUBYPATH'] = parent
466+
assert_in_out_err(%w(-S) + ["#{dir}/#{name}"], "", [], load_error)
467+
ensure
470468
ENV['RUBYPATH'] = rubypath_orig
471-
else
472-
ENV.delete('RUBYPATH')
473-
end
474-
if path_orig
475469
ENV['PATH'] = path_orig
476-
else
477-
ENV.delete('PATH')
478470
end
479-
$VERBOSE = @verbose
480471
end
481472

482473
def test_shebang

0 commit comments

Comments
 (0)