Commit graph

16692 commits

Author SHA1 Message Date
Takashi Kokubun
8ffa8fc192
Relax the timeout of a YAML test
https://cirrus-ci.com/task/4752663775019008
2022-12-01 15:37:41 -08:00
Jean byroot Boussier
3d272b0fc8
Module#remove_method: Check frozen on the right object
Previously, the frozen check happened on `RCLASS_ORIGIN(self)`, which
can return an iclass. The frozen check is supposed to respond to objects
that users can call methods on while iclasses are hidden from users.
Other mutation methods like Module#{define_method,alias_method,public}
don't do this. Check frozen status on the module itself.

Fixes [Bug #19164] and [Bug #19166].

Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
2022-12-01 17:32:41 -05:00
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"
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
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)

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.

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)

12529653cd
2022-11-28 14:24:06 +00:00
Takashi Kokubun
168b0e1f02 Make the timeout of test_system_sigpipe longer
5983796689
2022-11-27 22:48:19 -08:00
Takashi Kokubun
880e8fd1f9 Relax a too strict timeout
Regexp tests are flaky.
20221128T050004Z.fail.html.gz
2022-11-27 21:48:32 -08:00
Sven Riedel
e0901f46b7 [ruby/rdoc] Add --no-skipping-tests option
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>

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
20221127T200003Z.fail.html.gz
http://ci.rvm.jp/results/trunk-random-repeat@phosphorus-docker/4309581
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 41ceae93b3.

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`.

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.

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

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
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
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`.

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
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)

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
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

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

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