Skip to content

Commit

Permalink
[GR-14460] Update to Ruby 2.6.2
Browse files Browse the repository at this point in the history
PullRequest: truffleruby/701
  • Loading branch information
chrisseaton committed Mar 14, 2019
2 parents 8518e42 + 69af745 commit ed796f7
Show file tree
Hide file tree
Showing 21 changed files with 289 additions and 100 deletions.
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.6.1
2.6.2
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 1.0 RC 14

Updated to Ruby 2.6.1, with the RubyGems 3.0.3 security patch.
Updated to Ruby 2.6.2.

Bug fixes:

Expand Down
4 changes: 2 additions & 2 deletions doc/contributor/updating-ruby.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ old patches using the old reference branch.

```
tool/import-mri-files.sh
git diff vNN this-branch | git apply -3
git diff vNN master | git apply -3
```

You'll usually get some conflicts to work out.

## Make other changes

* Update `versions.json`
* Update `versions.json` and `.ruby-version`
* Copy and paste `-h` and `--help` output to `RubyLauncher`
* Copy and paste the TruffleRuby `--help` output to `doc/user/options.md`
* Update `doc/user/compatibility.md`
Expand Down
2 changes: 1 addition & 1 deletion doc/user/compatibility.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Compatibility

TruffleRuby aims to be fully compatible with the standard implementation of
Ruby, MRI, version 2.6.1, revision 66950.
Ruby, MRI, version 2.6.2, revision 67232.

Any incompatibility with MRI is considered a bug, except for rare cases detailed below.
If you find an incompatibility with MRI, please [report](https://github.com/oracle/truffleruby/issues) it to us.
Expand Down
2 changes: 1 addition & 1 deletion lib/mri/bundler/shared_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ def set_rubyopt

def set_rubylib
rubylib = (ENV["RUBYLIB"] || "").split(File::PATH_SEPARATOR)
rubylib.unshift bundler_ruby_lib
rubylib.unshift bundler_ruby_lib unless RbConfig::CONFIG["rubylibdir"] == bundler_ruby_lib
Bundler::SharedHelpers.set_env "RUBYLIB", rubylib.uniq.join(File::PATH_SEPARATOR)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/mri/fileutils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ def remove_entry_secure(path, force = false)
f.chown euid, -1
f.chmod 0700
}
rescue EISDIR # JRuby in non-native mode can't open files as dirs
rescue Errno::EISDIR # JRuby in non-native mode can't open files as dirs
File.lstat(dot_file).tap {|fstat|
unless fu_stat_identical_entry?(st, fstat)
# symlink (TOC-to-TOU attack?)
Expand Down
159 changes: 80 additions & 79 deletions lib/mri/unicode_normalize/tables.rb

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions test/mri/excludes/OpenSSL/TestEngine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
exclude :test_openssl_engine_by_id_string, "needs investigation"
exclude :test_openssl_engine_digest_sha1, "needs investigation"
exclude :test_openssl_engine_id_name_inspect, "needs investigation"
exclude :test_openssl_engine_cipher_rc4, "needs investigation"
1 change: 1 addition & 0 deletions test/mri/excludes/TestBeginEndBlock.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
exclude :test_raise_in_at_exit, "needs investigation"
exclude :test_rescue_at_exit, "needs investigation"
exclude :test_callcc_at_exit, "needs investigation"
exclude :test_internal_errinfo_at_exit, "needs investigation"
1 change: 1 addition & 0 deletions test/mri/excludes/TestInteger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
exclude :test_square_root, "needs investigation"
exclude :test_Integer_with_exception_keyword, "needs investigation"
exclude :test_pow, "needs investigation"
exclude :test_positive_pow, "needs investigation"
1 change: 1 addition & 0 deletions test/mri/excludes/Test_Integer.rb
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
exclude :test_fixnum_range, "needs investigation"
exclude :test_positive_pow, "needs investigation"
7 changes: 7 additions & 0 deletions test/mri/tests/cext-c/integer/core_ext.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,17 @@ rb_int_to_bignum(VALUE x)
return x;
}

static VALUE
positive_pow(VALUE x, VALUE y)
{
return rb_int_positive_pow(NUM2LONG(x), NUM2ULONG(y));
}

