Граф коммитов

13139 Коммитов

Автор SHA1 Сообщение Дата
卜部昌平 a19228f878 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-01-24 10:49:35 +09:00
卜部昌平 50925b6409 reroute musl unistd.h weirdness
Musl is (of course) not glibc.  Its confstr(3) does not understand
_CS_GNU_LIBC_VERSION.  That's fair.  Problem is, its unistd.h has that
constant defined for unknown reason.  We cannot blindly say the libc is
glibc by looking at it.  Instead we have to kick it, then see if it
quacks like a duck.

See https://git.musl-libc.org/cgit/musl/tree/include/unistd.h
2020-01-24 10:49:35 +09:00
卜部昌平 3b9f36d6c6 pass appropriate libc path
The same as https://github.com/ruby/ruby/pull/2686, but for musl libc.
Musl is not named as libc.so.6 so the `ldd` hack implemented some lines
below does not work.
2020-01-24 10:49:35 +09:00
Jeremy Evans f8a8f05512 Remove empty keyword splats when calling even when using ruby2_keywords
Keeping empty keyword splats for ruby2_keywords methods was
necessary in 2.7 to prevent the final positional hash being
treated as keywords.  Now that keyword argument separation
has been committed, the final positional hash is never
treated as keywords, so there is no need to keep empty
keyword splats when using ruby2_keywords.
2020-01-23 09:30:29 -08:00
Benoit Daloze 0ea759eac9 Add more direct test for pp with a ruby2_keywords Hash 2020-01-23 10:59:26 +01:00
Yuta Iwama be6931f7f7 Add #verify_hostname= and #verify_hostname to skip hostname verification (#2858)
According to https://github.com/ruby/openssl/pull/60,

> Currently an user who wants to do the hostname verification needs to
call SSLSocket#post_connection_check explicitly after the TLS connection
is established.

if an user who wants to skip the hostname verification,
SSLSocket#post_connection_check doesn't need to be called

