Commit graph

59794 commits

Author SHA1 Message Date
Nobuyoshi Nakada
f1563edca0 Get rid of use of magic number 'E' 2020-07-23 16:56:42 +09:00
nagachika
4f714939ef merge revision(s) e04418bb16: [Backport #16830]
[ruby/uri] Check if DN exists

	https://bugs.ruby-lang.org/issues/16830

	b4bf8c1217
2020-07-23 14:02:05 +09:00
nagachika
9da6470d7b merge revision(s) a2be428c5f: [Backport #16826]
Fix ObjectSpace::WeakMap#key? to work if the value is nil

	* Fixes [Bug #16826]
2020-07-23 13:50:56 +09:00
nagachika
27fa1c61b7 merge revision(s) 579645d9f8: [Backport #17033]
Fixed infinite loop at error in printing cause [Bug #17033]
2020-07-23 12:13:30 +09:00
nagachika
4be9bf1f67 merge revision(s) 99a9c3fe2e: [Backport #17024]
Fixed yday and wday with timezone [Bug #17024]
2020-07-23 11:33:11 +09:00
nagachika
13d2ab0d88 merge revision(s) 2ecfb88ee5: [Backport #16918]
Correctly remove temporary directory if path yielded is mutated

	Another approach would be to freeze the string, but that could
	cause backwards compatibility issues.

	Fixes [Bug #16918]
2020-07-23 11:16:31 +09:00
nagachika
cc39480cf9 merge revision(s) 5a79d8e0507cd143100bf928a88a59a8b5a5bca6,160511d851375f7cb922faae3a9310633187f51f: [Backport #16925]
Fix error raised by Net::HTTPResponse#inflater if the block raises

	* See https://bugs.ruby-lang.org/issues/13882#note-6

	Quarantine specs which fail frequently with CHECK_LEAKS=true
2020-07-23 11:11:12 +09:00
nagachika
d24cce8e7f merge revision(s) bf1a6771f305ea286a3ae575676924551c03e857,c1463625555b061a2b94c3b6c5581730b482a285: [Backport #17012] [Backport #17014]
Fix non-numeric exclusive Range#minmax bug

	The implementation of Range#minmax added in d5c60214c4 causes the
	following incorrect behaviour:

	  ('a'...'c').minmax => ["a", ["a", "b"]]

	instead of

	  ('a'...'c').minmax => ["a", "b"]

	This is because the C implementation of Range#minmax (range_minmax)
	directly delegates to the C implementation of Range#min (range_min) and
	Range#max (range_max), without changing the execution context.

	Range#max's C implementation (range_max), when given a non-numeric
	exclusive range, delegates to super, which is meant to call
	Enumerable#max. However, because range_max is called directly by
	range_minmax, super calls Enumerable#minmax instead, causing the
	incorrect nesting.

	Perhaps it is possible to change the execution context in an optimized
	manner, but the simplest solution seems to be to just explicitly
	delegate from Range#minmax to Range#min and Range#max.

	Use static variables in Range#minmax
2020-07-19 12:16:37 +09:00
nagachika
f43b8c4f73 merge revision(s) 0ba27259d3: [Backport #16940]
Fix crashes in the peephole optimizer on OpenBSD/sparc64

	These crashes are due to alignment issues, casting ADJUST to INSN
	and then accessing after the end of the ADJUST.  These patches
	come from Stefan Sperling <stsp@apache.org>, who reported the
	issue.
2020-07-19 11:56:32 +09:00
nagachika
e619178e52 merge revision(s) 6e7e7c1e57: [Backport #17023]
Only marked objects should be considered movable

	Ruby's GC is incremental, meaning that during the mark phase (and also
	the sweep phase) programs are allowed to run.  This means that programs
	can allocate objects before the mark or sweep phase have actually
	completed.  Those objects may not have had a chance to be marked, so we
	can't know if they are movable or not. Something that references the
	newly created object might have called the pinning function during the
	mark phase, but since the mark phase hasn't run we can't know if there
	is a "pinning" relationship.

	To be conservative, we must only allow objects that are not pinned but
	also marked to move.
2020-07-19 11:52:11 +09:00
nagachika
ad15fd03e9 merge revision(s) 26c179d7e7: [Backport #17026]
Check argument to ObjectSpace._id2ref

	Ensure that the argument is an Integer or implicitly convert to,
	before dereferencing as a Bignum.  Addressed a regression in
	b99833baec.

	Reported by u75615 at https://hackerone.com/reports/898614
2020-07-19 11:32:59 +09:00
nagachika
9e76124a2b bump patchlevel to 93 2020-07-18 13:35:45 +09:00
Yusuke Endoh
17b088d1e5 Update some syslog tests to absurb the format change of FreeBSD syslog
FreeBSD

```
$ ruby -rsyslog -e 'Syslog.open("rubyspec", Syslog::LOG_PERROR) {|s| s.log(Syslog::LOG_ALERT, "Hello") }'
rubyspec 78462 - - Hello
```

Linux

```
$ ruby -rsyslog -e 'Syslog.open("rubyspec", Syslog::LOG_PERROR) {|s| s.log(Syslog::LOG_ALERT, "Hello") }'
rubyspec: Hello
```

591ef7c807
2020-07-18 13:35:45 +09:00
Kazuki Yamaguchi
0c4d93e699 test/openssl/test_ssl: skip test_fallback_scsv if necessary
Run the test case only when the OpenSSL supports both TLS 1.1 and TLS
1.2. Note that the fallback SCSV mechanism is for TLS 1.2 or older and
not for 1.3.

Fixes: https://github.com/ruby/openssl/issues/336
2020-07-18 13:17:10 +09:00
Yusuke Endoh
bad7ab35d1 test/lib/jit_support.rb: Let JIT tests skip on centos8
It has the same issue as RHEL 8.  k0kubun said he will fix later
2020-07-11 16:23:59 +09:00
nagachika
b4c893a62c OpenSSL 1.1.1 introduces a new '.include' directive. Update our config
parser to support that.

As mentioned in the referenced GitHub issue, we should use the OpenSSL
API instead of implementing the parsing logic ourselves, but it will
need backwards-incompatible changes which we can't backport to stable
versions. So continue to use the Ruby implementation for now.

References:
  https://github.com/ruby/openssl/issues/208
  https://github.com/ruby/openssl/pull/216

The original patch was written by Kazuki Yamaguchi <k@rhe.jp> and
the patch for ruby_2_7 branch was prepared by Vít Ondruch.
2020-07-11 16:10:41 +09:00
nagachika
a0bb4eb045 bump patchlevel: merge commits: 5c2508060b 2480ef904c 47720e2255 2020-07-10 08:51:53 +09:00
Nobuyoshi Nakada
b971bad49b Bison 3.59.1 folds yydestruct function header 2020-07-10 08:50:41 +09:00
Nobuyoshi Nakada
06ab2791c3 pure_parser.rb: get rid of an error at localed messages 2020-07-10 08:50:41 +09:00
Nobuyoshi Nakada
1ee1684a4a Bison 3.5.91 now defaults parse.error to "simple" 2020-07-10 08:50:41 +09:00
nagachika
601613fdf3 merge revision(s) 87ad5ea729735ff6b8f1ac0bb3aad2aedd6f716e,9745e90197f129708986803e8913fb151862478a:
Skip jit_test on some new RubyCI envs for now

	Propagate JIT skip to all tests
2020-07-09 21:03:58 +09:00
nagachika
6c22070408 merge revision(s) 21d8e69248:
disable to show the maximum number of threads.

	On Deiban 9 environment, the thread tests failed and
	this maximum threads information can finish up the machine
	resources. To check it, I turned-off showing this information.
2020-07-09 20:54:28 +09:00
nagachika
9720591043 merge revision(s) 75802bcff1:
configure: suppress icc warnings

	Every time a pointer to/from VALUE conversion happens, these two
	warnings are issued:

	- warning #1684: conversion from pointer to same-sized integral type (potential portability problem)
	- warning #2312: pointer cast involving 64-bit pointed-to type

	Thank you, but we are well aware of the "potential portability problem".
	Let us ignore them all.
2020-07-05 07:03:14 +09:00
nagachika
799c5766a4 merge revision(s) a19228f878: [Backport #16979]
brace the fact that lchmod(2) can EOPNOTSUPP

	Musl libc has this function as a tiny wrapper of fchmodat(3posix).  On
	the other hand Linux kernel does not support changing modes of a symlink.
	The operation always fails with EOPNOTSUPP.  This fchmodat behaviour is
	defined in POSIX.  We have to take care of such exceptions.
2020-06-27 12:29:42 +09:00
nagachika
d8a32b1465 merge revision(s) 263b941321: [Backport #16981]
[ripper] fix mismatched indentations warning [Bug #16981]

	The scanner location has to be set from `lex.ptok` before it is
	flushed by dispatching the scanner event.
2020-06-27 12:20:36 +09:00
nagachika
3c55d93cf6 merge revision(s) 7e289cdf3f: [Backport #16949]
[ruby/psych] Fixing compatibility with libyaml 0.2.5

	The main issue is that commas aren't allowed in local tags.  libyaml
	was updated to follow the spec, and our tests were out of date.

	See: https://github.com/yaml/libyaml/issues/196

	3f5e520fd3
2020-06-13 11:29:51 +09:00
git
241cb3fa03 * 2020-06-08 [ci skip] 2020-06-08 09:58:19 +09:00
nagachika
16aef5da56 merge revision(s) ac2106acc276854ae2ac8cc5fa6859aa28362f2f,cf90df22c74da2f87421749e8d065cfbd3812afd: [Backport #16813]
[DOC] Fixed explanation for Method#>> [Bug #16813] [ci skip]

	[DOC] Separated Method#[] from Method#call [Bug #16813] [ci skip]
2020-06-07 12:04:23 +09:00
NARUSE, Yui
a0c7c23c9c v2.7.1p83 2020-03-31 19:44:55 +09:00
NARUSE, Yui
f832d957b8 ext/socket/init.c: do not return uninitialized buffer
BasicSocket#read_nonblock and some methods changes the size of a buffer
string, but when no data is available, the buffer is returned as
uninitialized.

Co-Authored-By: Samuel Williams <samuel.williams@oriontransfer.co.nz>
2020-03-31 19:26:10 +09:00
git
5caee29164 * 2020-03-31 [ci skip] 2020-03-31 16:31:53 +09:00
Jeremy Evans
bb93659fef
Fix pp when passed a empty ruby2_keywords-flagged hash as array element (#2966)
This causes problems because the hash is passed to a block not
accepting keywords.  Because the hash is empty and keyword flagged,
it is removed before calling the block.  This doesn't cause an
ArgumentError because it is a block and not a lambda.  Just like
any other block not passed required arguments, arguments not
passed are set to nil.

Issues like this are a strong reason not to have ruby2_keywords
by default.

Fixes [Bug #16519]

This backports 28d31ead34 and
0ea759eac9, but needed to be modified
for 2.7 as 2.7 will perform empty keyword to positional hash
conversion for required arguments, which will happen if "v" in the
seplist method is empty when yielded.

Co-authored-by: NARUSE, Yui <nurse@users.noreply.github.com>
2020-03-31 16:10:57 +09:00
git
d04856bdc5 * 2020-03-30 [ci skip] 2020-03-30 19:15:42 +09:00
Alan Wu
b5fa156b79 Clear all trace events during teardown
Since 0c2d81dada, not all trace events are cleared during VM teardown.
This causes a crash when there is a tracepoint for
`RUBY_INTERNAL_EVENT_GC_EXIT` active during teardown.

The commit looks like a refactoring commit so I think this change was
unintentional.

[Bug #16682]

(cherry picked from commit b385f7670f)
2020-03-30 19:15:11 +09:00
aycabta
0057fe4063
Ruby 2.7 backport about IRB (#2990)
* [ruby/reline] Sort completion list

#### Legacy mode:

  ```console
  $ irb --legacy
  irb(main):001:0> l[TAB][TAB]
  lambda           load             local_variables  loop
  ```

#### Before this patch:

  ```console
  $ irb
  irb(main):001:0> l[TAB][TAB]
  local_variables
  loop
  lambda
  load
  ```

#### After this patch:

  ```console
  $ irb
  irb(main):001:0> l[TAB][TAB]
  lambda
  load
  local_variables
  loop
  ```

6074069c7d

* Drop an invalid char as UTF-8

* Add test_completion_with_indent_and_completer_quote_characters

This is for 8a705245e5.

* [ruby/irb] Add tests for RubyLex

The set_auto_indent method calculates the correct number of spaces for
indenting a line. We think there might be a few bugs in this method so
we are testing the current functionality to make sure nothing breaks
when we address those bugs.

Example test failure:

```
  1) Failure:
TestIRB::TestRubyLex#test_auto_indent [/Users/Ben/Projects/irb/test/irb/test_ruby_lex.rb:75]:
Calculated the wrong number of spaces for:
 def each_top_level_statement
  initialize_input
  catch(:TERM_INPUT) do
    loop do
      begin
        prompt
        unless l = lex
          throw :TERM_INPUT if @line == ''
        else
.
<10> expected but was
<12>.
```

752d5597ab

* [ruby/reline] Degenerate the terminal size to [$LINES, $COLUMNS] if it is unknown

This is a workaround for https://github.com/ruby/irb/issues/50

5725677d1a

* [ruby/irb] Fix newline depth with multiple braces

This commit fixes the check_newline_depth_difference method to multiple
open braces on one line into account. Before this change we were
subtracting from the depth in check_newline_depth_difference on
every open brace. This is the right thing to do if the opening and
closing brace are on the same line. For example in a method definition we
have an opening and closing parentheses we want to add 1 to our depth,
and then remove it.

```
def foo()
end
```

However this isn't the correct behavior when the brace spans multiple
lines. If a brace spans multiple lines we don't want to subtract from
check_newline_depth_difference and we want to treat the braces the same
way as we do `end` and allow check_corresponding_token_depth to pop the
correct depth.

Example of bad behavior:

```
def foo()
  [
  ]
puts 'bar'
end
```

Example of desired behavior:

```
def foo()
  [
  ]
  puts 'bar'
end
```

7dc8af01e0

* text/readline/test_readline.rb - fix skip on Reline (#2743)

TestRelineAsReadline#test_input_metachar passes on MinGW

* Add "require 'openstruct'" what is forgotten

* [ruby/irb] Fix lib name of OpenStruct

1f3a84ab6b

* Add load path and require for ruby/ruby

* Rescue EOFError

If C-d is pressed before IRB is ready, IRB crashes because EOFError occurs.

* Complete indented and quoted string correctly

  def foo
    ''.upca[TAB]

This will be completed to be:

  def foo
  ''.upcase

The indent was gone. This commit fixes the bug.

* [ruby/irb] Fix crashing when multiple open braces per line

https://github.com/ruby/irb/issues/55

If we had put multiple open braces on a line the with no closing brace
spaces_of_nest array keeps getting '0' added to it. This means that when
we pop off of this array we are saying that we should be in position zero
for the next line. This is an issue because we don't always want to be
in position 0 after a closing brace.

Example:
```
[[[
]
]
]
```
In the above example the 'spaces_of_nest' array looks like this after
the first line is entered: [0,0,0]. We really want to be indented 4
spaces for the 1st closing brace 2 for the 2nd and 0 for the 3rd. i.e.
we want it to be: [0,2,4].

We also saw this issue with a heredoc inside of an array.

```
[<<FOO]
hello
FOO
```

80c69c8272

* Support history-size in .inputrc correctly

* Introduce an abstracted structure about the encoding of Reline

The command prompt on Windows always uses Unicode to take input and print
output but most Reline implementation depends on Encoding.default_external.
This commit introduces an abstracted structure about the encoding of Reline.

* Remove an unused setting variable

* Use Reline.encoding_system_needs if exists

* Add tests for vi_insert and vi_add

* Implement vi_insert_at_bol and vi_add_at_eol

* [ruby/reline] Implement vi_to_next_char

066ecb0a21

* [ruby/reline] Implement vi_prev_char and vi_to_prev_char

0ad3ee63fa

* [ruby/readline-ext] Include ruby/assert.h in ruby/ruby.h so that assertions can be there

4d44c12832

* Stop using minitest dependent methods

* Skip a test that uses assert_ruby_status if it doesn't exist

* Use omit instead of skip

* Check DONT_RUN_RELINE_TEST envvar

* [ruby/irb] Add newline_before_multiline_output

9eb1801a66

* [ruby/irb] Fix compatibility with rails before 5.2

Rails before 5.2 added Array#append as an alias to Array#<< ,
so that it expects only one argument.
However ruby-2.5 added Array#append as an alias to Array#push
which takes any number of arguments.

If irb completion is used in `rails c` (for example "IO.<tab>")
it fails with:
  irb/completion.rb:206:in `<<': wrong number of arguments (given 3, expected 1) (ArgumentError)

Using Array#push instead of Array#append fixes compatibility.

5b7bbf9c34

* Reline: Use a more robust detection of MinTTY

The previous detection per get_screen_size fails when stdout is passed
to a pipe. That is the case when running ruby tests in parallel ("-j" switch).
In this case Reline believes that it's running on MinTTY and the tests
are running with ANSI IOGate instead of the Windows adapter on MINGW.
So parallel test results were different to that of a single process.
This commit fixes these differencies.

The code is taken from git sources and translated to ruby.
NtQueryObject() is replaced by GetFileInformationByHandleEx(), because
NtQueryObject() is undocumented and is more difficult to use:
  c5a03b1e29/compat/winansi.c (L558)

* Reline: Fix changed test results due to change to UTF-8 on Windows

In commit f8ea2860b0 the Reline encoding
for native windows console was changed to hardcoded UTF-8.
This caused failures in reline and readline tests, but they were hidden,
because parallel ruby tests incorrectly used Reline::ANSI as IOGate.
Tests failures were raised in single process mode, but not with -j switch.

This patch corrects encodings on native Windows console.

* [ruby/irb] [ruby/irb] Rewrite an expression to detect multiline

ed5cf375a6

5b7bbf9c34

* [ruby/reline] Implement vi_change_meta

8538e0e10f

* Always refer to Reline::IOGate.encoding

* Always use UTF-8 for Reline::GeneralIO on Windows

* Use test_mode on Reline::History::Test for encoding

* [ruby/reline] Support GNOME style Home/End key sequences [Bug #16510]

788f0df845

* [ruby/irb] Add a new easter egg: dancing ruby

e37dc7e58e

* [ruby/irb] Exclude useless files from RDoc

8f1ab2400c

* [ruby/irb] Exclude useless files from RDoc

* Fix inaccuracy in encoding tests

These tests assume
  Encoding.find('locale') == Encoding.find('external')
and fail if they are distinct.

* [ruby/reline] Fix Reline::Windows#scroll_down

I mistook Right and Bottom.

8be401c5f5

* [ruby/reline] Bypass cursor down when a char is rendered at eol on Windows

A newline is automatically inserted if a character is rendered at eol on
Windows command prompt.

4bfea07e4a

* [ruby/reline] Organize special keys escape sequences

41deb1a3d9

* [ruby/readline-ext] Remove unnecessary -I$(top_srcdir) when it's an individual gem

efaca4a5f4

* [ruby/readline-ext] Check TestRelineAsReadline existance

c0a6303168

* [ruby/readline-ext] The ruby/assert.h is adopted by Ruby 2.7 or later

106c31fc1b

* Revert "[ruby/readline-ext] Include ruby/assert.h in ruby/ruby.h so that assertions can be there"

This reverts commit 425b2064d3.

This cherry-pick was a mistake.

* [ruby/readline-ext] Use require check instead of DONT_RUN_RELINE_TEST env

1df99d1481

* [ruby/readline-ext] Add spec.extensions

8c33abb13c

* [ruby/readline-ext] Use rake/extensiokntask to build

b0b5f709bd

* Fix readline build dependency

* [ruby/irb] Add test_complete_symbol

dbbf086c1f

* [ruby/irb] Check doc namespace correctly

IRB::InputCompletor::PerfectMatchedProc crashes when doc not found because a
variable name was incorrect.

889fd4928f

* [ruby/irb] Fix auto indent with closed brace

A closed brace in auto-indent shouldn't affect the next brace in the same line,
but it behaves like below:

  p() {
    }

It's a bug.

fbe59e344f

* [ruby/irb] Use 0.step instead of (..0).each for Ruby 2.5

5d628ca40e

* Revert "[ruby/irb] Add test_complete_symbol"

This reverts commit 3af3431c2c.

* [ruby/irb] fix reserved words and completion for them

6184b227ad

* Add test_complete_symbol

The previous version of the test method used a symbol, ":abcdefg" to complete
but longer symbols that can be completed are defined by other test methods of
other libs.

* test/irb/test_completion.rb: suppress a warning: unused literal ignored

* [ruby/reline] Use IO#write instead of IO#print

IO#print always adds a string of $\ automatically.

a93119c847

* [ruby/irb] Version 1.2.2

a71753f15a

* [ruby/reline] Version 0.1.3

ea2b182466

* [ruby/irb] Include easter-egg.rb in gemspec

`irb` doesn't run because this file isn't included in the gem.
73cda56d25

* [ruby/irb] Version 1.2.3

dd56e06df5

* support multi-run test for test_readline.rb

* [ruby/irb] `yield` outside method definition is a syntax error

dbc7b059c7

* test/readline - allow ENV control of test class creation

In ruby/ruby, the tests run on both readline & reline by creating four test classes:
```
TestReadline
TestReadlineHistory

TestRelineAsReadline
TestRelineAsReadlineHistory
```

Reline inports the test files and uses them in its CI.  Adding the ENV control allows it to only run the `TestRelineAsReadline` classes.

* Omit test_using_quoting_detection_proc_with_multibyte_input temporarily for random order test

* support random order test.

test_readline:
  HISTORY should be empty.

test_using_quoting_detection_proc:
test_using_quoting_detection_proc_with_multibyte_input:
  Readline.completer_quote_characters= and
  Readline.completer_word_break_characters= doesn't accept nil,
  so skip if previous values are nil.

* Set Readline.completion_append_character = nil always

GNU Readline add a white space when Readline.completion_append_character is
not initialized.

* Fix a typo [ci skip]

* skip test if Reline.completion_proc is nil.

Some other tests can set Reline.completion_proc, so if it is nil,
simply skip this test.

* Reset Reline.point

TestRelineAsReadline#test_insert_text expects Readline.point == 0
at the beginning of the test, but a test violate this assumption.

* Convert incompatible encoding symbol names

* Ignore incompatible convert of symbols

* Add workaround for test-bundler failure

500526558 (step):16:127
```
Failures:

  1) Bundler.setup when Bundler is bundled doesn't blow up
     Failure/Error: expect(err).to be_empty

       expected `"fatal: not a git repository (or any of the parent directories): .git\nfatal: not a git repository (o...the parent directories): .git\nfatal: not a git repository (or any of the parent directories): .git".empty?` to return true, got false

       Commands:
       $ /home/runner/work/actions/actions/snapshot-master/ruby \
         -I/home/runner/work/actions/actions/snapshot-master/lib:/home/runner/work/actions/actions/snapshot-master/spec/bundler \
         -rsupport/hax -rsupport/artifice/fail \
         /home/runner/work/actions/actions/snapshot-master/libexec/bundle install --retry 0
       Resolving dependencies...
       Using bundler 2.1.4
       Bundle complete! 1 Gemfile dependency, 1 gem now installed.
       Use `bundle info [gemname]` to see where a bundled gem is installed.
       fatal: not a git repository (or any of the parent directories): .git
       fatal: not a git repository (or any of the parent directories): .git
       fatal: not a git repository (or any of the parent directories): .git
       # $? => 0

       $ /home/runner/work/actions/actions/snapshot-master/ruby \
         -I/home/runner/work/actions/actions/snapshot-master/lib:/home/runner/work/actions/actions/snapshot-master/spec/bundler \
         -rsupport/hax -rsupport/artifice/fail \
         /home/runner/work/actions/actions/snapshot-master/libexec/bundle exec ruby -e \
         require\ \'bundler\'\;\ Bundler.setup
       fatal: not a git repository (or any of the parent directories): .git
       fatal: not a git repository (or any of the parent directories): .git
       fatal: not a git repository (or any of the parent directories): .git
       # $? => 0
     # ./spec/bundler/runtime/setup_spec.rb:1056:in `block (3 levels) in <top (required)>'
     # ./spec/bundler/spec_helper.rb:111:in `block (3 levels) in <top (required)>'
     # ./spec/bundler/spec_helper.rb:111:in `block (2 levels) in <top (required)>'
     # ./spec/bundler/spec_helper.rb:78:in `block (2 levels) in <top (required)>'
make: *** [yes-test-bundler] Error 1
```

* [ruby/irb] Unnamed groups are not captured when named groups are used

0a641a69b0

* [ruby/reline] Work with wrong $/ value correctly

962ebf5a1b

* [ruby/irb] Detect multiple lines output simplify

The old implementation performance test code:

    require 'objspace'
    puts "%.5g MB" % (ObjectSpace.memsize_of_all * 0.001 * 0.001)
    /\A.*\Z/ !~ ('abc' * 20_000_000)
    puts "%.5g MB" % (ObjectSpace.memsize_of_all * 0.001 * 0.001)

and run `time test.rb`:

    2.5868 MB
    62.226 MB

    real    0m1.307s
    user    0m0.452s
    sys     0m0.797s

The new implementation performance test code:

    require 'objspace'
    puts "%.5g MB" % (ObjectSpace.memsize_of_all * 0.001 * 0.001)
    ('abc' * 20_000_000).include?("\n")
    puts "%.5g MB" % (ObjectSpace.memsize_of_all * 0.001 * 0.001)

and run `time test.rb`:

    2.5861 MB
    62.226 MB

    real    0m0.132s
    user    0m0.088s
    sys     0m0.042s

40d6610baf

* [ruby/reline] Suppress error in case INPUTRC env is empty

bce7e7562b

* [ruby/reline] Add yamatanooroti rendering test

f092519525

* [ruby/reline] Rename test suite name of yamatanooroti test

b0f32f5de4

* [ruby/reline] Add a comment why rescue yamatanooroti loading error on the test

2a8061daec

* [ruby/irb] Suppress crashing when EncodingError has occurred without lineno

13572d8cdc

* [ruby/reline] Suppress error when check ambiguous char width in LANG=C

623dffdd75

* [ruby/io-console] Enable only interrupt bits on `intr: true`

baaf929041

* [ruby/io-console] bump up to 0.5.4

* [ruby/io-console] Update the minimum requirement of Ruby version

73e7b6318a

* [ruby/io-console] Filter Ruby engine name rather than just /ruby/

This breaks tests using this path on JRuby because the `jruby`
executable turns into `jjruby` after the sub.

e5951aa34c

* [ruby/io-console] bump up to 0.5.5

* [ruby/io-console] Prefer keyword arguments

5facbfc4c8

* [ruby/io-console] [DOC] Improved about `intr:`

82b630cd79

* [ruby/io-console] Just ignore the extension on other than CRuby

41b6f09574

* [ruby/io-console] bump up to 0.5.6

Co-authored-by: KOBAYASHI Shuji <shuujii@gmail.com>
Co-authored-by: Ben <kanobt61@gmail.com>
Co-authored-by: Yusuke Endoh <mame@ruby-lang.org>
Co-authored-by: MSP-Greg <MSP-Greg@users.noreply.github.com>
Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
Co-authored-by: Kenta Murata <mrkn@mrkn.jp>
Co-authored-by: Lars Kanis <lars@greiz-reinsdorf.de>
Co-authored-by: Lars Kanis <kanis@comcard.de>
Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
Co-authored-by: Hiroshi SHIBATA <hsbt@ruby-lang.org>
Co-authored-by: Nobuhiro IMAI <nov@yo.rim.or.jp>
Co-authored-by: Nick Lewis <nick@puppet.com>
Co-authored-by: S-H-GAMELINKS <gamelinks007@gmail.com>
Co-authored-by: Koichi Sasada <ko1@atdot.net>
Co-authored-by: Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
Co-authored-by: Charles Oliver Nutter <headius@headius.com>
2020-03-30 19:09:50 +09:00
git
ecf874edea * 2020-03-28 [ci skip] 2020-03-28 06:14:02 +09:00
Yusuke Endoh
22c3014e36 Suppress an "assigned but unused variable" warning
(cherry picked from commit 501f2c44e6)
2020-03-28 04:01:23 +09:00
Nobuyoshi Nakada
44f7e3883e Preserve kwarg flag and fix up f5c904c2a9
(cherry picked from commit c8d0bf0156)
2020-03-28 04:01:15 +09:00
Yusuke Endoh
aeda3a7f03 Suppress "assigned but unused variable" warnings
(cherry picked from commit 65dd50fc25)
2020-03-27 14:57:47 +09:00
Nobuyoshi Nakada
004c298738 Allow newlines inside braced pattern
(cherry picked from commit f5c904c2a9)
2020-03-27 14:57:42 +09:00
Kazuki Tsujimoto
93aaa0bcce Allow trailing comma in hash pattern
(cherry picked from commit d25a4f413d)
2020-03-27 14:57:36 +09:00
Nobuyoshi Nakada
5ccf57f23e Make RbConfig::CONFIG values mutable [Bug #16738]
As `RbConfig.expand` modifies the argument and involved `CONFIG`
values, its values should be mutable.

(cherry picked from commit 4adb2d655d)
2020-03-27 14:51:35 +09:00
Hiroshi SHIBATA
7b51338013 Merge bundler-2.1.4 2020-03-27 14:43:20 +09:00
git
572021c6e4 * 2020-03-26 [ci skip] 2020-03-26 23:51:12 +09:00
Yusuke Endoh
c9a7643a7e test/openssl/test_ssl.rb: ignore SSLError when the connection is closed
"test_close_after_socket_close" checks if ssl.close is no-op even after
the wrapped socket is closed.  The test itself is fair, but the other
endpoint that is reading the SSL connection may fail with SSLError:
"SSL_read: unexpected eof while reading" in some environments:

60085389 (MinGW)
20200321T034442Z.fail.html.gz
```
  1) Failure:
OpenSSL::TestSSL#test_close_after_socket_close [D:/a/ruby/ruby/src/test/openssl/utils.rb:299]:
exceptions on 1 threads:
SSL_read: unexpected eof while reading
```

This changeset rescues and ignores the SSLError in the test.

(cherry picked from commit be76e86e69)
2020-03-26 22:17:08 +09:00
Koichi Sasada
897d4e31b0 check ar_table first.
RHASH_AR_TABLE_SIZE() has assertion that it is a ar_talbe.
The last commit breaks this assumption so check ar_table first.

(cherry picked from commit c3584dfacc)
2020-03-26 21:18:26 +09:00
Koichi Sasada
ab6f78bc92 check ar_table after #hash call
ar_table can be converted to st_table just after `ar_do_hash()`
function which calls `#hash` method. We need to check
the representation to detect this mutation.
[Bug #16676]

(cherry picked from commit 4c019f5a62)
2020-03-26 21:18:26 +09:00
Koichi Sasada
e4efca87ba check flags passed to rb_nogvl()
RB_NOGVL_UBF_ASYNC_SAFE is wrongly specified because flags
is not checked.
[Bug #15499] 23444302

(cherry picked from commit ff98931dac)
2020-03-26 21:18:26 +09:00
Alan Wu
2a3027b7b5 Add missing write barrier for Hash#transform_values{,!}
21994b7fd6 removed the write barrier that
was present in rb_hash_aset(). Re-insert it to not crash during GC.

[Bug #16689]

(cherry picked from commit 713dc619f5)
2020-03-26 21:18:25 +09:00
Nobuyoshi Nakada
95c3bb6c42 Do not make disabled directories at installation [Bug #12392]
(cherry picked from commit 8a6ba10f9d)
2020-03-26 21:18:25 +09:00