void
Init_core_ext(VALUE klass)
{
rb_define_method(rb_cInteger, "bignum?", int_bignum_p, 0);
rb_define_method(rb_cInteger, "fixnum?", int_fixnum_p, 0);
rb_define_method(rb_cInteger, "to_bignum", rb_int_to_bignum, 0);
rb_define_method(rb_cInteger, "positive_pow", positive_pow, 1);
}
11 changes: 11 additions & 0 deletions test/mri/tests/cext-ruby/integer/test_integer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,15 @@ def test_fixnum_range
assert_fixnum(FIXNUM_MAX)
assert_bignum(FIXNUM_MAX+1)
end

def test_positive_pow
assert_separately(%w[-rc/integer], "#{<<~"begin;"}\n#{<<~'end;'}", timeout: 3)
begin;
assert_equal(1, 1.positive_pow(1))
assert_equal(0, 0.positive_pow(1))
assert_equal(3, 3.positive_pow(1))
assert_equal(-3, -3.positive_pow(1))
assert_equal(9, -3.positive_pow(2))
end;
end
end
24 changes: 12 additions & 12 deletions test/mri/tests/cext-ruby/test_scan_args.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def test_opt_hash
assert_equal([0, nil, {b: 1}], Bug::ScanArgs.opt_hash(b: 1))
assert_equal([1, "a", {b: 1}], Bug::ScanArgs.opt_hash("a", b: 1))
assert_raise(ArgumentError) {Bug::ScanArgs.opt_hash("a", "b")}
assert_raise(ArgumentError) {Bug::ScanArgs.opt_hash("a"=>0, b: 1)}
assert_equal([1, {"a"=>0}, {b: 1}], Bug::ScanArgs.opt_hash("a"=>0, b: 1))
end

def test_lead_opt_hash
Expand All @@ -112,15 +112,15 @@ def test_lead_opt_hash
assert_equal([2, "a", "b", {c: 1}], Bug::ScanArgs.lead_opt_hash("a", "b", c: 1))
assert_equal([1, {c: 1}, nil, nil], Bug::ScanArgs.lead_opt_hash(c: 1))
assert_raise(ArgumentError) {Bug::ScanArgs.lead_opt_hash("a", "b", "c")}
assert_raise(ArgumentError) {Bug::ScanArgs.lead_opt_hash("a", "b"=>0, c: 1)}
assert_equal([2, "a", {"b"=>0}, {c: 1}], Bug::ScanArgs.lead_opt_hash("a", "b"=>0, c: 1))
end

def test_var_hash
assert_equal([0, [], nil], Bug::ScanArgs.var_hash())
assert_equal([1, ["a"], nil], Bug::ScanArgs.var_hash("a"))
assert_equal([1, ["a"], {b: 1}], Bug::ScanArgs.var_hash("a", b: 1))
assert_equal([0, [], {b: 1}], Bug::ScanArgs.var_hash(b: 1))
assert_raise(ArgumentError) {Bug::ScanArgs.var_hash("a"=>0, b: 1)}
assert_equal([1, [{"a"=>0}], {b: 1}], Bug::ScanArgs.var_hash("a"=>0, b: 1))
end

def test_lead_var_hash
Expand All @@ -131,7 +131,7 @@ def test_lead_var_hash
assert_equal([1, "a", [], {c: 1}], Bug::ScanArgs.lead_var_hash("a", c: 1))
assert_equal([1, {c: 1}, [], nil], Bug::ScanArgs.lead_var_hash(c: 1))
assert_equal([3, "a", ["b", "c"], nil], Bug::ScanArgs.lead_var_hash("a", "b", "c"))
assert_raise(ArgumentError) {Bug::ScanArgs.lead_var_hash("a", "b"=>0, c: 1)}
assert_equal([2, "a", [{"b"=>0}], {c: 1}], Bug::ScanArgs.lead_var_hash("a", "b"=>0, c: 1))
end

def test_opt_var_hash
Expand All @@ -142,7 +142,7 @@ def test_opt_var_hash
assert_equal([1, "a", [], {c: 1}], Bug::ScanArgs.opt_var_hash("a", c: 1))
assert_equal([0, nil, [], {c: 1}], Bug::ScanArgs.opt_var_hash(c: 1))
assert_equal([3, "a", ["b", "c"], nil], Bug::ScanArgs.opt_var_hash("a", "b", "c"))
assert_raise(ArgumentError) {Bug::ScanArgs.opt_var_hash("a", "b"=>0, c: 1)}
assert_equal([2, "a", [{"b"=>0}], {c: 1}], Bug::ScanArgs.opt_var_hash("a", "b"=>0, c: 1))
end

