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

16290 Коммитов

Автор SHA1 Сообщение Дата
Nobuyoshi Nakada c0dc717c45 [Bug #19087] Disallow successive underscores in Complex string 2022-12-02 01:35:45 +09:00
Takashi Kokubun 2c939458ca
YJIT: Reorder branches for Fixnum opt_case_dispatch (#6841)
* YJIT: Reorder branches for Fixnum opt_case_dispatch

Co-authored-by: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com>
Co-authored-by: Alan Wu <alansi.xingwu@shopify.com>

* YJIT: Don't support too large values

Co-authored-by: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com>
Co-authored-by: Alan Wu <alansi.xingwu@shopify.com>
2022-12-01 10:59:56 -05:00
Nobuyoshi Nakada 5872fd6f6c [Feature #19163] Marshal-loaded Data object also should be frozen 2022-12-02 00:56:52 +09:00
Nobuyoshi Nakada a14a1a5626 [Feature #19163] Data object should be frozen 2022-12-02 00:56:52 +09:00
Samuel Williams 0436f1e15a
Introduce `Fiber#storage` for inheritable fiber-scoped variables. (#6612) 2022-12-01 23:00:33 +13:00
Nobuyoshi Nakada 9869bd1d61 [Bug #19108] Check for the encoding of pack/unpack format 2022-12-01 17:38:33 +09:00
Nobuyoshi Nakada a1d341efaf [ruby/delegate] Revert "Fix `DelegateClass` block "method redefined" warning"
https://github.com/ruby/delegate/commit/2a91436284
2022-12-01 08:08:02 +00:00
Nobuyoshi Nakada 4e68b59431 [Feature #19138] Add `SyntaxError#path` 2022-12-01 17:05:41 +09:00
Alan Wu 5752d11f1f Use RTEST and add test for GH-6832
Technically we shouldn't see Qfalse now, but RTEST also compiles down to
just one branch anyways. Pretty contrived issue, but easy to fix.
2022-11-30 16:27:39 -05:00
Takashi Kokubun 0d3fc08ff4
YJIT: Optimize rb_int_equal (#6838) 2022-11-30 16:16:11 -05:00
Yusuke Endoh ab4c7077cc Prevent segfault in String#scan with ObjectSpace.each_object
Calling `String#scan` without a block creates an incomplete MatchData
object whose `RMATCH(match)->str` is Qfalse. Usually this object is not
leaked, but it was possible to pull it by using ObjectSpace.each_object.

This change hides the internal MatchData object by using rb_obj_hide.

Fixes [Bug #19159]
2022-12-01 02:38:51 +09:00
Nobuyoshi Nakada 99cad3fccd [ruby/rdoc] Non-RD part feature has not been imported to RDoc
https://github.com/ruby/rdoc/commit/fe0159de2f
2022-12-01 02:36:20 +09:00
yui-knk 67ae3e9738 Add a test case for argument forwarding 2022-11-29 18:23:00 +09:00
Shugo Maeda 74bdf09215
Add tests for [Feature #19134]
https://bugs.ruby-lang.org/issues/19134?next_issue_id=19133&prev_issue_id=19135#note-4
2022-11-29 14:18:16 +09:00
Takashi Kokubun 129d208f9a [ruby/erb] Fix line numbers after multi-line <%#
(https://github.com/ruby/erb/pull/42)

https://github.com/ruby/erb/commit/526885923e
2022-11-29 04:56:03 +00:00
Shugo Maeda 4fc668a4f3 Allow ** in def foo(...)
[Feature #19134]
2022-11-29 11:22:09 +09:00
Yusuke Endoh f3ad68dd16 [ruby/optparse] Fix the test failure i ruby/ruby
```
$ make test-all TESTS=test/optparse/
...

[148/178] TestOptionParserDidYouMean#test_raise_unknown = 0.00 s
  1) Failure:
TestOptionParserDidYouMean#test_raise_unknown [/home/mame/work/ruby/test/optparse/test_optparse.rb:106]:
<["--bar"]> expected but was
<[]>.
```

In the old test/unit (bundled in ruby/ruby), when a test class inherits from
another test class, the child class runs all the tests defined in the parent
class.
However, it looks like the new test/unit does not do so. This is because the
test failure does not occur in ruby/optparse.

As a tentative solution, this changes the option names in TestOptionParser to
avoid the name conflict with TestOptionParserDidYouMean.

https://github.com/ruby/optparse/commit/fee86ef7a4
2022-11-28 16:20:40 +00:00
Nobuyoshi Nakada 0bfb185654 [ruby/optparse] Add `raise_unknown` flag
(https://github.com/ruby/optparse/pull/38)

https://github.com/ruby/optparse/commit/12529653cd
2022-11-28 14:24:06 +00:00
Takashi Kokubun 168b0e1f02 Make the timeout of test_system_sigpipe longer
https://github.com/ruby/ruby/actions/runs/3562236318/jobs/5983796689
2022-11-27 22:48:19 -08:00
Takashi Kokubun 880e8fd1f9 Relax a too strict timeout
Regexp tests are flaky.
http://rubyci.s3.amazonaws.com/s390x/ruby-master/log/20221128T050004Z.fail.html.gz
2022-11-27 21:48:32 -08:00
Sven Riedel e0901f46b7 [ruby/rdoc] Add `--no-skipping-tests` option
https://github.com/ruby/rdoc/commit/33925f885f
2022-11-28 04:36:29 +00:00
Xenor Chang 745dcf5326 [ruby/cgi] Loosen the domain regex to accept '.'
(https://github.com/ruby/cgi/pull/29)

* Loosen the domain regex to accept '.'

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>

https://github.com/ruby/cgi/commit/5e09d632f3
Co-authored-by: Hiroshi SHIBATA <hsbt@ruby-lang.org>
2022-11-28 04:34:11 +00:00
Takashi Kokubun 03b96319b4 Skip a broken RDoc test
http://ci.rvm.jp/results/trunk-yjit@phosphorus-docker/4309535
http://ci.rvm.jp/results/trunk-random0@phosphorus-docker/4309536
http://ci.rvm.jp/results/trunk-random1@phosphorus-docker/4309538
http://ci.rvm.jp/results/trunk-random2@phosphorus-docker/4309541
http://ci.rvm.jp/results/trunk-random3@phosphorus-docker/4309544
http://ci.rvm.jp/results/trunk-no-mjit@phosphorus-docker/4309550
http://ci.rvm.jp/results/trunk-yjit@phosphorus-docker/4309556
http://ci.rvm.jp/results/trunk-random0@phosphorus-docker/4309562
http://ci.rvm.jp/results/trunk-random1@phosphorus-docker/4309564
http://ci.rvm.jp/results/trunk-random2@phosphorus-docker/4309567
http://ci.rvm.jp/results/trunk-random3@phosphorus-docker/4309570
http://rubyci.s3.amazonaws.com/solaris10-gcc/ruby-master/log/20221127T200003Z.fail.html.gz
http://ci.rvm.jp/results/trunk-random-repeat@phosphorus-docker/4309581
http://rubyci.s3.amazonaws.com/freebsd12/ruby-master/log/20221127T203002Z.fail.html.gz
http://ci.rvm.jp/results/trunk-yjit@phosphorus-docker/4309588
2022-11-27 13:02:43 -08:00
Nobuyoshi Nakada 5b1db79129 [ruby/rdoc] Revert "Refactor `RDoc::Markup::Parser#tokenize`"
This reverts commit https://github.com/ruby/rdoc/commit/41ceae93b3bc.

https://github.com/ruby/rdoc/commit/5d2c47e8b8
2022-11-27 19:46:12 +00:00
Nobuyoshi Nakada 21977b95e2 [ruby/rdoc] Refactor `RDoc::Markup::Parser#tokenize`
Make verbatims text or newline only, and simplify `build_verbatim`.

https://github.com/ruby/rdoc/commit/41ceae93b3
2022-11-27 17:24:38 +00:00
nick evans ae3817bc61 [ruby/rdoc] Darkfish: Nest sidebar ToC as a tree of headings
This uses `<details><summary>heading</summary><ul>nested</ul></detail>`,
similar to how the classes and pages lists are now nested.

https://github.com/ruby/rdoc/commit/e57beff287
2022-11-27 17:18:16 +00:00
Stan Lo ec76c9868b [ruby/irb] Activate yamatanooroti tests on CI
(https://github.com/ruby/irb/pull/459)

* Activate yamatanooroti tests on CI

* Fix delete test

https://github.com/ruby/irb/commit/750cf4c480
2022-11-27 06:09:50 +00:00
Peter Zhu de9e2a5ac7 [ruby/net-http] Fix test for Ruby head
The error raised for broken coderanges was changed in ruby/ruby@571d21f
and the test was fixed in that commit but not ported to this repo.

ruby/net-http@e6185dda26
2022-11-26 16:06:05 -05:00
Takashi Kokubun 4ea9d7d7c2 MJIT: Remove the code to optimize shape transition
because this code crashes on railsbench. I'll try adding a repro for it
later, but I don't know shapes enough to craft it right away.
2022-11-25 15:18:34 -08:00
Alan Wu 1d64a5a7c0 YJIT: Run test-all tests without requiring RUN_OPTS
Most tests in test_yjit.rb use a sub process, so we can run them even
when the parent process is not running with YJIT. Run them so simply
running `make check` tests YJIT a bit.

[Misc #19149]
2022-11-25 17:15:24 -05:00
Alan Wu 790cf4b6d0 Fix autoload status of statically linked extensions
Previously, for statically-linked extensions, we used
`vm->loading_table` to delay calling the init function until the
extensions are required. This caused the extensions to look like they
are in the middle of being loaded even before they're required.
(`rb_feature_p()` returned true with a loading path output.) Combined
with autoload, queries like `defined?(CONST)` and `Module#autoload?`
were confused by this and returned nil incorrectly. RubyGems uses
`defined?` to detect if OpenSSL is available and failed when OpenSSL was
available in builds using `--with-static-linked-ext`.

Use a dedicated table for the init functions instead of adding them to
the loading table. This lets us remove some logic from non-EXTSTATIC
builds.

[Bug #19115]
2022-11-25 16:21:40 -05:00
Nobuyoshi Nakada 58dc9c931b [rubygems/rubygems] Stop installing everything under "lib" at the top in all tests
https://github.com/rubygems/rubygems/commit/f9772d62e1
2022-11-25 08:02:28 +00:00
Nobuyoshi Nakada ffc6c5d056 [Bug #18971] Add precheck to enumerator 2022-11-25 16:11:17 +09:00
Jeremy Evans 571d21fd4a Make String#rstrip{,!} raise Encoding::CompatibilityError for broken coderange
It's questionable whether we want to allow rstrip to work for strings
where the broken coderange occurs before the trailing whitespace and
not after, but this approach is probably simpler, and I don't think
users should expect string operations like rstrip to work on broken
strings.

In some cases, this changes rstrip to raise
Encoding::CompatibilityError instead of ArgumentError.  However, as
the problem is related to an encoding issue in the receiver, and due
not due to an issue with an argument, I think
Encoding::CompatibilityError is the more appropriate error.

Fixes [Bug #18931]
2022-11-24 18:24:42 -08:00
Nobuyoshi Nakada c6330cd32b [ruby/fileutils] [Feature #18925] Add `ln_sr` method and `relative:` option to `ln_s`
https://github.com/ruby/fileutils/commit/5116088d5c
2022-11-25 01:03:57 +00:00
Jeremy Evans 04a92a6764 Raise TypeError for endless non-numeric range include?
Beginless ranges previously raised TypeError for this case,
except for string ranges, which had unexpected behavior:

  ('a'..'z').include?('ww') # false
  (..'z').include?('ww') # previously true, now TypeError

Use of include? with endless ranges could previously result
in an infinite loop.

This splits off a range_string_cover_internal function from
range_include_internal.

Fixes [Bug #18580]
2022-11-24 15:18:44 -08:00
Takashi Kokubun 1c0c1c8098 [ruby/erb] Drop deprecated -S option from erb command
We attempted to remove things like this and reverted all of them, but I
think nobody relies on this unlike the positional arguments of
`ERB#initialize`.

https://github.com/ruby/erb/commit/92fde7e403
2022-11-24 22:49:21 +00:00
Takashi Kokubun e5a0abc5de [ruby/erb] Suppress warnings to fix ruby-head CI
(https://github.com/ruby/erb/pull/34)

There seems to be no way to fix this. It doesn't happen in an installed
directory, so it's likely a false positive and/or a bug in rubygems.

  | <internal:/home/runner/.rubies/ruby-head/lib/ruby/3.2.0+3/rubygems/core_ext/kernel_require.rb>:85: warning: <internal:/home/runner/.rubies/ruby-head/lib/ruby/3.2.0+3/rubygems/core_ext/kernel_require.rb>:85: warning: loading in progress, circular require considered harmful - /home/runner/.rubies/ruby-head/lib/ruby/3.2.0+3/bundler/setup.rb
  | 	from /home/runner/work/erb/erb/libexec/erb:0:in  `require'
  | 	from /home/runner/.rubies/ruby-head/lib/ruby/3.2.0+3/bundler/setup.rb:3:in  `<top (required)>'
  | 	from /home/runner/.rubies/ruby-head/lib/ruby/3.2.0+3/bundler/setup.rb:3:in  `require_relative'
  | 	from /home/runner/.rubies/ruby-head/lib/ruby/3.2.0+3/bundler/shared_helpers.rb:8:in  `<top (required)>'
  | 	from /home/runner/.rubies/ruby-head/lib/ruby/3.2.0+3/bundler/shared_helpers.rb:8:in  `require_relative'
  | 	from /home/runner/.rubies/ruby-head/lib/ruby/3.2.0+3/bundler/rubygems_integration.rb:3:in  `<top (required)>'
  | 	from /home/runner/.rubies/ruby-head/lib/ruby/3.2.0+3/bundler/rubygems_integration.rb:3:in  `require'
  | 	from /home/runner/.rubies/ruby-head/lib/ruby/3.2.0+3/rubygems.rb:1352:in  `<top (required)>'
  | 	from <internal:/home/runner/.rubies/ruby-head/lib/ruby/3.2.0+3/rubygems/core_ext/kernel_require.rb>:85:in  `require'
  | 	from <internal:/home/runner/.rubies/ruby-head/lib/ruby/3.2.0+3/rubygems/core_ext/kernel_require.rb>:85:in  `require'
2022-11-24 22:35:33 +00:00
Jean Boussier 656f25987c [ruby/cgi] Fix test_cgi_cookie_new_with_domain to pass on older rubies
https://github.com/ruby/cgi/commit/05f0c58048
2022-11-24 18:32:19 +00:00
Yusuke Endoh 66e5200ba4 Relax the timeout of TestRegexp#test_cache_optimization_square
It fails on riscv (QEmu)

http://rubyci.s3.amazonaws.com/debian-riscv64/ruby-master/log/20221124T000021Z.fail.html.gz
```
  1) Error:
TestRegexp#test_cache_optimization_square:
Regexp::TimeoutError: regexp match timeout
    /home/rubyci/chkbuild/tmp/build/20221124T000021Z/ruby/test/ruby/test_regexp.rb:1693:in `<main>'
    /home/rubyci/chkbuild/tmp/build/20221124T000021Z/ruby/test/ruby/test_regexp.rb:1688:in `test_cache_optimization_square'
```
2022-11-24 15:13:00 +09:00
zverok eaf2b6c439 Add Time#deconstruct_keys 2022-11-22 23:10:46 +02:00
Nobuyoshi Nakada 8c02084ac8
Use dedicated assertions for warnings 2022-11-22 14:07:21 +09:00
Nobuyoshi Nakada 77f963004f
Avoid unnecessary use of global variables 2022-11-22 13:58:56 +09:00
Nobuyoshi Nakada 58682b6980 [ruby/cgi] Relax domain label restrictions
https://github.com/ruby/cgi/commit/b46d41c363
2022-11-22 02:12:50 +00:00
Yusuke Endoh 0e75b2f2e6 [ruby/cgi] Prevent CRLF injection
Throw a RuntimeError if the HTTP response header contains CR or LF to
prevent HTTP response splitting.

https://hackerone.com/reports/1204695

https://github.com/ruby/cgi/commit/64c5045c0a
2022-11-22 02:00:11 +00:00
Nobuyoshi Nakada c05f85f373 [ruby/cgi] Check cookie name/path/domain characters
https://hackerone.com/reports/1204977

https://github.com/ruby/cgi/commit/30107a4797
2022-11-22 02:00:10 +00:00
Peter Zhu 5f95228c76 Add RVALUE_OVERHEAD and move ractor_belonging_id
This commit adds RVALUE_OVERHEAD for storing metadata at the end of the
slot. This commit moves the ractor_belonging_id in debug builds from the
flags to RVALUE_OVERHEAD which frees the 16 bits in the headers for
object shapes.
2022-11-21 11:26:26 -05:00
Nobuyoshi Nakada b7a0ce32da [Bug #19016] `SyntaxError` with parser error messages
Raise a `SyntaxError` with the parser error message, in the case
reading from a file instead of the `-e` option or standard input. So
syntax_suggest can get the message from the caught error.
2022-11-22 00:33:19 +09:00
Nobuyoshi Nakada 5b959e238e [Bug #19016] re-order error handling at cleanup
Build and store the error message with `#detailed_message` before
terminating all Ractors, then show the message later.
2022-11-22 00:33:19 +09:00
Takashi Kokubun c9fbc779a6 [ruby/irb] Add commands to start and use the debugger
(https://github.com/ruby/irb/pull/449)

* Seamlessly integrate a few debug commands

* Improve the break command support

* Utilize skip_src option if available

* Add step and delete commands

* Write end-to-end tests for each debugger command

* Add documentation

* Add backtrace, info, catch commands

https://github.com/ruby/irb/commit/976100c1c2
2022-11-21 08:46:27 +00:00
Yusuke Endoh 730b841f8d Prevent a "warning: ambiguity between regexp and two divisions" 2022-11-21 16:13:15 +09:00
yui-knk d8601621ed Enhance keep_tokens option for RubyVM::AbstractSyntaxTree parsing methods
Implementation for Language Server Protocol (LSP) sometimes needs token information.
For example both `m(1)` and `m(1, )` has same AST structure other than node locations
then it's impossible to check the existence of `,` from AST. However in later case,
it might be better to suggest variables list for the second argument.
Token information is important for such case.

This commit adds these methods.

* Add `keep_tokens` option for `RubyVM::AbstractSyntaxTree.parse`, `.parse_file` and `.of`
* Add `RubyVM::AbstractSyntaxTree::Node#tokens` which returns tokens for the node including tokens for descendants nodes.
* Add `RubyVM::AbstractSyntaxTree::Node#all_tokens` which returns all tokens for the input script regardless the receiver node.

[Feature #19070]

Impacts on memory usage and performance are below:

Memory usage:

```
$ cat test.rb
root = RubyVM::AbstractSyntaxTree.parse_file(File.expand_path('../test/ruby/test_keyword.rb', __FILE__), keep_tokens: true)

$ /usr/bin/time -f %Mkb /usr/local/bin/ruby -v
ruby 3.2.0dev (2022-11-19T09:41:54Z 19070-keep_tokens d3af1b8057) [x86_64-linux]
11408kb

# keep_tokens :false
$ /usr/bin/time -f %Mkb /usr/local/bin/ruby test.rb
17508kb

# keep_tokens :true
$ /usr/bin/time -f %Mkb /usr/local/bin/ruby test.rb
30960kb
```

Performance:

```
$ cat ../ast_keep_tokens.yml
prelude: |
  src = <<~SRC
    module M
      class C
        def m1(a, b)
          1 + a + b
        end
      end
    end
  SRC
benchmark:
  without_keep_tokens: |
    RubyVM::AbstractSyntaxTree.parse(src, keep_tokens: false)
  with_keep_tokens: |
    RubyVM::AbstractSyntaxTree.parse(src, keep_tokens: true)

$ make benchmark COMPARE_RUBY="./ruby" ARGS=../ast_keep_tokens.yml
/home/kaneko.y/.rbenv/shims/ruby --disable=gems -rrubygems -I../benchmark/lib ../benchmark/benchmark-driver/exe/benchmark-driver \
            --executables="compare-ruby::./ruby -I.ext/common --disable-gem" \
            --executables="built-ruby::./miniruby -I../lib -I. -I.ext/common  ../tool/runruby.rb --extout=.ext  -- --disable-gems --disable-gem" \
            --output=markdown --output-compare -v ../ast_keep_tokens.yml
compare-ruby: ruby 3.2.0dev (2022-11-19T09:41:54Z 19070-keep_tokens d3af1b8057) [x86_64-linux]
built-ruby: ruby 3.2.0dev (2022-11-19T09:41:54Z 19070-keep_tokens d3af1b8057) [x86_64-linux]
warming up..

|                     |compare-ruby|built-ruby|
|:--------------------|-----------:|---------:|
|without_keep_tokens  |     21.659k|   21.303k|
|                     |       1.02x|         -|
|with_keep_tokens     |      6.220k|    5.691k|
|                     |       1.09x|         -|
```
2022-11-21 09:01:34 +09:00
Nobuyoshi Nakada 701dfe4eb7
[Bug #19016] Handle syntax error in main script like other errors
So that `SyntaxError#detailed_message` will be used also in the case
exiting by such syntax error.
2022-11-20 20:00:40 +09:00
Takashi Kokubun 779917fcc0
Avoid a timeout on test_cache_optimization_exponential
The timeout seems too short for some CIs.
http://rubyci.s3.amazonaws.com/debian11-aarch64/ruby-master/log/20221120T012840Z.fail.html.gz
2022-11-19 21:58:22 -08:00
Takashi Kokubun 66ac288ae2 [ruby/irb] Push an accidentally uncommitted diff
https://github.com/ruby/irb/commit/7e9f27afd7
2022-11-20 05:38:43 +00:00
Takashi Kokubun 67034ac7e2 [ruby/irb] Deal with inconsistency with ruby/ruby
https://github.com/ruby/irb/commit/41d5012849
2022-11-20 05:34:51 +00:00
Takashi Kokubun 8512b97d27 [ruby/irb] Require missing EnvUtil
https://github.com/ruby/irb/commit/9bb1757b02
2022-11-20 05:32:11 +00:00
Takashi Kokubun fa2e0cc018 [ruby/irb] Try using a different file name
hoping to address:
https://github.com/ruby/ruby/actions/runs/3506561941/jobs/5873689640

https://github.com/ruby/irb/commit/de9a6b9d00
2022-11-20 05:31:56 +00:00
Takashi Kokubun f47251671d [ruby/irb] Require rubygems for ruby/ruby
You can't take rubygems for granted in a default gem.
https://github.com/ruby/ruby/actions/runs/3506561943/jobs/5873689466

https://github.com/ruby/irb/commit/58bb3954d0
2022-11-20 05:19:50 +00:00
Takashi Kokubun 1284baec12
Skip TestDRbSSLAry on mswin
This doesn't seem to stably work on mswin:
https://github.com/ruby/ruby/actions/runs/3505363753/jobs/5871633211

For CI stability, it generally seems like a bad idea to run druby tests
on Windows, given that it's pretty much unstable on MinGW as well.
2022-11-19 21:14:08 -08:00
Takashi Kokubun e0f0367ab5 [ruby/irb] Fix CI failure on ruby/ruby
https://github.com/ruby/irb/commit/ea8c716922
2022-11-20 05:06:07 +00:00
Stan Lo 180ed611b2 [ruby/irb] Add edit command (https://github.com/ruby/irb/pull/453)
* Add edit command

* Make find_source a public singleton method

* Add document for the edit command

* Make find_end private

* Remove duplicated private

https://github.com/ruby/irb/commit/4321674aa7
Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
2022-11-20 04:47:54 +00:00
yui-knk 082cfcfd06 Add test cases for args forwarding after rest argument 2022-11-19 10:17:16 +09:00
Alan Wu 7f269a3c2d Fix io/console test for --with-static-linked-ext
The tests looks for the .so file, which doesn't exist when the extension
is statically linked. In that situation it passes -I to ruby with
nothing after it which ate the -rio/console argument.
2022-11-18 18:50:34 -05:00
Aaron Patterson 10788166e7 Differentiate T_OBJECT shapes from other objects
We would like to differentiate types of objects via their shape.  This
commit adds a special T_OBJECT shape when we allocate an instance of
T_OBJECT.  This allows us to avoid testing whether an object is an
instance of a T_OBJECT or not, we can just check the shape.
2022-11-18 08:31:56 -08:00
yui-knk f0ce118662 Make anonymous rest arg (*) and block arg (&) accessible from ARGS node 2022-11-18 18:25:42 +09:00
Shugo Maeda ddd62fadaf Allow anonymous keyword rest parameter with other keyword parameters
Fixes [Bug #19132]
2022-11-18 18:23:06 +09:00
Yusuke Endoh ca1aa7afea Prevent a "method redefined" warning
http://rubyci.s3.amazonaws.com/ubuntu2004-arm/ruby-master/log/20221118T033003Z.log.html.gz
```
[21350/22024] TestIRB::ExtendCommandTest#test_show_source_end_finder/home/chkbuild/chkbuild/tmp/build/20221118T033003Z/ruby/test/irb/test_cmd.rb:523: warning: method redefined; discarding old show_source_test_method
/home/chkbuild/chkbuild/tmp/build/20221118T033003Z/ruby/test/irb/test_cmd.rb:523: warning: previous definition of show_source_test_method was here
 ```
2022-11-18 15:39:50 +09:00
Yusuke Endoh 096ffebbbf Prevent a "warning: assigned but unused variable - s2" 2022-11-18 14:39:40 +09:00
Samuel Williams ea8a7287e2
Add support for `sockaddr_un` on Windows. (#6513)
* Windows: Fix warning about undefined if_indextoname()

* Windows: Fix UNIXSocket on MINGW and make .pair more reliable

* Windows: Use nonblock=true for read tests with scheduler

* Windows: Move socket detection from File.socket? to File.stat

Add S_IFSOCK to Windows and interpret reparse points accordingly.
Enable tests that work now.

* Windows: Use wide-char functions to UNIXSocket

This fixes behaviour with non-ASCII characters.
It also fixes deletion of temporary UNIXSocket.pair files.

* Windows: Add UNIXSocket tests for specifics of Windows impl.

* Windows: fix VC build due to missing _snwprintf

Avoid usage of _snwprintf, since it fails linking ruby.dll like so:

  linking shared-library x64-vcruntime140-ruby320.dll
  x64-vcruntime140-ruby320.def : error LNK2001: unresolved external symbol snwprintf
  x64-vcruntime140-ruby320.def : error LNK2001: unresolved external symbol vsnwprintf_l

whereas linking miniruby.exe succeeds.

This patch uses snprintf on the UTF-8 string instead.

Also remove branch GetWindowsDirectoryW, since it doesn't work.

* Windows: Fix dangling symlink test failures

Co-authored-by: Lars Kanis <kanis@comcard.de>
2022-11-17 14:50:25 -08:00
Takashi Kokubun 4e4b29b1a9
YJIT: Make the code GC test stabler
The first `add_pages` call shouldn't hit Code GC yet; otherwise
`compiles` returns false. With the increased code size in runtime_stats
itself, it sometimes hits Code GC too early, at least in arm64 that has
a large code size.
2022-11-17 14:02:01 -08:00
st0012 923c1aaed7
Drop Ruby 2.5 support
Because it has reached EOL for more than 1.5 years and it won't be
supported by the next reline version either.
2022-11-17 13:06:32 +09:00
Takashi Kokubun 05af417587
YJIT: Show YJIT build option in RUBY_DESCRIPTION (#6738)
YJIT: Show YJIT profile in RUBY_DESCRIPTION
2022-11-16 10:08:52 -08:00
Stan Lo 9751b54971 [ruby/irb] Improve testing infra
(https://github.com/ruby/irb/pull/442)

* Add test_in_isolation task to run tests in isolation

This simulates how tests are run in Ruby CI and can detect some issues
before they're merged and break Ruby CI later.

* Run test_in_isolation task on CI

* Fix TestRaiseNoBacktraceException's setup

https://github.com/ruby/irb/commit/51f23c58b0
2022-11-15 17:26:51 +00:00
Hiroshi SHIBATA 36dc99af5a
Added empty class for test methods in TestIRB cases 2022-11-15 20:19:43 +09:00
st0012 1eae15142f [ruby/irb] Remove duplicated TestInputMethod definitions
https://github.com/ruby/irb/commit/4b831d02e1
2022-11-15 10:07:32 +00:00
Takashi Kokubun d15d1c01c2
Rename --mjit-min-calls to --mjit-call-threshold (#6731)
for consistency with YJIT
2022-11-14 23:38:52 -08:00
Yusuke Endoh 81c494d810 [ruby/error_highlight] Enable tests for TypeError and ArgumentError
These tests were unintentionally disabled by `if false`

https://github.com/ruby/error_highlight/commit/fa6d00d80d
2022-11-14 06:22:35 +00:00
Takashi Kokubun 96d29dff66
Fix invokebuiltin in Ruby MJIT
45fe7f7575/tool/ruby_vm/views/_mjit_compile_invokebuiltin.erb (L21)
has not been ported correctly.
2022-11-13 21:14:47 -08:00
Kenta Murata ef1c6109b1 [ruby/bigdecimal] Tweak check_rounding_mode_option
https://github.com/ruby/bigdecimal/commit/e1c6c9be25
2022-11-13 02:02:02 +00:00
Stan Lo 14a1394bcd [ruby/irb] Simplify info command's tests
(https://github.com/ruby/irb/pull/440)

https://github.com/ruby/irb/commit/5942949226
2022-11-11 21:05:35 +00:00
Hiroshi SHIBATA 28611be6ee Merge RubyGems/Bundler master from ee2f8398324af4bc1b95f7565ce2fda98126e026 2022-11-11 17:24:08 +09:00
Josef Šimánek de159c5a85 [rubygems/rubygems] Store last check even when upgrade is not available and fix test.
https://github.com/rubygems/rubygems/commit/bcffc2b0a5
2022-11-11 17:24:08 +09:00
Josef Šimánek 7ce0f81fbb [rubygems/rubygems] Use file in XDG_STATE_HOME directory to store last update check timestamp.
https://github.com/rubygems/rubygems/commit/0fbc4ace8a
2022-11-11 17:24:08 +09:00
Josef Šimánek c7d043065c [rubygems/rubygems] Add 'call for update' to RubyGems install command.
https://github.com/rubygems/rubygems/commit/05811f8248
2022-11-11 17:24:08 +09:00
Jason Karns ceeefb5870 [rubygems/rubygems] github source should default to secure protocol
Bundler 2 switched to secure https here c2e81f8ff6

Insecure protocols should be avoided to prevent MITM attacks.

https://github.com/rubygems/rubygems/commit/758413364a
2022-11-11 17:24:08 +09:00
Yusuke Endoh adfbee85e0 Allow a float error for Regexp.timeout
The tests failed on windows

https://github.com/ruby/ruby/actions/runs/3440997073/jobs/5740085169#step:18:62
```
    1) Failure:
  TestRegexp#test_s_timeout [D:/a/ruby/ruby/src/test/ruby/test_regexp.rb:1586]:
  <0.30000000000000004> expected but was
  <0.3>.

    2) Failure:
  TestRegexp#test_timeout_shorter_than_global [D:/a/ruby/ruby/src/test/ruby/test_regexp.rb:1631]:
  <0.30000000000000004> expected but was
  <0.3>.
```
2022-11-11 09:07:00 +09:00
Takashi Kokubun 8fa83fa0b2 [ruby/irb] Transform ls's --grep/-G option to keyword args
(https://github.com/ruby/irb/pull/437)

* Transform ls's --grep/-G option to keyword args

* Make --grep less flexible

* Support -g instead of --grep

* Suppress warnings from symbol aliases
2022-11-10 22:55:15 +00:00
Yusuke Endoh 06e17d7659 Run EnvUtil.apply_timeout_scale outside of assert_separately
It does not work well in assert_separately
2022-11-11 07:42:03 +09:00
Thomas E. Enebo 51d161980a [ruby/racc] Make racc test more flexible (for JRuby).
JRuby uses these same files for testing racc. The existing logic will not
find 'racc' in a JRuby project checkout. This change allows it to work by
just assuming 'ruby -S racc' when running tests. This will not change C
Ruby's detection when setting up tests (since earlier checks will find
racc).

https://github.com/ruby/racc/commit/b74ce5e018
2022-11-10 22:36:34 +00:00
Takashi Kokubun 2b8191bdad
YJIT: Invalidate JIT code only for ISEQ_TRACE_EVENTS (#6695) 2022-11-10 17:12:38 -05:00
Takashi Kokubun 0de3bc92b4 [ruby/irb] Make $ and @ default aliases
(https://github.com/ruby/irb/pull/438)

https://github.com/ruby/irb/commit/0613589476
2022-11-10 17:31:15 +00:00
Jemma Issroff 5246f4027e Transition shape when object's capacity changes
This commit adds a `capacity` field to shapes, and adds shape
transitions whenever an object's capacity changes. Objects which are
allocated out of a bigger size pool will also make a transition from the
root shape to the shape with the correct capacity for their size pool
when they are allocated.

This commit will allow us to remove numiv from objects completely, and
will also mean we can guarantee that if two objects share shapes, their
IVs are in the same positions (an embedded and extended object cannot
share shapes). This will enable us to implement ivar sets in YJIT using
object shapes.

Co-Authored-By: Aaron Patterson <tenderlove@ruby-lang.org>
2022-11-10 10:11:34 -05:00
Jemma Issroff 9986697b62 Omit test on IO Buffers which relies on String being embedded
There is currently a bug ([#19084]) in how extended strings work in
IO Buffers. Object Shapes changes will make the string in this test
extended on 32 bit machines. Since this behavior is currently broken
(unrelated to object shapes) on 32 bit machines, this test will then
fail. We preemptively omit it so that this commit can be reverted
once the bug is fixed.
2022-11-10 10:11:34 -05:00
Jemma Issroff 199b59f065 Fix bug in array pack with shared strings
If string literals are long and they become shared, we need to make them
independent before we can write to them. [Bug #19116]
2022-11-10 09:26:37 -05:00
Nobuyoshi Nakada b7e8876704
[Bug #19100] Add `init_int32` function to `rb_random_interface_t`
Distinguish initialization by single word from initialization by
array.
2022-11-10 12:06:13 +09:00
Nobuyoshi Nakada 6eaed20e14
Add version to the interface of Random extensions 2022-11-10 11:59:45 +09:00
TSUYUSATO Kitsune 0a14825f73 Update timeout seconds for square test 2022-11-09 23:21:26 +09:00
TSUYUSATO Kitsune 71c76d1bfa Update timeout seconds 2022-11-09 23:21:26 +09:00
TSUYUSATO Kitsune 80d145fa52 Fix and add regexp tests 2022-11-09 23:21:26 +09:00