Commit graph

90493 commits

Author SHA1 Message Date
kyontan
3c92fe13f8
[DOC] Fix minor miscalculation of stack size 2025-03-07 16:18:25 -05:00
Burdette Lamar
17f6a68962
[DOC] Tweaks for Hash#rehash 2025-03-07 09:38:51 -05:00
BurdetteLamar
8774530ce1 [DOC] Tweaks for Hash#rassoc 2025-03-07 09:36:51 -05:00
Burdette Lamar
42b75a9c64
[DOC] Tweaks for Hash#merge (#12825) 2025-03-07 09:34:36 -05:00
Nobuyoshi Nakada
f118e0ce73
[Bug #21174] [Bug #21175] Update rubyspec 2025-03-07 17:52:18 +09:00
Nobuyoshi Nakada
cbe3156f82
[Bug #21174] [Bug #21175] Fix Range#max on beginless integer range 2025-03-07 17:23:33 +09:00
Nobuyoshi Nakada
8841f885bd
[Bug #21163] Fix hexadecimal float conversion 2025-03-07 12:14:48 +09:00
Peter Zhu
6bad47ac6d RUBY_FREE_AT_EXIT does not work when error in -r
[Bug #21173]

When loading a file using the command line -r, it is processed before
RUBY_FREE_AT_EXIT is checked. So if the loaded file raises an error, it
will cause memory to not be freed with RUBY_FREE_AT_EXIT.

For example `ruby -rtest.rb -e ""` will report a large amount of memory
leaks if `test.rb` raises.
2025-03-06 11:58:54 -05:00
Takashi Kokubun
bb91c303ba
YJIT: Rename get_temp_regs2() back to get_temp_regs() (#12866) 2025-03-06 10:52:49 -05:00
Rahim Packir Saibo
e20f1f76f4 [ruby/json] Fix JSON::GeneratorError#detailed_message with Ruby < 3.2
2e015ff839
2025-03-06 18:29:27 +09:00
Nobuyoshi Nakada
f7af75d3d9 Show test task names longer 2025-03-06 16:58:13 +09:00
Jean Boussier
ca4325f6c9 Harden TestObjSpace#test_memsize_of_root_shared_string
This test occasionally fail because it runs into a String instance
that had its `==` method removed.

I couldn't identify where this String comes from, but in general
when using `each_object` it's best to not assume returned objectd
are functional.

By just inverting the operands of `==` we ensure it's always
`String#==` that is called.

```
  1) Error:
TestObjSpace#test_memsize_of_root_shared_string:
NoMethodError: undefined method '==' for #<String:0x00007f9b50e8c978>
    /tmp/ruby/src/trunk-random1/test/objspace/test_objspace.rb:35:in 'block in TestObjSpace#test_memsize_of_root_shared_string'
    /tmp/ruby/src/trunk-random1/test/objspace/test_objspace.rb:35:in 'ObjectSpace.each_object'
    /tmp/ruby/src/trunk-random1/test/objspace/test_objspace.rb:35:in 'TestObjSpace#test_memsize_of_root_shared_string'
```
2025-03-06 08:42:01 +01:00
Naoto Ono
c939d0c85d
Launchable: Send stdout and stderr (#12785)
Currently, the Launchable team is developing a new feature to attach any logs. Attached log can be anything, such as system logs or stdout. Users can find these logs using any text search. Please note that this feature is a work in progress, so we can't use it yet.

I'm going to attach stdout and stderr as attached logs because they will be useful for finding interpreter bugs. When running tests, we sometimes see interpreter itself crash, and the stack is output to stderr. When debugging the cause of the issue, this feature is useful.
2025-03-06 12:39:39 +09:00
Naoto Ono
309076ff91
Fix flaky failure in TestSetTraceFunc#test_tracepoint_disable (#12854)
TestSetTraceFunc#test_tracepoint_disable is a flaky and failing intermittently. Here is an example of failure logs.

```
   1) Failure:
  TestSetTraceFunc#test_tracepoint_disable [/home/runner/work/ruby/ruby/src/test/ruby/test_settracefunc.rb:857]:
  <[:foo, :disable, :foo, :disable]> expected but was
  <[:call, :call, :foo, :disable, :foo, :disable]>.
```
3806620854 (step):12:875

I printed values of TracePoint objects as follows, and checked the values when failing intermittently.

7f9a6fc582/test/ruby/test_settracefunc.rb (L848)

Here is the log when the TestSetTraceFunc#test_tracepoint_disable failed intermittently.

`2025-03-05T09:08:37.4075411Z e: call, f: /home/runner/work/ruby/ruby/src/lib/tempfile.rb, l: 386, i: call, d: Tempfile::FinalizerManager` is an unexpected events. Thus, I modified test code so that we can filter out unexpected trace events.

```
2025-03-05T09:08:37.4075411Z e: call, f: /home/runner/work/ruby/ruby/src/lib/tempfile.rb, l: 386, i: call, d: Tempfile::FinalizerManager
2025-03-05T09:08:37.4085009Z e: call, f: /home/runner/work/ruby/ruby/src/test/ruby/test_settracefunc.rb, l: 808, i: foo, d: TestSetTraceFunc
2025-03-05T09:08:37.4086042Z e: call, f: <internal:trace_point>, l: 295, i: disable, d: TracePoint
2025-03-05T09:08:37.4115693Z e: call, f: /home/runner/work/ruby/ruby/src/test/ruby/test_settracefunc.rb, l: 808, i: foo, d: TestSetTraceFunc
2025-03-05T09:08:37.4116734Z e: call, f: <internal:trace_point>, l: 295, i: disable, d: TracePoint
```
2025-03-06 12:18:54 +09:00
Takashi Kokubun
e8f8565dc2 Remove obsoleted insn_may_depend_on_sp_or_pc()
which was for MJIT
2025-03-05 16:23:31 -08:00
Takashi Kokubun
0d03183748 auto-request-review should run only for master
Backport PRs are reviewed only by the branch maintainers.
2025-03-05 15:46:51 -08:00
dependabot[bot]
e3960c5aa2 Bump actions/cache in /.github/actions/setup/directories
Bumps [actions/cache](https://github.com/actions/cache) from 4.2.1 to 4.2.2.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](0c907a75c2...d4323d4df1)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-06 08:46:09 +09:00
John Hawthorn
443e2ec27d Replace tombstone when converting AR to ST hash
[Bug #21170]

st_table reserves -1 as a special hash value to indicate that an entry
has been deleted. So that that's a valid value to be returned from the
hash function, do_hash replaces -1 with 0 so that it is not mistaken for
the sentinel.

Previously, when upgrading an AR table to an ST table,
rb_st_add_direct_with_hash was used which did not perform the same
conversion, this could lead to a hash in a broken state where one if its
entries which was supposed to exist being marked as a tombstone.

The hash could then become further corrupted when the ST table required
resizing as the falsely tombstoned entry would be skipped but it would
be counted in num entries, leading to an uninitialized entry at index
15.

In most cases this will be really rare, unless using a very poorly
implemented custom hash function.

This also adds two debug assertions, one that st_add_direct_with_hash
does not receive the reserved hash value, and a second in
rebuild_table_with, which ensures that after we rebuild/compact a table
it contains the expected number of elements.

Co-authored-by: Alan Wu <alanwu@ruby-lang.org>
2025-03-05 14:05:24 -08:00
Jean Boussier
c224ca4fea Fix a race condition with interned strings sweeping.
[Bug #21172]

This fixes a rare CI failure.

The timeline of the race condition is:

- A `"foo" oid=1` string is interned.
- `"foo" oid=1` is no longer referenced and will be swept in the future.
- Another `"foo" oid=2` string is interned.
- `register_fstring` finds `"foo" oid=1`, but since it is about to be swept,
  removes it from `fstring_table` and insert `"foo" oid=2` instead.
- `"foo" oid=1` is swept, since it has the `RSTRING_FSTR` flag,
  a `st_delete` is issued in `fstring_table` which removes `"foo" oid=2`.

I don't know how to reproduce this bug consistently in a single test
case.
2025-03-05 18:57:21 +01:00
a5-stable
53579e5718 yjit.rb: Fix parameter name in documentation 2025-03-05 10:19:31 -05:00
ydah
36ee0c1acb Add tests for alias locations with special variables $`, $', and $+ 2025-03-05 18:21:21 +09:00
Koichi Sasada
1ce10f3fbb do not reset EnvUtil.timeout_scale
Even if `setup` is omitted, but `teardown` is called and
`EnvUtil.timeout_scale` was reset with `nil`.
2025-03-05 05:45:54 +09:00
Koichi Sasada
46f3d82f40 Revert "try to show timeout sec"
This reverts commit ce66eea167.
2025-03-05 05:45:54 +09:00
Jean Boussier
15ee450801 Move in-place interning spec to Ruby's tests
Fix: https://github.com/ruby/spec/issues/1249

JRuby and TruffleRuby can't implement this behavior.
While quite a lot of code out there relies on it, if it's
not implemented it will simply result in sligthly less efficient
code, so not the end of the world.
2025-03-04 15:23:38 +01:00
BurdetteLamar
5de02d6487 [DOC] Tweaks for Hash#size 2025-03-04 09:22:19 -05:00
Koichi Sasada
ce66eea167 try to show timeout sec
http://ci.rvm.jp/results/trunk-gc-asserts@ruby-sp2-noble-docker/5632508
```
  1) Error:
TestEval#test_outer_local_variable_under_gc_compact_stress:
Test::Unit::ProxyError: execution of Test::Unit::CoreAssertions#assert_separately expired timeout (10 sec)
pid 1339179 killed by SIGABRT (signal 6) (core dumped)
```

seems that timeout scale doesn't work even though `RUBY_TEST_TIMEOUT_SCALE`
is specified.

This patch tries to print the timeout with scale information.
2025-03-04 19:39:16 +09:00
Hiroshi SHIBATA
d7a96a285c Sync skip rules from ubuntu.yml 2025-03-04 18:58:10 +09:00
Hiroshi SHIBATA
bb6674f96c Try to build WSL on GitHub Actions 2025-03-04 18:58:10 +09:00
Nobuyoshi Nakada
53f8b269ef
* append newline at EOF. [ci skip] 2025-03-04 10:26:03 +09:00
Alan Wu
40ae7d9650 .gdbinit: Fix T_HASH printing [ci skip]
Tested and it works with both AR and ST tables, with live process and
core dumps.
2025-03-03 18:54:08 -05:00
annichai-stripe
5085ec3ed9
Allow YJIT mem-size and call-threshold to be set at runtime via YJIT.enable() (#12505)
* first commit

* yjit.rb change

* revert formatting

* rename mem-size to exec-mem-size for correctness

* wip, move setting into rb_yjit_enable directly

* remove unused helper functions

* add in call threshold

* input validation with extensive eprintln

* delete test script

* exec-mem-size -> mem-size

* handle input validation with asserts

* add test cases related to input validation

* modify test cases

* move validation out of rs, into rb

* add comments

* remove trailing spaces

* remove logging

Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>

* remove helper fn

* Update test/ruby/test_yjit.rb

Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>

* trailing white space

---------

Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
Co-authored-by: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com>
2025-03-03 15:45:39 -05:00
Jun Aruga
9ccba88160 [ruby/openssl] test_pkey_dh.rb: Merge 2 test_new_break tests to one test.
Merge 2 test_new_break tests to one test because it's easy to maintain the test.

446ff3e11f
2025-03-03 15:27:56 +00:00
Josef Šimánek
12e2dfdc56 [rubygems/rubygems] Update parallel_tests.
- new version restores previously removed method

5348e88d07
2025-03-03 15:52:35 +09:00
dependabot[bot]
7b3a0c65b9 [rubygems/rubygems] Bump the rb-sys group across 2 directories with 1 update
Bumps the rb-sys group with 1 update in the /test/rubygems/test_gem_ext_cargo_builder/custom_name/ext/custom_name_lib directory: [rb-sys](https://github.com/oxidize-rb/rb-sys).
Bumps the rb-sys group with 1 update in the /test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example directory: [rb-sys](https://github.com/oxidize-rb/rb-sys).

Updates `rb-sys` from 0.9.110 to 0.9.111
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.110...v0.9.111)

Updates `rb-sys` from 0.9.110 to 0.9.111
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.110...v0.9.111)

---
updated-dependencies:
- dependency-name: rb-sys
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: rb-sys
- dependency-name: rb-sys
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: rb-sys
...

Signed-off-by: dependabot[bot] <support@github.com>

6452a6d6cd
2025-03-03 15:52:35 +09:00
Michael Chui
fdf1076ef9 [rubygems/rubygems] docs(bundle-exec): recommend non-deprecated methods
3b4934fb69
2025-03-03 15:52:35 +09:00
Mateo
a98c3d229e [rubygems/rubygems] docs(bundle-config): hint default group when using only option
c258e45b44
2025-03-03 15:52:35 +09:00
Josef Šimánek
29e3ee0568 [rubygems/rubygems] Bring man pages up to date
591d2c0503
2025-03-03 15:52:35 +09:00
Hiroshi SHIBATA
e4c5531b4c [rubygems/rubygems] Update vendored uri to 1.0.3
176dc7421c
2025-03-03 15:52:35 +09:00
Hiroshi SHIBATA
f52a2e4b12 Restore lockfile for vendor_gems.rb 2025-03-03 15:52:35 +09:00
ydah
a47e686cb6 Implement POSTEXE NODE locations
The following Location information has been added This is the information required for parse.y to be a universal parser:

```
❯ ruby --parser=prism --dump=parsetree -e "END {  }"
@ ProgramNode (location: (1,0)-(1,8))
+-- locals: []
+-- statements:
    @ StatementsNode (location: (1,0)-(1,8))
    +-- body: (length: 1)
        +-- @ PostExecutionNode (location: (1,0)-(1,8))
            +-- statements: nil
            +-- keyword_loc: (1,0)-(1,3) = "END"
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            +-- opening_loc: (1,4)-(1,5) = "{"
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            +-- closing_loc: (1,7)-(1,8) = "}"
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```
2025-03-03 11:17:14 +09:00
Kevin Newton
617e8608b2 [ruby/prism] Rename fgets parameter to fix NetBSD
Fixes [Bug #21165]

3f0acf7560
2025-03-02 18:14:36 +00:00
ydah
c93f30ab67 Use user defined parameterizing rules mlhs 2025-03-02 23:10:45 +09:00
ydah
6c8cdc9c6b Change superclass rhs to use none 2025-03-02 23:10:17 +09:00
Naoto Ono
db4ea95219
[Bug #20682] Add sleep 0.1 to stabilize flaky failures on macOS (#12829)
[Bug #20682] Add `sleep 0.1` to stabilize flaky failures on macOS
2025-02-28 09:32:36 +00:00
Naoto Ono
1ead1eb6db
Increase timeouts in Compilations actions to reduce intermittent failures (#12827)
Compilations actions are flaky and intermittently failing now. This run (1357211209) is an example of the issue. The job fails due to exceeding the timeout, resulting in termination. To prevent these intermittent failures, I'm going to increase the timeout.
2025-02-28 08:01:19 +00:00
Hiroshi SHIBATA
56f46e5448 Visual Studio 2022 17.13.x couldn't build miniruby.exe. It prevents other PRs.
e43209e139

```
user32.lib advapi32.lib shell32.lib ws2_32.lib iphlpapi.lib gmp.lib imagehlp.lib shlwapi.lib bcrypt.lib
linking miniruby.exe
   Creating library miniruby.lib and object miniruby.exp
[BUG] heap_idx_for_size: allocation size too large (size=145u, heap_idx=25u)
ruby 3.5.0dev (2025-02-28T01:12:37Z pull/12827/merge 3d6a5a1883) [x64-mswin64_140]
```

```
user32.lib advapi32.lib shell32.lib ws2_32.lib iphlpapi.lib imagehlp.lib shlwapi.lib bcrypt.lib
  linking miniruby.exe
  NMAKE : fatal error U1077: '@ miniruby.exe -v' : return code '0xc0000005'
```
2025-02-28 15:51:11 +09:00
Kazuki Yamaguchi
a6da77c9e9 [ruby/openssl] ssl: fix tests using TLS 1.1 or older
Commit aa7f03e18f broke test_minmax_version and test_fallback_scsv
on systems using OpenSSL 1.1.1 with a system-wide configuration file
that specifies MinProtocol=TLSv1.2.

20250228T003003Z.fail.html.gz
20250228T003003Z.fail.html.gz

These test cases were already broken before the commit, but they were
being skipped because check_supported_protocol_versions failed to detect
TLS 1.1 support. To avoid affected by the configuration file, explicitly
reset SSLContext#min_version when TLS 1.1 or older is required.

The test cases are also broken with OpenSSL 3.0 or later, but this is
not currently visible because it still fails to detect TLS 1.1 support.
This is caused by the default SSLContext#security_level value, as
OpenSSL 3.0 changed TLS 1.1 to be disabled at level 1.

6d0ea81b5e
2025-02-28 04:33:43 +00:00
Nobuyoshi Nakada
42c0722f83
[DOC] Fix the comment for RUBY_CONST_ID and rb_intern
RUBY_CONST_ID has never been deprecated; `rb_intern` is handy but it
is using non-standard GCC extensions and does not cache the ID with
other compilers.
2025-02-28 12:55:46 +09:00
Hiroshi SHIBATA
3294d3d457
[rubygems/rubygems] Skip default gems executable example with Windows platform
b4a8bda811
2025-02-28 12:34:57 +09:00
Hiroshi SHIBATA
0cac191c6e
[rubygems/rubygems] Update version for broken executables with default gems
d2f90a81d9
2025-02-28 12:34:57 +09:00