90476 Commits

Author SHA1 Message Date
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 ce66eea167847d4300150791bde4932b907b0cc0.
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.

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

https://github.com/rubygems/rubygems/commit/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>

https://github.com/rubygems/rubygems/commit/6452a6d6cd
2025-03-03 15:52:35 +09:00
Michael Chui
fdf1076ef9 [rubygems/rubygems] docs(bundle-exec): recommend non-deprecated methods
https://github.com/rubygems/rubygems/commit/3b4934fb69
2025-03-03 15:52:35 +09:00
Mateo
a98c3d229e [rubygems/rubygems] docs(bundle-config): hint default group when using only option
https://github.com/rubygems/rubygems/commit/c258e45b44
2025-03-03 15:52:35 +09:00
Josef Šimánek
29e3ee0568 [rubygems/rubygems] Bring man pages up to date
https://github.com/rubygems/rubygems/commit/591d2c0503
2025-03-03 15:52:35 +09:00
Hiroshi SHIBATA
e4c5531b4c [rubygems/rubygems] Update vendored uri to 1.0.3
https://github.com/rubygems/rubygems/commit/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]

https://github.com/ruby/prism/commit/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 (https://github.com/ruby/ruby/actions/runs/13572112090) 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 https://github.com/ruby/openssl/commit/aa7f03e18f26 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.

http://rubyci.s3.amazonaws.com/debian11/ruby-master/log/20250228T003003Z.fail.html.gz
http://rubyci.s3.amazonaws.com/rhel8/ruby-master/log/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.