def test_lead_opt_var_hash
Expand All @@ -154,7 +154,7 @@ def test_lead_opt_var_hash
assert_equal([1, {c: 1}, nil, [], nil], Bug::ScanArgs.lead_opt_var_hash(c: 1))
assert_equal([3, "a", "b", ["c"], nil], Bug::ScanArgs.lead_opt_var_hash("a", "b", "c"))
assert_equal([3, "a", "b", ["c"], {d: 1}], Bug::ScanArgs.lead_opt_var_hash("a", "b", "c", d: 1))
assert_raise(ArgumentError) {Bug::ScanArgs.lead_opt_var_hash("a", "b", "c"=>0, d: 1)}
assert_equal([3, "a", "b", [{"c"=>0}], {d: 1}], Bug::ScanArgs.lead_opt_var_hash("a", "b", "c"=>0, d: 1))
end

def test_opt_trail_hash
Expand All @@ -165,7 +165,7 @@ def test_opt_trail_hash
assert_equal([2, "a", "b", {c: 1}], Bug::ScanArgs.opt_trail_hash("a", "b", c: 1))
assert_equal([1, nil, {c: 1}, nil], Bug::ScanArgs.opt_trail_hash(c: 1))
assert_raise(ArgumentError) {Bug::ScanArgs.opt_trail_hash("a", "b", "c")}
assert_raise(ArgumentError) {Bug::ScanArgs.opt_trail_hash("a", "b"=>0, c: 1)}
assert_equal([2, "a", {"b"=>0}, {c: 1}], Bug::ScanArgs.opt_trail_hash("a", "b"=>0, c: 1))
end

def test_lead_opt_trail_hash
Expand All @@ -178,7 +178,7 @@ def test_lead_opt_trail_hash
assert_equal([3, "a", "b", "c", nil], Bug::ScanArgs.lead_opt_trail_hash("a", "b", "c"))
assert_equal([3, "a", "b", "c", {c: 1}], Bug::ScanArgs.lead_opt_trail_hash("a", "b", "c", c: 1))
assert_raise(ArgumentError) {Bug::ScanArgs.lead_opt_trail_hash("a", "b", "c", "d")}
assert_raise(ArgumentError) {Bug::ScanArgs.lead_opt_trail_hash("a", "b", "c"=>0, c: 1)}
assert_equal([3, "a", "b", {"c"=>0}, {c: 1}], Bug::ScanArgs.lead_opt_trail_hash("a", "b", "c"=>0, c: 1))
end

def test_var_trail_hash
Expand All @@ -190,7 +190,7 @@ def test_var_trail_hash
assert_equal([1, [], {c: 1}, nil], Bug::ScanArgs.var_trail_hash(c: 1))
assert_equal([3, ["a", "b"], "c", nil], Bug::ScanArgs.var_trail_hash("a", "b", "c"))
assert_equal([3, ["a", "b"], "c", {c: 1}], Bug::ScanArgs.var_trail_hash("a", "b", "c", c: 1))
assert_raise(ArgumentError) {Bug::ScanArgs.var_trail_hash("a", "b", "c"=>0, c: 1)}
assert_equal([3, ["a", "b"], {"c"=>0}, {c: 1}], Bug::ScanArgs.var_trail_hash("a", "b", "c"=>0, c: 1))
end

def test_lead_var_trail_hash
Expand All @@ -202,7 +202,7 @@ def test_lead_var_trail_hash
assert_equal([2, "a", [], "b", {c: 1}], Bug::ScanArgs.lead_var_trail_hash("a", "b", c: 1))
assert_equal([3, "a", ["b"], "c", nil], Bug::ScanArgs.lead_var_trail_hash("a", "b", "c"))
assert_equal([3, "a", ["b"], "c", {c: 1}], Bug::ScanArgs.lead_var_trail_hash("a", "b", "c", c: 1))
assert_raise(ArgumentError) {Bug::ScanArgs.lead_var_trail_hash("a", "b", c: 1, "c"=>0)}
assert_equal([3, "a", ["b"], {"c"=>0}, {c: 1}], Bug::ScanArgs.lead_var_trail_hash("a", "b", c: 1, "c"=>0))
end

def test_opt_var_trail_hash
Expand All @@ -214,7 +214,7 @@ def test_opt_var_trail_hash
assert_equal([2, "a", [], "b", {c: 1}], Bug::ScanArgs.opt_var_trail_hash("a", "b", c: 1))
assert_equal([3, "a", ["b"], "c", nil], Bug::ScanArgs.opt_var_trail_hash("a", "b", "c"))
assert_equal([3, "a", ["b"], "c", {c: 1}], Bug::ScanArgs.opt_var_trail_hash("a", "b", "c", c: 1))
assert_raise(ArgumentError) {Bug::ScanArgs.opt_var_trail_hash("a", "b", "c"=>0, c: 1)}
assert_equal([3, "a", ["b"], {"c"=>0}, {c: 1}], Bug::ScanArgs.opt_var_trail_hash("a", "b", "c"=>0, c: 1))
end