https://bugs.ruby-lang.org/issues/16555
2020-01-23 17:23:17 +09:00
aycabta 890200e85e Check DONT_RUN_RELINE_TEST envvar 2020-01-23 13:35:45 +09:00
aycabta 0d3e4b8a79 Use omit instead of skip 2020-01-23 13:31:19 +09:00
aycabta f09c1cf0e9 Skip a test that uses assert_ruby_status if it doesn't exist 2020-01-23 13:31:19 +09:00
aycabta a737f0cea5 Stop using minitest dependent methods 2020-01-23 13:31:19 +09:00
Jeremy Evans 28d31ead34 Fix pp when passed a empty ruby2_keywords-flagged hash as array element
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]
2020-01-22 10:27:02 -08:00
Lars Kanis b0ca1fc21b 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.
2020-01-21 21:26:58 +09:00
aycabta 2943ebd240 [ruby/reline] Implement vi_change_meta
https://github.com/ruby/reline/commit/8538e0e10f
2020-01-21 09:52:32 +09:00
Kenta Murata 51a8055d7d [ruby/irb] Add newline_before_multiline_output
https://github.com/ruby/irb/commit/9eb1801a66
2020-01-21 09:51:16 +09:00
aycabta 3b407abe9b [ruby/reline] Implement vi_prev_char and vi_to_prev_char
https://github.com/ruby/reline/commit/0ad3ee63fa
2020-01-20 19:13:19 +09:00
aycabta b17797a694 [ruby/reline] Implement vi_to_next_char
https://github.com/ruby/reline/commit/066ecb0a21
2020-01-20 19:13:19 +09:00
Nobuyoshi Nakada 2f1081a451
Sort globbed results by default [Feature #8709]
Sort the results which matched single wildcard or character set in
binary ascending order, unless `sort: false` is given.  The order
of an Array of pattern strings and braces are not affected.
2020-01-19 14:46:01 +09:00
Ryuta Kamizono af6563f024 Fix typo s/test_ruby2_keywords_hash!/test_ruby2_keywords_hash/
In #2818, `Hash.ruby2_keywords!` has renamed to `Hash.ruby2_keywords_hash`.
2020-01-19 13:06:27 +09:00
Nobuyoshi Nakada 979b32d76b
Removed useless sorts of lists generated from literals 2020-01-18 18:46:19 +09:00
Charles Oliver Nutter 569f56e0f7 [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.

https://github.com/ruby/io-console/commit/e5951aa34c
2020-01-18 00:15:00 +09:00
Yusuke Endoh 7cfe93c028 hash.c: Add a feature to manipulate ruby2_keywords flag
It was found that a feature to check and add ruby2_keywords flag to an
existing Hash is needed when arguments are serialized and deserialized.
It is possible to do the same without explicit APIs, but it would be
good to provide them as a core feature.

https://github.com/rails/rails/pull/38105#discussion_r361863767

Hash.ruby2_keywords_hash?(hash) checks if hash is flagged or not.
Hash.ruby2_keywords_hash(hash) returns a duplicated hash that has a
ruby2_keywords flag,

[Bug #16486]
2020-01-17 17:20:38 +09:00
Yusuke Endoh b23fd59cbb marshal.c: Support dump and load of a Hash with the ruby2_keywords flag
It is useful for a program that dumps and load arguments (like drb).
In future, they should deal with both positional arguments and keyword
ones explicitly, but until ruby2_keywords is deprecated, it is good to
support the flag in marshal.

The implementation is similar to String's encoding; it is dumped as a
hidden instance variable.

[Feature #16501]
2020-01-17 17:20:19 +09:00
Nobuyoshi Nakada c98c492578
Added test for f38b3e8c70 2020-01-17 16:56:53 +09:00
Kenta Murata 5275d8bf4c
rb_rational_raw: convert num and den by to_int 2020-01-17 10:57:51 +09:00
Kenta Murata 47465ab1cc
rb_rational_raw: make a denominator always positive 2020-01-17 10:57:21 +09:00
aycabta 800c2a8e4c Implement vi_insert_at_bol and vi_add_at_eol 2020-01-17 01:37:01 +09:00
aycabta ec0b366a5c Add tests for vi_insert and vi_add 2020-01-17 01:37:01 +09:00
Nobuyoshi Nakada c171ab23e3
Separate numbered parameter scope in eval
[Feature #16432]
2020-01-16 18:38:48 +09:00
Nobuyoshi Nakada f38b3e8c70
Fixed the location of args node with numbered parameter 2020-01-16 18:34:31 +09:00
Nobuyoshi Nakada fce54a5404
Fix `String#partition`
Split with the matched part when the separator matches the empty
part at the beginning.  [Bug #11014]
2020-01-16 15:36:38 +09:00
Nobuyoshi Nakada 4f19666e8b
`Regexp` in `MatchData` can be `nil`
`String#sub` with a string pattern defers creating a `Regexp`
until `MatchData#regexp` creates a `Regexp` from the matched
string.  `Regexp#last_match(group_name)` accessed its content
without creating the `Regexp` though.  [Bug #16508]
2020-01-16 11:32:11 +09:00
Jean Boussier 98ef38ada4 Freeze Regexp literals
[Feature #8948] [Feature #16377]

Since Regexp literals always reference the same instance,
allowing to mutate them can lead to state leak.
2020-01-15 10:38:47 +09:00
aycabta f8ea2860b0 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.
2020-01-14 15:40:38 +09:00
Ben c94025b630 [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
```

https://github.com/ruby/irb/commit/80c69c8272
2020-01-14 15:40:38 +09:00
Ben 9994eb8a5e [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
```

https://github.com/ruby/irb/commit/7dc8af01e0
2020-01-14 15:40:38 +09:00
John Hawthorn 91601dcc6a Simplify obj2ubits checks
If this value is less than zero, then the mask check is guaranteed to
fail as well, so we might as well rely on that.
2020-01-13 13:58:23 -08:00
Hiroshi SHIBATA 83240f315a Make rss library to the bundle gems
[Feature #16485][ruby-core:96683]
2020-01-12 12:28:29 +09:00
Hiroshi SHIBATA c3ccf23d58 Make rexml library to the bundle gems
[Feature #16485][ruby-core:96683]
2020-01-12 12:28:29 +09:00
Nobuyoshi Nakada eb737916b1
Warn when :newline precedes other newline options 2020-01-11 10:42:22 +09:00
Nobuyoshi Nakada 8bb24712de
Added assertions for newline decorators 2020-01-11 10:42:21 +09:00
Nobuyoshi Nakada 1b4d406e3a
Hash#transform_values should return a plain new Hash
[Bug #16498]
2020-01-10 21:44:38 +09:00
Nobuyoshi Nakada b369f5e8a2
Fixed up 0eeed5bcc5
`Binding#source_location` returns the `__FILE__` when created, and
may not be an absolute or real path.  And in the `eval` context
with an explicit file name, `__dir__` also returns that name.
On the other hand, `__FILE__` in `require`d script file has been
expanded at searching the library.
2020-01-09 10:13:08 +09:00
Kazuhiro NISHIYAMA beb59c3b45
Add GC guard
Try to fix infrequent error:

https://rubyci.org/logs/rubyci.s3.amazonaws.com/solaris10-sunc/ruby-master/log/20200108T010004Z.fail.html.gz
```
  1) Error:
DRbTests::TestDRbSSLCore#test_02_basic_object:
RangeError: "348" is recycled object
    (drbssl://localhost:58371) /export/home/users/chkbuild/cb-sunc/tmp/build/20200108T010004Z/ruby/lib/drb/drb.rb:366:in `_id2ref'
    (drbssl://localhost:58371) /export/home/users/chkbuild/cb-sunc/tmp/build/20200108T010004Z/ruby/lib/drb/drb.rb:366:in `to_obj'
    (drbssl://localhost:58371) /export/home/users/chkbuild/cb-sunc/tmp/build/20200108T010004Z/ruby/lib/drb/drb.rb:1537:in `to_obj'
    (drbssl://localhost:58371) /export/home/users/chkbuild/cb-sunc/tmp/build/20200108T010004Z/ruby/lib/drb/drb.rb:1856:in `to_obj'
    (drbssl://localhost:58371) /export/home/users/chkbuild/cb-sunc/tmp/build/20200108T010004Z/ruby/lib/drb/drb.rb:620:in `recv_request'
    (drbssl://localhost:58371) /export/home/users/chkbuild/cb-sunc/tmp/build/20200108T010004Z/ruby/lib/drb/drb.rb:931:in `recv_request'
    (drbssl://localhost:58371) /export/home/users/chkbuild/cb-sunc/tmp/build/20200108T010004Z/ruby/lib/drb/drb.rb:1665:in `init_with_client'
    (drbssl://localhost:58371) /export/home/users/chkbuild/cb-sunc/tmp/build/20200108T010004Z/ruby/lib/drb/drb.rb:1677:in `setup_message'
    (drbssl://localhost:58371) /export/home/users/chkbuild/cb-sunc/tmp/build/20200108T010004Z/ruby/lib/drb/drb.rb:1641:in `perform'
    (drbssl://localhost:58371) /export/home/users/chkbuild/cb-sunc/tmp/build/20200108T010004Z/ruby/lib/drb/drb.rb:1734:in `block (2 levels) in main_loop'
    (drbssl://localhost:58371) /export/home/users/chkbuild/cb-sunc/tmp/build/20200108T010004Z/ruby/lib/drb/drb.rb:1730:in `loop'
    (drbssl://localhost:58371) /export/home/users/chkbuild/cb-sunc/tmp/build/20200108T010004Z/ruby/lib/drb/drb.rb:1730:in `block in main_loop'
    /export/home/users/chkbuild/cb-sunc/tmp/build/20200108T010004Z/ruby/test/drb/drbtest.rb:163:in `test_02_basic_object'
```
2020-01-08 12:26:48 +09:00
Yusuke Endoh e92bebb0c5 Suppress some warnings
```
.../ruby/test/ruby/test_keyword.rb:3509: warning: assigned but unused variable - bug8993
.../ruby/test/ruby/test_object.rb:83: warning: assigned but unused variable - f
.../ruby/test/ruby/test_object.rb:95: warning: method redefined; discarding old initialize_clone
.../ruby/test/ruby/test_object.rb:84: warning: previous definition of initialize_clone was here
```
2020-01-07 01:33:30 +09:00
aycabta 7392083c2f Support history-size in .inputrc correctly 2020-01-06 21:50:48 +09:00
Koichi Sasada ce072fe568 script_compiled event on compile error.
script_compiled event for TracePoint should not be invoked on
compile error (SyntaxError) because it is not "compiled".
[Bug #16459]
2020-01-06 11:36:51 +09:00
aycabta 439e1ccd08 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.
2020-01-06 01:20:24 +09:00
Jeremy Evans 04eb7c7e46 Call initialize_clone with freeze: false if clone called with freeze: false
This makes it possible to initialize_clone to correctly not freeze
internal state if the freeze: false keyword is passed to clone.

If clone is called with freeze: true or no keyword, do not pass
a second argument to initialize_clone to keep backwards
compatibility.

This makes it so that external libraries that override
initialize_clone but do not support the freeze keyword will fail
with ArgumentError if passing freeze: false to clone.  I think that
is better than the current behavior, which succeeds but results in
an unfrozen object with frozen internals.

Fix related issues in set and delegate in stdlib.

Fixes [Bug #14266]
2020-01-03 20:13:09 -08:00
Jeremy Evans 0eeed5bcc5 Make eval(code, binding) use (eval) as __FILE__ and 1 as __LINE__
This removes the warning that was added in
3802fb92ff, and switches the behavior
so that the eval does not use the binding's __FILE__ and __LINE__
implicitly.

Fixes [Bug #4352]
2020-01-03 20:13:09 -08:00
Jeremy Evans ff96565686 Update tests for full keyword argument separation 2020-01-02 18:40:45 -08:00
Jeremy Evans beae6cbf0f Fully separate positional arguments and keyword arguments
This removes the warnings added in 2.7, and changes the behavior
so that a final positional hash is not treated as keywords or
vice-versa.

To handle the arg_setup_block splat case correctly with keyword
arguments, we need to check if we are taking a keyword hash.
That case didn't have a test, but it affects real-world code,
so add a test for it.

This removes rb_empty_keyword_given_p() and related code, as
that is not needed in Ruby 3.  The empty keyword case is the
same as the no keyword case in Ruby 3.

This changes rb_scan_args to implement keyword argument
separation for C functions when the : character is used.
For backwards compatibility, it returns a duped hash.
This is a bad idea for performance, but not duping the hash
breaks at least Enumerator::ArithmeticSequence#inspect.

Instead of having RB_PASS_CALLED_KEYWORDS be a number,
simplify the code by just making it be rb_keyword_given_p().
2020-01-02 18:40:45 -08:00
Nobuyoshi Nakada 34bc15c86b
Check Module#ruby2_keywords arity
It is considered a mistake, because calling this method with no
arguments has no effect.
2020-01-02 10:41:24 +09:00
aycabta 049292e302 Add load path and require for ruby/ruby 2020-01-01 02:04:41 +09:00
aycabta 66e6055c11 [ruby/irb] Fix lib name of OpenStruct
https://github.com/ruby/irb/commit/1f3a84ab6b
2020-01-01 01:38:37 +09:00
aycabta 9deb942715 Add "require 'openstruct'" what is forgotten 2019-12-31 23:32:24 +09:00
Ben a118bb805f [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>.
```

https://github.com/ruby/irb/commit/752d5597ab
2019-12-31 23:32:24 +09:00
Nobuyoshi Nakada 0cf75e3850 Split test_nomethod_error.rb 2019-12-31 19:43:36 +09:00
Nobuyoshi Nakada a580a3757b Split test_name_error.rb 2019-12-31 19:43:36 +09:00
Nobuyoshi Nakada ee4ead8098 Split test_frozen_error.rb 2019-12-31 19:43:36 +09:00
Nobuyoshi Nakada 8caeef7c1d Fix the exception to be raised
`NoMethodError` has been raised instead of `FrozenError`.
2019-12-31 19:43:36 +09:00
MSP-Greg d912393e09 text/readline/test_readline.rb - fix skip on Reline (#2743)
TestRelineAsReadline#test_input_metachar passes on MinGW
2019-12-31 00:29:58 -08:00
MSP-Greg eb2b425821 MinGW on Actions (#2791)
* MinGW - skip spec in spec/ruby/optional/capi/thread_spec.rb

C-API Thread function rb_thread_call_without_gvl
      -- runs a C function with the global lock unlocked and unlocks IO with the generic RUBY_UBF_IO

stops/freezes spec tests

See https://bugs.ruby-lang.org/issues/16265

* MinGW - skip test test/resolv/test_dns.rb

Test times out in CI (both AppVeyor & Actions), cannot repo locally

* MinGW - skip test test/ruby/test_thread_queue.rb

* Add Actions mingw.yml
2019-12-30 23:19:31 -08:00
Alan Wu 99c7b0b7ea
Decide lambdaness of (f << g) using g (#2729)
* Deciding lambdaness of (f << g) using g

* Use version guards for spec changes
2019-12-30 17:47:58 -05:00
Nobuyoshi Nakada 31e2f03512 [ruby/io-console] Enable only interrupt bits on `intr: true`
https://github.com/ruby/io-console/commit/baaf929041
2019-12-29 16:26:22 +09:00
aycabta 4db898284d Add test_completion_with_indent_and_completer_quote_characters
This is for 8a705245e5.
2019-12-27 16:07:52 +09:00
Nobuyoshi Nakada b25e27277d
Transform hash keys by a hash [Feature #16274] 2019-12-26 15:50:34 +09:00
Yusuke Endoh 81e377023c range.c: Range#min with a beginless one now raise an explicit exception
[Bug #16450]
2019-12-25 13:36:23 +09:00
aycabta 622e47a1db ^D on non-empty line in vi mode behaves like Enter 2019-12-25 09:34:13 +09:00
Nobuyoshi Nakada a3c5dbf291
Scale sleeping times to wait for the OS operations 2019-12-24 18:53:14 +09:00
aycabta 42e2a322f1 The delete-char-or-list shows completed list when called at end of line
It doesn't behave the same as the delete-char.
2019-12-24 18:34:43 +09:00
Nobuyoshi Nakada 81504e83e7
Synchronize with a Queue instead of sleeping 2019-12-24 15:48:08 +09:00
Koichi Sasada 47ad57f245 Revert "Scale sleeping times"
This reverts commit e57d619421.

Test fails:
http://ci.rvm.jp/results/trunk-gc-asserts@ruby-sky1/2518563
http://ci.rvm.jp/results/trunk-gc_compact@silicon-docker/2518533
2019-12-24 15:38:46 +09:00
Nobuyoshi Nakada e57d619421
Scale sleeping times 2019-12-24 14:56:17 +09:00
Nobuyoshi Nakada e954be14d0
Get rid of false positive misspellings
[Bug #16437]
2019-12-24 10:33:32 +09:00
aycabta adc9b3ca7f [ruby/rdoc] Support newline in the middle of constant definition
https://github.com/ruby/rdoc/commit/74d3984324
2019-12-24 07:58:53 +09:00
aycabta e50e552693 [ruby/rdoc] Treat Proc#call syntax sugar for constant correctly
https://github.com/ruby/rdoc/commit/957d041ae0
2019-12-24 07:58:53 +09:00
Marc-Andre Lafortune 819b604037 Reword keyword arguments warning messages to convey these are deprecation warnings 2019-12-23 16:47:33 -05:00
Koichi Sasada a96f8cecc2 ObjectSpace._id2ref should check liveness.
objspace->id_to_obj_tbl can contain died objects because of lazy
sweep, so that it should check liveness.
2019-12-23 15:04:56 +09:00
Yuki Nishijima 672a61b97f Port dd1dd86e6c 2019-12-23 00:47:41 -05:00
NAKAMURA Usaku 204dc3f39f Revert "Should return "." for File.extname("file.") also on Windows"
We want to introduce consistency and better compatibility with unixen,
but the Windows APIs doues not have consistency fundamentally and
we can not found any logical way...

This reverts commit 61aff0cd18.
2019-12-23 11:54:25 +09:00
Koichi Sasada cf59e1476d fix a thread test.
* Use Queue for synchronization.
* Don't use `sleep 0.2` and use `th.join` because created thread
  can raise an exception after 0.2 seconds.
2019-12-22 06:29:52 +09:00
Yusuke Endoh 75acbd5f00 compile.c: avoid newarraykwsplat for arguments
`foo(*rest, post, **empty_kw)` is compiled like
`foo(*rest + [post, **empty_kw])`, and `**empty_kw` is removed by
"newarraykwsplat" instruction.
However, the method call still has a flag of KW_SPLAT, so "post" is
considered as a keyword hash, which caused a segfault.
Note that the flag cannot be removed if "empty_kw" is not always empty.

This change fixes the issue by compiling arguments with "newarray"
instead of "newarraykwsplat".

[Bug #16442]
2019-12-22 03:35:29 +09:00
NAKAMURA Usaku 61aff0cd18 Should return "." for File.extname("file.") also on Windows
But not changes another cases, such as "file.rb."
[Bug #15267]
2019-12-22 02:42:09 +09:00
Alan Wu 85a337f986 Kernel#lambda: return forwarded block as non-lambda proc
Before this commit, Kernel#lambda can't tell the difference between a
directly passed literal block and one passed with an ampersand.

A block passed with an ampersand is semantically speaking already a
non-lambda proc. When Kernel#lambda receives a non-lambda proc, it
should simply return it.

Implementation wise, when the VM calls a method with a literal block, it
places the code for the block on the calling control frame and passes a
pointer (block handler) to the callee. Before this commit, the VM
forwards block arguments by simply forwarding the block handler, which
leaves the slot for block code unused when a control frame forwards its
block argument. I use the vacant space to indicate that a frame has
forwarded its block argument and inspect that in Kernel#lambda to detect
forwarded blocks.

This is a very ad-hoc solution and relies *heavily* on the way block
passing works in the VM. However, it's the most self-contained solution
I have.

[Bug #15620]
2019-12-21 09:08:52 -05:00
Yusuke Endoh ea405ee8ed test/ruby/test_pattern_matching.rb: suppress "unused variable" warning 2019-12-21 10:06:14 +09:00
Nobuyoshi Nakada 484c1be895
Added `-W:experimental` command line option
[Feature #16420]
2019-12-20 23:51:17 +09:00
Nobuyoshi Nakada 07e595fdbd
Added `experimental` warning category
[Feature #16420]
2019-12-20 23:48:15 +09:00
Nobuyoshi Nakada a84ad24386
Added -W: command line option
To manage `Warning[category]` flags.  Only `-W:deprecated` and
`-W:no-deprecated` are available now.  [Feature #16345]
2019-12-20 23:05:22 +09:00
Yusuke Endoh f7aee58498 vm_args.c: rephrase the warning message of keyword argument separation
(old)
test.rb:4: warning: The last argument is used as the keyword parameter
test.rb:1: warning: for `foo' defined here; maybe ** should be added to the call?

(new)
test.rb:4: warning: The last argument is used as keyword parameters; maybe ** should be added to the call
test.rb:1: warning: The called method `foo' is defined here
2019-12-20 19:41:15 +09:00
Nobuyoshi Nakada 2b2030f265
Refined the warning message for $, and $;
[Bug #16438]
2019-12-20 15:09:23 +09:00
Nobuyoshi Nakada 7a94225e7d
Refined the warning message for numbered-parameter like variables
[Bug #16438]
2019-12-20 14:58:51 +09:00
Nobuyoshi Nakada a8bddb3a18
Refined the warning message for numbered-parameter like variables
[Bug #16438]
2019-12-20 14:34:32 +09:00
Nobuyoshi Nakada 435a4ca2a3
Makes the receiver to FrozenError.new a keyword parameter
[Feature #16419]
2019-12-20 14:18:20 +09:00
Nobuyoshi Nakada e68999c82c
Fixed misspellings
Fixed misspellings reported at [Bug #16437], for default gems.
2019-12-20 12:19:45 +09:00
Hiroshi SHIBATA e672494cd7
Merge RubyGems 3.1.2 2019-12-20 11:50:32 +09:00
Nobuyoshi Nakada db16629008
Fixed misspellings
Fixed misspellings reported at [Bug #16437], only in ruby and rubyspec.
2019-12-20 09:32:42 +09:00
Nobuyoshi Nakada 2898367b3a
Warn also numbered parameter like methods 2019-12-20 08:18:19 +09:00
Nobuyoshi Nakada 27ddb6e998
Warn also numbered parameter like parameters
[Feature #16433]
2019-12-20 01:25:34 +09:00
Nobuyoshi Nakada 7aa8a78674
Manage deprecation warnings about keyword argument 2019-12-19 09:52:17 +09:00
Nobuyoshi Nakada 9bf9de3d9d
Made the warning for deprecated constants follow the category flag 2019-12-19 09:52:16 +09:00
Nobuyoshi Nakada fcd8bafd08
Use a temporary file for chown test
Errno::EROFS may occur when the source tree is placed in a
read-only filesystem.
2019-12-18 13:35:58 +09:00
Nobuyoshi Nakada c147eeff7c [ruby/io-console] Skip Interrupt test on Linux
Hangs up only in ruby/ruby on Travis-CI.

https://github.com/ruby/io-console/commit/de39aa6dd6
2019-12-18 13:30:52 +09:00
Nobuyoshi Nakada 77e3078ede [ruby/io-console] Set raw mode strictly same as cfmakeraw
* Default VMIN and VTIME to minimum input.
* Disable parity check bits explicitly.
* Disable all bits for flow control on input.

Co-Authored-By: NARUSE, Yui <naruse@airemix.jp>

https://github.com/ruby/io-console/commit/5ce201a686
2019-12-18 10:33:05 +09:00
Nobuyoshi Nakada bcec03af05
Revert "Skip interruptible raw mode test on Travis-CI"
This reverts commit 65731a1330.
2019-12-18 00:08:21 +09:00
Nobuyoshi Nakada 07ed8f2f91 [ruby/io-console] Skip interrupt
https://github.com/ruby/io-console/commit/8ed5a2bcc3
2019-12-18 00:08:04 +09:00
Nobuyoshi Nakada 905a926ea8 [ruby/io-console] Timeout in the child process
https://github.com/ruby/io-console/commit/b8411689a5
2019-12-17 23:55:24 +09:00
Nobuyoshi Nakada 4b7d27ca0d [ruby/io-console] Use IO.console instead of STDIN
https://github.com/ruby/io-console/commit/9e3ec5b936
2019-12-17 23:55:22 +09:00
Nobuyoshi Nakada 65731a1330
Skip interruptible raw mode test on Travis-CI 2019-12-17 17:18:42 +09:00
Nobuyoshi Nakada 9421c78041
[ruby/logger] Fixed leaked tempfile
https://github.com/ruby/logger/commit/fb3eff153f
2019-12-17 14:01:40 +09:00
Nobuyoshi Nakada 81eb2d16ef
[ruby/io-console] Disable implementation-defined special control characters
In raw mode with interrupt enabled.

https://github.com/ruby/io-console/commit/e9e8e3ff17
2019-12-17 13:55:04 +09:00
Nobuyoshi Nakada ec89a0f803
[ruby/io-console] Added the test for intr option
https://github.com/ruby/io-console/commit/4f01db102d
2019-12-17 13:55:04 +09:00
aycabta 64ce658ec5 Fix return condition according to the condition to skip 2019-12-17 13:30:54 +09:00
aycabta 618d091151 Support change search direction 2019-12-17 13:10:39 +09:00
aycabta a14a0244b4 Support forward-search-history by C-s 2019-12-17 13:07:19 +09:00
Nobuyoshi Nakada c687be4bc0
Added a test for [Bug #16159] 2019-12-17 11:53:30 +09:00
aycabta 95213f6df6 Check wether Readline.completion_append_character= exists 2019-12-17 05:08:09 +09:00
Yusuke Endoh bba6386d95 test/ruby/test_process.rb: suppress "unused variable" warning 2019-12-17 00:44:53 +09:00
Richard Viney 6a75a46053
Make prettyprint’s cycle detection aware of Delegator instances
Fixes [Bug #13144]

Co-Authored-By: Nobuyoshi Nakada <nobu@ruby-lang.org>
2019-12-16 23:43:49 +09:00
Yusuke Endoh 251f5d8226 Revert "lib/net/http/response.rb: support raw deflate correctly"
This reverts commit 5105240b1e.

In RFC 2616:

```
   deflate
        The "zlib" format defined in RFC 1950 [31] in combination with
        the "deflate" compression mechanism described in RFC 1951 [29].
```

So "Content-Encoding: deflate" means zlib format, not raw deflate.

[Bug #11268]
2019-12-16 23:39:10 +09:00
Yusuke Endoh 5105240b1e lib/net/http/response.rb: support raw deflate correctly
Net::HTTP had used `Zlib::Inflate.new(32 + Zlib::MAX_WBITS)` for all
content encoding (deflate, zlib, and gzip).
But the argument `32 + Zlib::MAX_WBITS` means zlib and gzip decoding
with automatic header detection, so (raw) deflate compression had not
been supported.

This change makes it support raw deflate correctly by passing an
argument `-Zlib::MAX_WBITS` (which means raw deflate) to
`Zlib::Inflate.new`.  All deflate-mode tests are fixed too.

[Bug #11268]
2019-12-16 23:20:42 +09:00
Nobuyoshi Nakada d2f04d332f Kernel#abort without arguments should print error info
[Bug #16424]
2019-12-16 14:55:59 +09:00
Nobuyoshi Nakada e8c62836a6
IO#set_encoding_by_bom should err when encoding is already set
Except for ASCII-8BIT.  [Bug #16422]
2019-12-15 23:13:16 +09:00
Kazuhiro NISHIYAMA a83c46e3fd
Add more debug info
closed server doesn't have useful info.
So call inspect before close.
And add local debug code in comment.

https://rubyci.org/logs/rubyci.s3.amazonaws.com/unstable11x/ruby-master/log/20191215T092405Z.fail.html.gz
```
  1) Failure:
IMAPTest#test_connection_closed_without_greeting [/export/home/rubyci/chkbuild-tmp/tmp/build/20191215T092405Z/ruby/test/net/imap/test_imap.rb:483]:
[Net::IMAP::Error] exception expected, not #<RuntimeError: {:e=>#<Errno::EINVAL: Invalid argument - connect(2) for [::1]:41748>, :server=>#<TCPServer:(closed)>, :port=>41748, :server_addr=>"::1"}>.
```
2019-12-15 20:09:24 +09:00
Hiroshi SHIBATA 980ddca47e
Prepare to release rubygems-3.1.0 2019-12-15 16:48:52 +09:00
Kazuhiro NISHIYAMA e2b192f7d5
rand(beginless_range) raise Errno::EDOM instead of TypeError
same as `rand(endless_range)`

Before:
```
$ ruby -e 'rand(..1)'
Traceback (most recent call last):
	2: from -e:1:in `<main>'
	1: from -e:1:in `rand'
-e:1:in `-': nil can't be coerced into Integer (TypeError)
```

After:
```
$ ruby -e 'rand(..1)'
Traceback (most recent call last):
	1: from -e:1:in `<main>'
-e:1:in `rand': Numerical argument out of domain (Errno::EDOM)
```
2019-12-15 14:47:36 +09:00
Nobuyoshi Nakada 84b873e381 [ruby/irb] Restore environment variables
https://github.com/ruby/irb/commit/236590882c
2019-12-14 00:39:53 +09:00
Hiroshi SHIBATA ab1f3d63b0
Fixed a typo 2019-12-13 22:10:28 +09:00
Hiroshi SHIBATA 2ef5f012c1
Added explicitly loading `Gem::Command` class 2019-12-13 22:00:28 +09:00
Nobuyoshi Nakada 6183addf6a Add `Warning.[]` and `Warning.[]=` 2019-12-13 20:47:07 +09:00
Hiroshi SHIBATA 82cc2843a9
Prepare to release RubyGems 3.1.0 final version. 2019-12-13 20:19:33 +09:00
aycabta c2dfc6d869 Show a menu before a document
IRB should show a menu first if a completed list has plural items. But just
shows document without menu if a completed list with plural items includes a
perfect matched item. The behavior is a bug. This commit fixes it.
2019-12-13 08:54:22 +09:00
Nobuyoshi Nakada b8d6c883b3
Improved the test for Thread#inspect [Feature #16412] 2019-12-13 08:52:07 +09:00
aycabta 69b6f8fd04 Check wether TestReadline is defined 2019-12-13 00:04:44 +09:00
Kazuhiro NISHIYAMA 68321dd1fa
Move `rescue` for debug into block of assert_raise 2019-12-12 22:05:14 +09:00
Nobuyoshi Nakada dd60856f8d
[cygwin] fix File.absolute_path? test
Paths start with the root are absolute on cygwin, regardless the
drive letter.
2019-12-12 20:53:59 +09:00
Nobuyoshi Nakada b6f25318c5
Cygwin path cannot be mapped to a UNC as-is 2019-12-12 20:53:02 +09:00
Kazuhiro NISHIYAMA c20dd2f754
Add more debug info when Errno::EINVAL
https://rubyci.org/logs/rubyci.s3.amazonaws.com/unstable11x/ruby-master/log/20191212T072406Z.fail.html.gz
2019-12-12 17:38:27 +09:00
Jeremy Evans 55b7ba3686 Make super in instance_eval in method in module raise TypeError
This makes behavior the same as super in instance_eval in method
in class.  The reason this wasn't implemented before is that
there is a check to determine if the self in the current context
is of the expected class, and a module itself can be included
in multiple classes, so it doesn't have an expected class.

Implementing this requires giving iclasses knowledge of which
class created them, so that super call in the module method
knows the expected class for super calls.  This reference
is called includer, and should only be set for iclasses.

Note that the approach Ruby uses in this check is not robust. If
you instance_eval another object of the same class and call super,
instead of an TypeError, you get super called with the
instance_eval receiver instead of the method receiver.  Truly
fixing super would require keeping a reference to the super object
(method receiver) in each frame where scope has changed, and using
that instead of current self when calling super.

Fixes [Bug #11636]
2019-12-12 15:50:19 +09:00
Hiroshi SHIBATA 53e8589c69
Import json-2.3.0 from flori/json 2019-12-12 09:14:09 +09:00
aycabta 7d991a0571 Suppress to crash IRB if completed list has nil 2019-12-12 08:40:50 +09:00
aycabta 51cc5a26df Some tests failed with before GNU Readline 6.0 on Windows 2019-12-12 03:19:09 +09:00
Jeremy Evans 0dcd3340fb
[ruby/forwardable] Make def_*_delegator return name of method defined (Fixes #10)
This restores compatibility with previous versions.  This behavior
was previously undefined, but it makes sense for the name of the
defined method to be returned.

https://github.com/ruby/forwardable/commit/a52ef3451e
2019-12-11 20:23:53 +09:00
aycabta c2f6aa4e48 The result of Readline.completion_proc should have the same encoding of Encoding.default_external 2019-12-11 19:39:37 +09:00
Koichi Sasada eb9c007053 skip continuous failure test.
On mingw this test fails and not solved long time, so skip it.
Please revert it when it solved.

https://ci.appveyor.com/project/ruby/ruby/builds/29458671/job/9nbcjnfe6p0xnxoe
2019-12-11 16:49:08 +09:00
Kazuhiro NISHIYAMA cf948a3d3f Do not load q.rb in build directory 2019-12-11 12:35:51 +09:00
Kazuhiro NISHIYAMA 1ed0212bcf Do not load files in build directory
related https://bugs.ruby-lang.org/issues/16177
2019-12-11 12:35:51 +09:00
Jeremy Evans 85e43e1dfe Fix Enumerator::Lazy#with_index
* Make it correctly handle lambdas
* Make it iterate over the block if block is given

The original implementation was flawed, based on lazy_set_method
instead of lazy_add_method.

Note that there is no implicit map when passing a block, the return
value of the block passed to with_index is ignored, just as it
is for Enumerator#with_index. Also like Enumerator#with_index,
when called with a block, the return value is an enumerator without
the index.

Fixes [Bug #16414]
2019-12-11 04:59:56 +02:00
Hiroshi SHIBATA 2a2a707829
Followed up 38722fa179 2019-12-10 21:21:19 +09:00
Jeremy Evans 0b10d46a57 [ruby/logger] Enable more timezone tests on OpenBSD
https://github.com/ruby/logger/commit/bcd7e227e8
2019-12-10 21:01:11 +09:00
Jeremy Evans 38722fa179 [ruby/logger] Raise ArgumentError for invalid shift_age
Consider 'now' and 'everytime' as valid values for the previous
behavior of rotating everytime.

Fixes Ruby Bug 15977

https://github.com/ruby/logger/commit/f92979a376
2019-12-10 20:59:02 +09:00
George Claghorn eb18cb3e47 [ruby/logger] Honor Logger#level overrides
https://github.com/ruby/logger/commit/7365c995bf
2019-12-10 20:58:25 +09:00
NARUSE, Yui af11efd377 fix ipaddr parameter of Net::HTTP.start to support proxy
54072e329c
2019-12-10 19:12:21 +09:00
Hiroshi SHIBATA 79d2a1b004
Update regression tests for 1.4.16 2019-12-10 18:41:05 +09:00
Kazuhiro NISHIYAMA 7be550d046
Stop Thread.new in `DRb::TimerIdConv::TimerHolder2#on_gc`
and add more stop_pool after stop_service
2019-12-10 12:43:49 +09:00
Yusuke Endoh c50d9dc67d test/ruby/test_keywords.rb: suppress a warning
https://rubyci.org/logs/rubyci.s3.amazonaws.com/ubuntu1604/ruby-master/log/20191210T003005Z.log.html.gz
```
.../test/ruby/test_keyword.rb:2711: warning: `*' interpreted as argument prefix
```
2019-12-10 11:26:22 +09:00
Yusuke Endoh 660388f6c5 test/net/http/test_https.rb (test_get_SNI_failure): stop proxy settings
Because the test fails under HTTP proxy settings.

https://rubyci.org/logs/rubyci.s3.amazonaws.com/solaris10-gcc/ruby-master/log/20191210T000004Z.fail.html.gz
```
  1) Failure:
TestNetHTTPS#test_get_SNI_failure [/export/home/users/chkbuild/cb-gcc/tmp/build/20191210T000004Z/ruby/test/net/http/test_https.rb:81]:
[OpenSSL::SSL::SSLError] exception expected, not #<Net::HTTPServerException: 403 "Forbidden">.
```

The new SNI feature introduced at 54072e329c may need to be improved for
HTTP proxy environment.
2019-12-10 09:41:33 +09:00
aycabta 6a22b2a091 Support completion with case-insensitive fashion
Reline performs completion in a case-insensitive fashon if
Readline.completion_case_fold or completion-ignore-case of .inputrc are set
"on".
2019-12-10 07:07:43 +09:00
Jeremy Evans f45c0dc239 Add Proc#ruby2_keywords
This allows passing keywords through a normal argument splat in a
Proc.  While needing ruby2_keywords support for methods is more
common, there is code that delegates keywords through normal
argument splats in procs, including code in Rails.  For that
reason, it makes sense to expose this for procs as well.

Internally, ruby2_keywords is not tied to methods, but iseqs,
so this just allows for setting the ruby2_keywords for the iseq
related to the proc.
2019-12-09 17:10:19 +02:00
NARUSE, Yui 54072e329c Add ipaddr optional parameter to Net::HTTP#start
to replace the address for TCP/IP connection [Feature #5180]

There're 3 layers of hostname:
* host address for TCP/IP
* TLS server name
* HTTP Host header value
To test DNS round robin or check server certificate from server local,
people sometimes want to connect server with given IP address but keep
TLS server name and HTTP Host header value.

closes [Feature #15215]
closes https://github.com/ruby/ruby/pull/1893
closes https://github.com/ruby/ruby/pull/1977
2019-12-09 20:21:49 +09:00
Hiroshi SHIBATA 1943279426
Added workaround for CoreAssertions used by ruby/logger. 2019-12-09 19:17:32 +09:00
Hiroshi SHIBATA 4b36832ba6
Merge the upstream changes for test-unit on ruby/logger.
This commits are based with:
    f067f7d1aa
    86058f420d
    02db6e8ed8
2019-12-09 19:17:32 +09:00
aycabta 07664f3aec Remove workaround encoding modification 2019-12-09 14:21:20 +09:00
Kazuhiro NISHIYAMA 8b07c122b7
Stop pool threads in test/rinda too 2019-12-09 13:46:23 +09:00
aycabta 0d63a21047 Skip completion tests for Editline 2019-12-08 18:29:39 +09:00
aycabta c38bc172be Fix encoding of completed list 2019-12-08 08:35:31 +09:00
aycabta c9b06d4a4e Add test_simple_completion for Readline 2019-12-08 08:01:27 +09:00
Yusuke Endoh ebbc77836b test/ruby/test_file_exhaustive.rb: shorten the name of temporary dir
```
  1) Error:
TestFileExhaustive#test_socket_p:
ArgumentError: too long unix socket path (109bytes given but 108bytes max)
    /export/home/users/chkbuild/cb-sunc/tmp/build/20191207T024036Z/ruby/test/ruby/test_file_exhaustive.rb:155:in `initialize'
```
2019-12-07 13:16:41 +09:00
Kazuhiro NISHIYAMA 2f6a8baac6
Test interfaces include localhost
When interfaces do not include localhost,
some other tests may fail.
2019-12-06 16:03:16 +09:00
Kazuhiro NISHIYAMA 693cba1a13
Detect started threads when require only 2019-12-06 00:12:58 +09:00
Yusuke Endoh 6477d98e49 test/lib/jit_support.rb: Update the regexp for icc
MJIT_CC is always an absolute path.
2019-12-05 23:46:42 +09:00
Yusuke Endoh 0bca34ddaa test/io/console/test_io_console.rb: add a memo for the mysterious hack 2019-12-05 16:56:08 +09:00
aycabta 264d5aff5a Change encoding of completion list...for more tests 2019-12-05 16:29:47 +09:00
Yusuke Endoh b40bb27e35 test/io/console/test_io_console.rb: Try the hack for Solaris
I'm not entirely sure why, but test_set_winsize_console gets stuck on
Solaris (and if I recall, macOS).  I found a hack for FreeBSD, so I want
to give it a try on Solaris too.
2019-12-05 15:53:29 +09:00
Takashi Kokubun 5fbb4555b4
Prefer using MJIT_CC for JIT support check
because Solaris might have CC=cc and we'd like to check full path
MJIT_CC=/opt/developerstudio12.5/bin/cc instead.
2019-12-04 22:16:08 -08:00
Koichi Sasada edb80dfe3e add additional CF info for CI env
Introduce new RUBY_DEBUG option 'ci' to inform Ruby interpreter
that an interpreter is running on CI environment.

With this option, `rb_bug()` shows more information includes
method entry information, local variables information for each
control frame.
2019-12-05 14:47:31 +09:00
Jun Aruga c0d118f41a Fix "cannot find the function: strcpy()" error on arm32 on Travis CI. (#2686)
This issue happened when `libc.so` and `libm.so` path were not found
and `ldd ruby` command also failed to print the shared dependencies
in `test/fiddle/helper.rb`.

See https://travis-ci.org/ruby/ruby/jobs/611483288#L3018
/home/travis/build/ruby/ruby/build/.ext/common/fiddle/import.rb:299:in `import_function': cannot find the function: strcpy() (Fiddle::DLError)

* Set libc6:armhf as a installing dependency explicitly.
* Remove arm32 from allow_failures.
2019-12-05 14:17:16 +09:00
aycabta 20031f8b74 Change encoding of completion list 2019-12-05 13:06:18 +09:00
Alan Wu df76f2c577
Make TracePoint.stat a singleton method again (#2726)
[Bug #16399]
2019-12-04 21:02:21 -05:00
Kazuhiro NISHIYAMA 88ee375dd6
Revert "Add debug option to check ci failures on solaris"
This reverts commit f289e3994b.
2019-12-05 09:44:09 +09:00
aycabta e3587ed849 Support disable-completion 2019-12-05 09:02:23 +09:00
aycabta ad8fbf444a Fix variable catch 2019-12-05 09:02:23 +09:00
Kazuhiro NISHIYAMA a0bc0e1ba1 Fix thread leak in drb 2019-12-04 20:57:24 +09:00
卜部昌平 00bbdf4451 implement Range#count
As matz requested in [Bug #16366].
2019-12-04 15:32:49 +09:00
Koichi Sasada c6e3db0c66 new_cond before mon_initialize
MonitorMixin#new_cond can be called before mon_initialize, so we
need to initialize `@monitor` before it.

https://bugs.ruby-lang.org/issues/16255#note-4
2019-12-04 13:36:41 +09:00
Yusuke Endoh f9e5c74cd2 compile.c: stop wrong peephole optimization when covearge is enabled
jump-jump optimization ignores the event flags of the jump instruction
being skipped, which leads to overlook of line events.

This changeset stops the wrong optimization when coverage measurement is
neabled and when the jump instruction has any event flag.

Note that this issue is not only for coverage but also for TracePoint,
and this change does not fix TracePoint.
However, fixing it fundamentally is tough (which requires revamp of
the compiler).  This issue is critical in terms of coverage measurement,
but minor for TracePoint (ko1 said), so we here choose a stopgap
measurement.

[Bug #15980] [Bug #16397]

Note for backporters: this changeset can be viewed by `git diff -w`.
2019-12-04 10:40:54 +09:00
Jeremy Evans a91637c516 Make {Method,UnboundMethod}#super_method handle clone/bind/unbind
This wasn't working previously because the iclass entry wasn't
being copied, and without an iclass entry, super_method returns
nil.

Fixes [Bug #15629]
2019-12-04 01:35:34 +02:00
NARUSE, Yui 8852fa8760 Revert "Regexp#match{?} with nil raises TypeError as String, Symbol (#1506)"
This reverts commit 2a22a6b2d8.
Revert [Feature #13083]
2019-12-04 06:40:54 +09:00
NARUSE, Yui 08074eb712 Revert "Revert nil error and adding deprecation message"
This reverts commit 452bee3ee8.
2019-12-04 06:40:54 +09:00
Jeremy Evans a029b54ec7 Make Enumerator::Chain#each treat lambdas as lambda
Previously, lambdas were converted to procs because of how
rb_block_call works.  Switch to rb_funcall_with_block, which
handles procs as procs and lambdas as lambdas.

Fixes [Bug #15613]
2019-12-03 23:18:28 +02:00
Jeremy Evans 47c97e1e84 Do not lose existing constant visibility when autoloading
This copies the private/deprecate constant visibility across the
autoload.  It still is backwards compatible with setting the
private/deprecate constant visibility in the autoloaded file.
However, if you explicitly set public constant in the autoloaded
file, that will be reset after the autoload.

Fixes [Bug #11055]
2019-12-03 17:31:49 +02:00
Nobuyoshi Nakada 14a17063a1
Fixed stack overflow [Bug #16382]
Get rid of infinite recursion in expanding a load path to the real
path while loading a transcoder.
2019-12-03 08:51:50 +09:00
aycabta a92560132b Support incremental search by last determined word
In the incremental search by C-r, search word is saved when it's determined. In
the next incremental search by C-r, if a user presses C-r again with the empty
search word, the determined previous search word is used to search.
2019-12-03 01:39:59 +09:00
Kazuhiro NISHIYAMA 1a88adcd75 Fix Leaked file descriptor in test/did_you_mean
de74d2c3b0/checks?check_suite_id=336910877#step:19:131
```
Leaked file descriptor: NameErrorExtensionTest#test_correctable_error_objects_are_dumpable: 7 : #<File:test_name_error_extension.rb>
```
2019-12-02 16:25:43 +09:00
Nobuyoshi Nakada b1c92363a7
Wait for the main thread to start reading by Queue
Otherwise, the written data to pty before the reading started may
be just lost.
2019-12-02 13:17:05 +09:00
aycabta 103b04128f Support incremental search again by C-r in incremental search 2019-12-02 04:18:22 +09:00
Takashi Kokubun b3ea0980db
Check MJIT support in one place
to fix test failure on trunk-no-mjit
https://gist.github.com/ko1/32ab982ffd7555988818773c08f97123
2019-12-01 10:53:59 -08:00
Takashi Kokubun 6bc8b4d8ea
Skip --jit-debug= test on mswin
it fails like
https://ci.appveyor.com/project/ruby/ruby/builds/29235837/job/v0apdjj4qx8afars
2019-12-01 10:51:05 -08:00
aycabta e15b0313a7 Search history to back in the middle of histories 2019-12-02 03:09:41 +09:00
aycabta 7f0d51704a Remove obsolete code 2019-12-02 00:03:59 +09:00
aycabta 8cb3f29abf The ed_search_prev_history should always search to backward 2019-12-01 23:54:57 +09:00
Takashi Kokubun 3e2753ad2e
Use build dir for testing --jit-debug
to fix failure like https://github.com/ruby/ruby/runs/327745536
2019-12-01 01:25:55 -08:00
Takashi Kokubun a19d625e66
Allow specifying arbitrary MJIT flags by --jit-debug
This is a secret feature for me. It's only for testing and any behavior
with this flag override is unsupported.

I needed this because I sometimes want to add debug options but do not
want to disable optimizations, for using Linux perf.
2019-12-01 00:58:47 -08:00
Yuki Nishijima 9914d6e992 Relax test strictness for error message from KeyError 2019-11-30 23:26:09 -05:00
Yuki Nishijima cc7455dd1e Relax test requirements for DYM's verbose formatter 2019-11-30 22:29:02 -05:00
Koichi Sasada 56faa13a1c remove spaces to pass a test.
23d7f4c5e1 breaks a test which expect
to match error message. To avoid this failure, use #strip for expect
and actual results.
2019-12-01 12:24:50 +09:00
git 23d7f4c5e1 * remove trailing spaces. [ci skip] 2019-12-01 11:08:39 +09:00
Kevin Deisz 171803d5d3 Promote did_you_mean to default gem
At the moment, there are some problems with regard to bundler + did_you_mean because of did_you_mean being a bundled gem. Since the vendored version of thor inside bundler and ruby itself explicitly requires did_you_mean, it can become difficult to load it when using Bundler.setup. See this issue: https://github.com/yuki24/did_you_mean/issues/117#issuecomment-482733159 for more details.
2019-11-30 21:08:19 -05:00
Nobuyoshi Nakada 5e0479f26a ENV.update should not call block on existing keys
[Bug #16192]
2019-11-30 18:18:20 +01:00
Hiroshi SHIBATA 32e547954f
Revert "[ruby/fileutils] Fix #install with "X" mode option"
This reverts commit eab88d20ea.

  The some CI was broken with this.
2019-11-30 17:58:39 +09:00
Nobuyoshi Nakada 5e9f08647c [ruby/webrick] Check the feature by itself, instead of the version number
https://github.com/ruby/webrick/commit/79d7922de9
2019-11-30 17:52:05 +09:00
Jeremy Evans a98632d5c2 [ruby/webrick] Enabled chunked encoding if Transfer-Encoding: chunked header is set
Patch from Leonard Garvey.

Fixes Ruby Bug 9986.

https://github.com/ruby/webrick/commit/8cff7f3995
2019-11-30 17:50:13 +09:00
Jeremy Evans c75100d004 [ruby/webrick] Allow WEBrick::HTTPServlet::CGIHandler :CGIInterpreter option to be array
This way you don't need to escape each entry.

Implements Ruby Feature 15170.

https://github.com/ruby/webrick/commit/d8086e600c
2019-11-30 17:48:15 +09:00
Nobuyoshi Nakada eab88d20ea [ruby/fileutils] Fix #install with "X" mode option
`FileUtils#install` methed raises an unexpected `TypeError`, when
called with `mode:` option which has `"X"`.

```
$ ruby -rfileutils -e 'FileUtils.install("tmp/a", "tmp/b", mode: "o+X")'
/opt/local/lib/ruby/2.7.0/fileutils.rb:942:in `directory?': no implicit conversion of File::Stat into String (TypeError)
	from /opt/local/lib/ruby/2.7.0/fileutils.rb:942:in `block (3 levels) in symbolic_modes_to_i'
	from /opt/local/lib/ruby/2.7.0/fileutils.rb:933:in `each_char'
	from /opt/local/lib/ruby/2.7.0/fileutils.rb:933:in `each'
	from /opt/local/lib/ruby/2.7.0/fileutils.rb:933:in `inject'
	from /opt/local/lib/ruby/2.7.0/fileutils.rb:933:in `block (2 levels) in symbolic_modes_to_i'
	from /opt/local/lib/ruby/2.7.0/fileutils.rb:931:in `each'
	from /opt/local/lib/ruby/2.7.0/fileutils.rb:931:in `each_slice'
	from /opt/local/lib/ruby/2.7.0/fileutils.rb:931:in `block in symbolic_modes_to_i'
	from /opt/local/lib/ruby/2.7.0/fileutils.rb:926:in `each'
	from /opt/local/lib/ruby/2.7.0/fileutils.rb:926:in `inject'
	from /opt/local/lib/ruby/2.7.0/fileutils.rb:926:in `symbolic_modes_to_i'
	from /opt/local/lib/ruby/2.7.0/fileutils.rb:973:in `fu_mode'
	from /opt/local/lib/ruby/2.7.0/fileutils.rb:883:in `block in install'
	from /opt/local/lib/ruby/2.7.0/fileutils.rb:1588:in `block in fu_each_src_dest'
	from /opt/local/lib/ruby/2.7.0/fileutils.rb:1604:in `fu_each_src_dest0'
	from /opt/local/lib/ruby/2.7.0/fileutils.rb:1586:in `fu_each_src_dest'
	from /opt/local/lib/ruby/2.7.0/fileutils.rb:877:in `install'
	from -e:1:in `<main>'
```

In spite of that `symbolic_modes_to_i` considers the `File::Stat`
`path` case at the beginning, in `"X"` case, `path` is passed to
`FileTest.directory?` method which requires a `String`.  In such
case, the mode in `path` should be examined instead.

https://github.com/ruby/fileutils/commit/2ea54ade2f
2019-11-30 17:31:35 +09:00
Nobuyoshi Nakada aab74fc938 [ruby/fileutils] Added `test_install_mode_option`
https://github.com/ruby/fileutils/commit/bb10efe104
2019-11-30 17:31:05 +09:00
Jeremy Evans 9fa0166a58 [ruby/forwardable] Fix keyword argument separation warnings on Ruby 2.7+
Do so in a way that is also compatible with previous versions.

https://github.com/ruby/forwardable/commit/b2dd340988
2019-11-30 15:53:42 +09:00
Jeremy Evans 0c273b2279 Supress class variable overtaken warning when original modules are the same
This issue was exposed by recent commits to better support including
refined modules.
2019-11-29 20:32:03 +02:00
Nobuyoshi Nakada d1ef4fd08e
Make single line pattern matching void expression
Instead of returning `nil`, raise a syntax error if its value is
used.  [Feature #16355]
2019-11-30 00:15:29 +09:00
Koichi Sasada 36da0b3da1 check interrupts at each frame pop timing.
Asynchronous events such as signal trap, finalization timing,
thread switching and so on are managed by "interrupt_flag".
Ruby's threads check this flag periodically and if a thread
does not check this flag, above events doesn't happen.

This checking is CHECK_INTS() (related) macro and it is placed
at some places (laeve instruction and so on). However, at the end
of C methods, C blocks (IMEMO_IFUNC) etc there are no checking
and it can introduce uninterruptible thread.

To modify this situation, we decide to place CHECK_INTS() at
vm_pop_frame(). It increases interrupt checking points.
[Bug #16366]

This patch can introduce unexpected events...
2019-11-29 17:47:02 +09:00
Yusuke Endoh 191ce5344e Reduce duplicated warnings for the change of Ruby 3 keyword arguments
By this change, the following code prints only one warning.

```
def foo(**opt); end
100.times { foo({kw:1}) }
```

A global variable `st_table *caller_to_callees` is a map from caller to
a set of callee methods.  It remembers that a warning is already printed
for each pair of caller and callee.

[Feature #16289]
2019-11-29 17:32:27 +09:00
Yusuke Endoh 3a87826d0c vm_method.c: add top-level ruby2_keywords
This is a top-level version of Module#ruby2_keywords.
It can be used for functions (top-level methods) that delegates
arguments.  [Feature #16364]
2019-11-29 16:51:13 +09:00
Nobuyoshi Nakada 5ad32d5504
`LoadError` is not a subclass of `StandardError` 2019-11-29 11:25:23 +09:00
Nobuyoshi Nakada f83bebdf7a
Skip useless test
`JSONGeneratorTest#test_remove_const_seg` is meaningful only for
the extension library version, but nonsense for pure ruby version.
2019-11-29 11:21:38 +09:00
git d104ebf2c4 * remove trailing spaces. [ci skip] 2019-11-29 03:11:28 +09:00
Koichi Sasada dd723771c1 fastpath for ivar read of FL_EXIVAR objects.
vm_getivar() provides fastpath for T_OBJECT by caching an index
of ivar. This patch also provides fastpath for FL_EXIVAR objects.
FL_EXIVAR objects have an each ivar array and index can be cached
as T_OBJECT. To access this ivar array, generic_iv_tbl is exposed
by rb_ivar_generic_ivtbl() (declared in variable.h which is newly
introduced).

Benchmark script:

Benchmark.driver(repeat_count: 3){|x|
  x.executable name: 'clean', command: %w'../clean/miniruby'
  x.executable name: 'trunk', command: %w'./miniruby'

  objs = [Object.new, 'str', {a: 1, b: 2}, [1, 2]]

  objs.each.with_index{|obj, i|
    rep = obj.inspect
    rep = 'Object.new' if /\#/ =~ rep
    x.prelude str = %Q{
      v#{i} = #{rep}
      def v#{i}.foo
        @iv # ivar access method (attr_reader)
      end
      v#{i}.instance_variable_set(:@iv, :iv)
    }
    puts str
    x.report %Q{
      v#{i}.foo
    }
  }
}

Result:

      v0.foo # T_OBJECT

               clean:  85387141.8 i/s
               trunk:  85249373.6 i/s - 1.00x  slower

      v1.foo # T_STRING

               trunk:  57894407.5 i/s
               clean:  39957178.6 i/s - 1.45x  slower

      v2.foo # T_HASH

               trunk:  56629413.2 i/s
               clean:  39227088.9 i/s - 1.44x  slower

      v3.foo # T_ARRAY

               trunk:  55797530.2 i/s
               clean:  38263572.9 i/s - 1.46x  slower
2019-11-29 03:11:04 +09:00
NARUSE, Yui b5fbefbf2c Added Symbol#start_with? and Symbol#end_with? method. [Feature #16348] 2019-11-28 23:49:28 +09:00
Jeremy Evans a0579f3606 Make prepending a refined module after inclusion not break refinements
After the previous commit, this was still broken. The reason it
was broken is that a refined module that hasn't been prepended to
yet keeps the refined methods in the module's method table. When
prepending, the module's method table is moved to the origin
iclass, and then the refined methods are moved from the method
table to a new method table in the module itself.

Unfortunately, that means that if a class has included the module,
prepending breaks the refinements, because when the methods are
moved from the origin iclass method table to the module method
table, they are removed from the method table from the iclass
created when the module was included earlier.

Fix this by always creating an origin class when including a
module that has any refinements, even if the refinements are
not currently used.  I wasn't sure the best way to do that.
The approach I choose was to use an object flag. The flag is
set on the module when Module#refine is called, and if the
flag is present when the module is included in another module
or class, an origin iclass is created for the module.

Fixes [Bug #13446]
2019-11-28 19:57:04 +09:00
Jeremy Evans 5069c5f521 Honor refinements for modules that prepend other modules
This previously did not work, and the reason it did not work is
that:

1) Refining a module or class that prepends other modules places
   the refinements in the class itself and not the origin iclass.

2) Inclusion of a module that prepends other modules skips the
   module itself, including only iclasses for the prepended modules
   and the origin iclass.

Those two behaviors combined meant that the method table for the
refined methods for the included module never ends up in the
method lookup chain for the class including the module.

Fix this by not skipping the module itself when the module is
included.  This requires some code rearranging in
rb_include_class_new to make sure the correct method tables and
origin settings are used for the created iclass.

As origin iclasses shouldn't be exposed to Ruby, this also
requires skipping modules that have origin iclasses in
Module#ancestors (classes that have origin iclasses were already
skipped).

Fixes [Bug #16242]
2019-11-28 19:57:04 +09:00
aycabta 4325f08086 Add require "irb" to test/irb/test_completion.rb 2019-11-28 15:32:21 +09:00
aycabta 7d75e94ea9 Fix regexp to complete complex literal
IRB completion logic always needed exponential notation for complex literal
such as 3e6i but it's bug. I fixed to support complex literal without
exponential notation such as 3i.
2019-11-28 15:22:38 +09:00
Nobuyoshi Nakada 8b4ee5d6ba
Raise `NoMatchingPatternError` when expr `in` pat doesn't match
* `expr in pattern` should raise `NoMatchingError` when unmatched
* `expr in pattern` should return `nil`. (this is unspecified, but
  this feature is experimental, at all)

[Feature #16355]
2019-11-28 13:47:14 +09:00
aycabta 2d0a1a1869 Fix ghost method line no 2019-11-28 08:19:05 +09:00
Jeremy Evans 299a13612e Don't modify rest array when using ruby2_keywords
Previously, the rest array was modified, but it turns out that is
not necessary.  Not modifying the rest array fixes cases when the
rest array is used more than once.
2019-11-27 20:03:27 +02:00
Nobuyoshi Nakada 9e01fcd0cb
[ripper] Fixed unique key check in pattern matching
Check keys
* by an internal table, instead of unstable dispatched results
* and by parsed key values, instead of escaped forms in the source
2019-11-26 22:54:35 +09:00
Nobuyoshi Nakada 26625bc33c
[ripper] Quoted label without expression must be a local variable
The difference from 0b8c73aa65 is to
add the result of `string_add` event to marking objects.

```C
			    RNODE($1)->nd_rval = add_mark_object(p, $$);
```
2019-11-25 17:42:59 +09:00
Kazuhiro NISHIYAMA 9318e1ff3e
Use realpath to try to fix failures with symlinks 2019-11-23 11:41:27 +09:00
aycabta b0614a0f96 Tracer.set_get_line_procs should support block and Proc object
Original Tracer.set_get_line_procs is implemented by
"def set_get_line_procs(p = proc)". It means that original
Tracer.set_get_line_procs supports block and Proc object.
2019-11-23 05:44:35 +09:00
aycabta 1ee010a317 Tracer.add_filter should support block and Proc object
Original Tracer.add_filter is implemented by "def add_filter(p = proc)". It
means that original Tracer.add_filter supports block and Proc object.
2019-11-23 05:43:07 +09:00
Kazuhiro NISHIYAMA d7f100226d
Skip test_validate_gemspec when tarball and git installed too
`git --version` failed as expected when git is not installed,
but unexpectedly pass when git installed and pwd is not in git working directory.
So use `git rev-parse` instead, and it failed when git installed too.
2019-11-23 01:57:19 +09:00
Jeremy Evans a9d4f2d03c Support %U/%u/%W/%w/%V/%g/%G formats in Time.strptime
Most of these formats were documented as supported, but were not
actually supported. Document that %g and %G are supported.

If %U/%W is specified without yday and mon/mday are not specified,
then Date.strptime is used to get the appropriate yday.

If cwyear is specifier without the year, or cwday and cweek are
specified without mday and mon, then use Date.strptime and convert
the resulting value to Time, since Time.make_time cannot handle
those conversions

Fixes [Bug #9836]
Fixes [Bug #14241]
2019-11-21 03:32:20 +02:00
aycabta 8f1062127e Add test/reline/test_string_processing.rb 2019-11-21 07:28:18 +09:00
aycabta 91bf3b7a77 Use singleline/multiline instead of readline/reidline 2019-11-21 02:44:35 +09:00
Nobuyoshi Nakada 9b52bacc62
Refined inspection of argument forwarding 2019-11-21 02:18:13 +09:00
manga_osyo 6723aa07e5 Change argument `Proc` to `#call` defined object.
This is the same as the behavior of Readline.
2019-11-21 00:47:37 +09:00
Kazuhiro NISHIYAMA 777973084e
Add tests of argument forwarding's parameters and inspect 2019-11-20 17:57:52 +09:00
zverok 50cc934145 Update representation (discussed on ruby tracker) 2019-11-20 13:42:56 +09:00
zverok baf482bab4 Fix test_module.rb 2019-11-20 13:42:56 +09:00
zverok 4b583cff97 Method parameters inspect
Example:

    def m(a, b=nil, *c, d:, e: nil, **rest, &block)
    end
    p method(:m)
    #=> #<Method: m(a, b=<default>, *c, d:, e: <default>, **rest, &block) ...>
2019-11-20 13:42:56 +09:00
aycabta bc0da8e3ff Generate history file path correctly when $HOME/.irbrc doesn't exist 2019-11-20 08:19:58 +09:00
Kazuki Tsujimoto ff41663403
Fix memory corruption in Enumerable#reverse_each [ruby-dev:50867] [Bug #16354] 2019-11-19 15:35:14 -06:00
Nobuyoshi Nakada 61131edba7
Revert "[ripper] Quoted label without expression must be a local variable"
This reverts commit 0b8c73aa65, which
seems breaking RVALUE consistency check.
2019-11-20 00:56:04 +09:00
Kazuki Tsujimoto 2439948bcc
Avoid needless object allocation 2019-11-19 08:53:01 -06:00
Kazuhiro NISHIYAMA 822d7ae316
Add a test
and rename from b.rb

[ruby-core:95055] [Bug #16177]
2019-11-19 17:36:47 +09:00
Nobuyoshi Nakada 0b8c73aa65
[ripper] Quoted label without expression must be a local variable 2019-11-19 17:18:27 +09:00
Nobuyoshi Nakada 473e314791 Prefer dedecated assertions 2019-11-19 02:38:56 +09:00
Takashi Kokubun 0be0d90ab0
pack is not using invokebuiltin anymore 2019-11-18 09:31:36 -08:00
Yusuke Endoh 0c0278b90a test/-ext-/string/test_fstring.rb: suppress a warning for taint 2019-11-18 09:25:49 -06:00
Koichi Sasada c3693bbaaa catch up last commit.
Array#pack uses `opt_invokebuiltin_delegate_leave` now.
2019-11-18 10:24:38 +09:00
Jeremy Evans ab42e5a486 More fixes for $SAFE/taint post merging 2019-11-18 01:00:25 +02:00
Jeremy Evans ffd0820ab3 Deprecate taint/trust and related methods, and make the methods no-ops
This removes the related tests, and puts the related specs behind
version guards.  This affects all code in lib, including some
libraries that may want to support older versions of Ruby.
2019-11-18 01:00:25 +02:00
Jeremy Evans c5c05460ac Warn on access/modify of $SAFE, and remove effects of modifying $SAFE
This removes the security features added by $SAFE = 1, and warns for access
or modification of $SAFE from Ruby-level, as well as warning when calling
all public C functions related to $SAFE.

This modifies some internal functions that took a safe level argument
to no longer take the argument.

rb_require_safe now warns, rb_require_string has been added as a
version that takes a VALUE and does not warn.

One public C function that still takes a safe level argument and that
this doesn't warn for is rb_eval_cmd.  We may want to consider
adding an alternative method that does not take a safe level argument,
and warn for rb_eval_cmd.
2019-11-18 01:00:25 +02:00
Kazuhiro NISHIYAMA 449b2b9214
Fix typos 2019-11-17 13:11:25 +09:00
aycabta fa7618e4c1 Implement em_set_mark and em_exchange_mark 2019-11-15 16:50:40 +09:00
Nobuyoshi Nakada 4d615a0c8f
`#@1` is no longer an embedded variable 2019-11-14 16:37:25 +09:00
Yusuke Endoh 48edaf8b8a test/ruby/test_proc.rb: suppress "method redefined" warnings 2019-11-14 13:00:25 +09:00
Takashi Kokubun a8f9e25ca8
Suspend many fibers test on JIT for now
https://github.com/ruby/ruby/runs/301411717

No C backtrace information and this is hard to fix immediately.
As CI doesn't provide helpful information, this should be debugged
locally or at least have more logs there.
2019-11-13 09:38:22 -08:00
Takashi Kokubun 3324bc9d17
Skip tailcall test for MJIT
failing in https://github.com/ruby/ruby/runs/300579218
2019-11-12 23:10:04 -08:00
Dylan Thacker-Smith ac112f2b5d Avoid top-level search for nested constant reference from nil in defined?
Fixes [Bug #16332]

Constant access was changed to no longer allow top-level constant access
through `nil`, but `defined?` wasn't changed at the same time to stay
consistent.

Use a separate defined type to distinguish between a constant
referenced from the current lexical scope and one referenced from
another namespace.
2019-11-13 15:36:58 +09:00
aycabta a5b6d7bca8 Suppress warnings except for when last evaluation
Co-authored-by: Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
2019-11-13 15:15:28 +09:00
Takashi Kokubun 331655cbe7
Migrate Wercker MJIT tests to Actions (#2676)
* Migrate Wercker MJIT tests to Actions

* Support pull request for testing

* Capitalize other jobs too

* Make it a command name for consistency [ci skip]

* Remove wercker.yml

* Add --jit-verbose=2 for debugging

* Install MJIT headers

* Separate install for sudo

* Trigger build
2019-11-12 21:48:05 -08:00
Nobuyoshi Nakada bf34ade7ef
Show the name `Kernel#proc` in the warning message 2019-11-12 22:58:09 +09:00
manga_osyo 3816622fbe Fixed `assert_equal` first argument to be expected. 2019-11-12 21:03:22 +09:00
osyo-manga fe45bee093 Reline#readline and Reline#readmultiline to private. 2019-11-12 21:03:22 +09:00
Nobuyoshi Nakada 3bf8ffad71
Added assertions for realpath and realdirpath
It is said that realpath(3) and realdirpath(3) on some platforms
may return a relative path.
2019-11-12 18:04:20 +09:00
Nobuyoshi Nakada fb6a489af2
Revert "Method reference operator"
This reverts commit 67c5747369.
[Feature #16275]
2019-11-12 17:24:48 +09:00
Nobuyoshi Nakada a58b4eee25
Warn on `...` at EOL 2019-11-12 17:14:14 +09:00
Jeremy Evans b38b26c62d
[ruby/bigdecimal] Remove taint checking
This removes the taint checking.  Taint support is deprecated in
Ruby 2.7 and has no effect.  I don't think removing the taint
checks in earlier ruby versions will cause any problems.

https://github.com/ruby/bigdecimal/commit/1918d466f3
2019-11-12 11:16:07 +09:00
Jeremy Evans 30fdee65d9
[ruby/psych] Remove taint support
Ruby 2.7 deprecates taint and it no longer has an effect.
The lack of taint support should not cause a problem in
previous Ruby versions.

I'm not sure if the untaint calls in deduplicate are still needed
after the removal of tainting in the parser.  If they are not
needed, they should be removed.

https://github.com/ruby/psych/commit/73c1a2b4e0
2019-11-12 10:35:47 +09:00
Koichi Sasada fd6445b7e8 Monitor#exit: check monitor ownership.
Monitor#exit should be called by only onwer Thread. However, there
is not check for it.
2019-11-12 10:07:45 +09:00
Nobuyoshi Nakada ed90ec3e0d
Clear current argument name at empty block argument [Bug #16343] 2019-11-12 09:40:18 +09:00
Yusuke Endoh 9594f57f3d test/ruby/test_require.rb: Remove the tests of require with $SAFE
The taint mechanism is decided to be removed at 2.7.  [Feature #16131]
So, this change removes the tests that expects a SecurityError when
requiring a file under $SAFE >= 1.

The reason why they should be removed in advance is because the upstream
of rubygems has already removed a call to "untaint" method, which makes
the tests fail.
2019-11-12 08:31:13 +09:00
Kazuhiro NISHIYAMA 9d3213ac85
Skip test_validate_gemspec unless git installed 2019-11-11 19:03:43 +09:00
NARUSE, Yui fd69f82675 Revert "Warn EOF char in comment"
This reverts commit 69ec3f70fa.
2019-11-11 17:37:21 +09:00
NARUSE, Yui ba5b51ca59 Revert "Elaborated EOF char message a little"
This reverts commit 6eaac7cfac.
2019-11-11 17:37:14 +09:00
Hiroshi SHIBATA 7d463e360b Merge RubyGems 3.1.0.pre3
* Fix gem pristine not accounting for user installed gems. Pull request
    #2914 by Luis Sagastume.
  * Refactor keyword argument test for Ruby 2.7. Pull request #2947 by
    SHIBATA Hiroshi.
  * Fix errors at frozen Gem::Version. Pull request #2949 by Nobuyoshi
    Nakada.
  * Remove taint usage on Ruby 2.7+. Pull request #2951 by Jeremy Evans.
  * Check Manifest.txt is up to date. Pull request #2953 by David Rodríguez.
  * Clarify symlink conditionals in tests. Pull request #2962 by David
    Rodríguez.
  * Update command line parsing to work under ps. Pull request #2966 by
    David Rodríguez.
  * Properly test `Gem::Specifications.stub_for`. Pull request #2970 by
    David Rodríguez.
  * Fix Gem::LOADED_SPECS_MUTEX handling for recursive locking. Pull request
    #2985 by MSP-Greg.
2019-11-11 16:59:49 +09:00
Nobuyoshi Nakada 6eaac7cfac
Elaborated EOF char message a little 2019-11-11 12:57:40 +09:00
Nobuyoshi Nakada 390293525a
Remove binary data at installation
And revert "Relaxed warning assertions",
6f9be8505d.
2019-11-11 12:20:03 +09:00
Nobuyoshi Nakada 6f9be8505d
Relaxed warning assertions 2019-11-11 12:09:19 +09:00
Nobuyoshi Nakada 69ec3f70fa
Warn EOF char in comment 2019-11-11 09:59:40 +09:00
Nobuyoshi Nakada ade0388894
Fixed embedded document with EOF char 2019-11-11 09:38:14 +09:00
Nobuyoshi Nakada b5dff926e7
Prefer assert_syntax_error and assert_valid_syntax 2019-11-11 09:16:00 +09:00
Takashi Kokubun a733893939
Fix uplevel of test_jit 2019-11-10 14:12:13 -08:00
Takashi Kokubun fcd9bc28e3
qsymbols and symbols should be colored as Symbol 2019-11-10 13:54:44 -08:00
Takashi Kokubun 25c53a8eec
Colorize on_symbols_beg (%I) 2019-11-10 13:41:41 -08:00
Takashi Kokubun b5996b25ae
Colorize string quotes as bold
like pry
2019-11-10 13:33:23 -08:00
Kazuki Tsujimoto 6e70fa49b1
Disallow omission of parentheses/brackets in single line pattern matching [Feature #16182] 2019-11-10 22:34:49 +09:00
Takashi Kokubun 4570284ce1
Test opt_invokebuiltin_delegate_leave in test_jit 2019-11-09 21:56:38 -08:00
Takashi Kokubun 5c168c7e7f
Support RB_BUILTIN in ISeq#to_a 2019-11-09 21:40:38 -08:00
Takashi Kokubun 0483d01f6b
Test invokebuiltin in test_jit
ISeq#to_a is commented out because it's broken now
2019-11-09 21:16:16 -08:00
Takashi Kokubun e0094df29d
Extend sleep duration for Solaris 2019-11-09 13:22:51 -08:00
David Rodríguez f48655d04d Remove unneeded exec bits from some files
I noticed that some files in rubygems were executable, and I could think
of no reason why they should be.

In general, I think ruby files should never have the executable bit set
unless they include a shebang, so I run the following command over the
whole repo:

```bash
find . -name '*.rb' -type f -executable -exec bash -c 'grep -L "^#!" $1 || chmod -x $1' _ {} \;
```
2019-11-09 21:36:30 +09:00