https://github.com/ruby/openssl/commit/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
https://github.com/rubygems/rubygems/commit/b4a8bda811
2025-02-28 12:34:57 +09:00
Hiroshi SHIBATA
0cac191c6e
[rubygems/rubygems] Update version for broken executables with default gems
https://github.com/rubygems/rubygems/commit/d2f90a81d9
2025-02-28 12:34:57 +09:00
Martin Emde
19bdcc8f0c
[rubygems/rubygems] Retry gracefully on blank partial response in compact index
https://github.com/rubygems/rubygems/commit/fafb9ae090
2025-02-28 12:34:57 +09:00
Maciek Rząsa
223f37c002 Improve tests for small UTF regex with case fold.
Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2025-02-28 12:34:38 +09:00
Maciej Rzasa
a50fbc56a3 Use mbuf instead of bitset for character class for small UTF. Fixes #16145 2025-02-28 12:34:38 +09:00
Jean Boussier
025832c385 [ruby/prism] Use a locale-insensitive version of tolower
[Bug #21161]

The `tolower` function provided by the libc is locale dependent
and can behave in ways you wouldn't expect for some value
of `LC_CTYPE`.

https://github.com/ruby/prism/commit/e3488256b4

Co-Authored-By: Nobuyoshi Nakada <nobu@ruby-lang.org>
2025-02-28 00:28:24 +00:00
Kazuki Yamaguchi
d4b8da66ca [ruby/openssl] ssl: refactor check_supported_protocol_versions
As reported in <https://github.com/ruby/ruby/pull/12823>,
check_supported_protocol_versions is unstable and occasionally fails
with Errno::ECONNABORTED during SSLSocket#connect on Windows.

When the server-side SSLContext specifies an unsupported SSL/TLS
protocol version, start_server accepts a TCP connection but closes it
without reading ClientHello, as SSLSocket#accept immediately raises an
exception. With Winsock, this can cause the client-side
SSLSocket#connect to raise Errno::ECONNABORTED.

While the simplest fix is to add rescue Errno::ECONNABORTED, this method
can be simplified. Instead, let's set up a server that accepts all
protocol versions and test client connections with different settings.

https://github.com/ruby/openssl/commit/aa7f03e18f
2025-02-27 17:18:02 +00:00
Kazuki Yamaguchi
c0f3dcf795 [ruby/openssl] digest: correct assert_equal usage in test_sha3
assert_equal accepts an expected value as the first argument.

https://github.com/ruby/openssl/commit/8faa1d89de
2025-02-27 17:04:32 +00:00
Kazuki Yamaguchi
f5a74bd645 [ruby/openssl] digest: always run SHA-3 and truncated SHA-2 tests
The "pend" are no longer necessary, as they work with all OpenSSL
variants we currently support. They were added in OpenSSL 1.1.1 and
LibreSSL 3.8.0. They are also supported by the current AWS-LC release.

This makes the SHA-3 tests run with AWS-LC correctly. AWS-LC does not
report SHA-3 in OpenSSL::Digest.digests.

https://github.com/ruby/openssl/commit/e1a6e9c081
2025-02-27 17:04:32 +00:00
Kazuki Yamaguchi
9994a95790 [ruby/openssl] ssl: manually craft invalid SAN extensions in tests
Starting with LibreSSL 3.5, OpenSSL::X509::ExtensionFactory refuses to
create SAN extensions that are not valid according to RFC 6125. While
this behavior makes sense, we need such invalid extensions to test our
own validation routine. Let's construct SAN extensions manually instead.

https://github.com/ruby/openssl/commit/b420d6d739
2025-02-27 17:04:16 +00:00
Jun Aruga
244363b23e [ruby/openssl] Use ENV["TEST_RUBY_OPENSSL_FIPS_ENABLED"] instead of OpenSSL::OPENSSL_FIPS.
As OpenSSL::OPENSSL_FIPS always returns true on OpenSSL >= 3.0.0, we cannot use
this constant as a flag to check whether the OpenSSL is FIPS or not.
See <d725783c5c/ext/openssl/ossl.c (L994-L1004)>.

Skip the test_fips_mode_get_with_fips_mode_set test in AWS-LC case.

Because we don't test `OpenSSL.fips_mode=` on AWS-LC for now. We cannot change
the value of the `OpenSSL.fips_mode` on AWS-LC.
The `OpenSSL.fips_mode` in AWS-LC behaves as follows.

On AWS-LC non-FIPS:
```
$ bundle exec ruby -I ./lib -ropenssl.so -e 'p OpenSSL.fips_mode'
false

$ bundle exec ruby -I ./lib -ropenssl.so -e 'OpenSSL.fips_mode = true; p OpenSSL.fips_mode'
-e:1:in 'OpenSSL.fips_mode=': Turning on FIPS mode failed (OpenSSL::OpenSSLError)
	from -e:1:in '<main>'

$ bundle exec ruby -I ./lib -ropenssl.so -e 'OpenSSL.fips_mode = false; p OpenSSL.fips_mode'
false
```

On AWS-LC FIPS:
```
$ bundle exec ruby -I ./lib -ropenssl.so -e 'p OpenSSL.fips_mode'
true

$ bundle exec ruby -I ./lib -ropenssl.so -e 'OpenSSL.fips_mode = false; p OpenSSL.fips_mode'
-e:1:in 'OpenSSL.fips_mode=': Turning off FIPS mode failed (OpenSSL::OpenSSLError)
	from -e:1:in '<main>'

$ bundle exec ruby -I ./lib -ropenssl.so -e 'OpenSSL.fips_mode = true; p OpenSSL.fips_mode'
true
```

https://github.com/ruby/openssl/commit/fd3e3e722f
2025-02-27 17:01:57 +00:00
Hiroshi SHIBATA
4f19f23036
Use erb for simple executable example 2025-02-27 19:53:24 +09:00
Hiroshi SHIBATA
921ca9d8a8
Use syntax_suggest instead of erb executable.
erb is only working with Ruby 3.5dev.
2025-02-27 19:50:14 +09:00
Naoto Ono
2dff416ff2
Increase timeout in TestParallel testing to reduce flaky failures (#12822)
Currently, the following tests are flaky and failing intermittently, so I'm going to increase the timeout to improve stability.

```  
    1) Failure:
  TestParallel::TestParallel#test_hungup [/Users/runner/work/ruby/ruby/src/tool/lib/zombie_hunter.rb:6]:
  Expected [[42009, #<Process::Status: pid 42009 SIGKILL (signal 9)>]] to be empty.
  
    2) Error:
  TestParallel::TestParallel#test_hungup:
  Test::Unit::ProxyError: execution expired
      /Users/runner/work/ruby/ruby/src/lib/timeout.rb:40:in 'Timeout::Error.handle_timeout'
      /Users/runner/work/ruby/ruby/src/lib/timeout.rb:194:in 'Timeout.timeout'
      /Users/runner/work/ruby/ruby/src/tool/test/testunit/test_parallel.rb:210:in 'TestParallel::TestParallel#test_hungup'

```
https://github.com/ruby/ruby/actions/runs/13560087551/job/37901506230#step:14:105

```
    1) Error:
  TestParallel::TestParallel#test_retry_workers:
  Test::Unit::ProxyError: execution expired
      /Users/runner/work/ruby/ruby/src/lib/timeout.rb:40:in 'Timeout::Error.handle_timeout'
      /Users/runner/work/ruby/ruby/src/lib/timeout.rb:194:in 'Timeout.timeout'
      /Users/runner/work/ruby/ruby/src/tool/test/testunit/test_parallel.rb:217:in 'TestParallel::TestParallel#test_retry_workers'
```
https://github.com/ruby/ruby/actions/runs/13559151505/job/37899041580#step:14:106
2025-02-27 07:55:54 +00:00
Hiroshi SHIBATA
261f802384
Move irb detection to top-level before(:each) block 2025-02-27 15:49:31 +09:00
Hiroshi SHIBATA
3e8bf097ce Use erb executable instead of irb 2025-02-27 15:48:26 +09:00
Naoto Ono
48b6c60969
[Misc #20661] Stop retrying tests in make test-all command by default (#11271)
[Misc #20661] Stop retrying tests in make test-all command by default
2025-02-27 06:12:02 +00:00
git
8bc7443128 Update default gems list at 9cf5d20e5f355e2d355e3f5426080a [ci skip] 2025-02-27 04:33:41 +00:00
Hiroshi SHIBATA
9cf5d20e5f
[ruby/cgi] Bump up v0.4.2
https://github.com/ruby/cgi/commit/ab84b7fe66
2025-02-27 13:32:32 +09:00