def test_lead_opt_var_trail_hash
Expand All @@ -226,6 +226,6 @@ def test_lead_opt_var_trail_hash
assert_equal([3, "a", "b", [], "c", nil], Bug::ScanArgs.lead_opt_var_trail_hash("a", "b", "c"))
assert_equal([3, "a", "b", [], "c", {c: 1}], Bug::ScanArgs.lead_opt_var_trail_hash("a", "b", "c", c: 1))
assert_equal([4, "a", "b", ["c"], "d", nil], Bug::ScanArgs.lead_opt_var_trail_hash("a", "b", "c", "d"))
assert_raise(ArgumentError) {Bug::ScanArgs.lead_opt_var_trail_hash("a", "b", "c", "d"=>0, c: 1)}
assert_equal([4, "a", "b", ["c"], {"d"=>0}, {c: 1}], Bug::ScanArgs.lead_opt_var_trail_hash("a", "b", "c", "d"=>0, c: 1))
end
end
9 changes: 9 additions & 0 deletions test/mri/tests/fileutils/test_fileutils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,15 @@ def test_remove_entry_secure
remove_entry_secure 'tmp/tmpdir/c', true
assert_file_not_exist 'tmp/tmpdir/a'
assert_file_not_exist 'tmp/tmpdir/c'

File.chmod(01777, 'tmp/tmpdir')
if File.sticky?('tmp/tmpdir')
Dir.mkdir 'tmp/tmpdir/d', 0
assert_raise(Errno::EACCES) {remove_entry_secure 'tmp/tmpdir/d'}
File.chmod 0777, 'tmp/tmpdir/d'
Dir.rmdir 'tmp/tmpdir/d'
end

Dir.rmdir 'tmp/tmpdir'
end

Expand Down
7 changes: 7 additions & 0 deletions test/mri/tests/ripper/test_scanner_events.rb
Original file line number Diff line number Diff line change
Expand Up @@ -886,6 +886,13 @@ def test_ignored_nl
scan('ignored_nl', "1;\r\n")
end

def test_ignored_sp
assert_equal [],
scan('ignored_sp', "<<~EOS\nheredoc\nEOS")
assert_equal [" "],
scan('ignored_sp', "<<~EOS\n heredoc\nEOS")
end

def test___end__
assert_equal [],
scan('__end__', "")
Expand Down
22 changes: 22 additions & 0 deletions test/mri/tests/ruby/test_beginendblock.rb
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,26 @@ def test_errinfo_at_exit
end
end;
end

if defined?(fork)
def test_internal_errinfo_at_exit
# TODO: use other than break-in-fork to throw an internal
# error info.
error, pid, status = IO.pipe do |r, w|
pid = fork do
r.close
STDERR.reopen(w)
at_exit do
$!.class
end
break
end
w.close
[r.read, *Process.wait2(pid)]
end
assert_not_predicate(status, :success?)
assert_not_predicate(status, :signaled?)
assert_match(/unexpected break/, error)
end
end
end
13 changes: 13 additions & 0 deletions test/mri/tests/ruby/test_io.rb
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,19 @@ def test_gets_chomp_default_rs
assert_nil r.gets
r.close
end)

(0..3).each do |i|
pipe(proc do |w|
w.write("a" * ((4096 << i) - 4), "\r\n" "a\r\n")
w.close
end,
proc do |r|
r.gets
assert_equal "a", r.gets(chomp: true)
assert_nil r.gets
r.close
end)
end
end

def test_gets_chomp_rs_nil
Expand Down
7 changes: 7 additions & 0 deletions test/mri/tests/ruby/test_m17n.rb
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,13 @@ def test_utf_without_bom_asciionly
assert_empty(encs, bug10598)
end

def test_utf_without_bom_valid
encs = [Encoding::UTF_16, Encoding::UTF_32].find_all {|enc|
!(+"abcd").encode!(enc).force_encoding(enc).valid_encoding?
}
assert_empty(encs)
end

def test_object_utf16_32_inspect
EnvUtil.suppress_warning do
begin
Expand Down
Loading

0 comments on commit ed796f7

Please sign in to comment.