90447 Commits

Author SHA1 Message Date
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
Hiroshi SHIBATA
cdc55c2452
[ruby/cgi] Bump up 0.4.2.beta2
https://github.com/ruby/cgi/commit/8e6fb1041b
2025-02-27 13:32:32 +09:00
Martin Emde
61060d349d
[rubygems/rubygems] Remove MD5 digesting of compact index responses
It has been over a year since the release, so let's stop MD5ing everything

https://github.com/rubygems/rubygems/commit/29ef4ca30b
2025-02-27 13:32:32 +09:00
David Rodríguez
3e78a2f58e
[rubygems/rubygems] Improve error message when on read-only filesystems
If we fail to write the lockfile, give a better error.

https://github.com/rubygems/rubygems/commit/81a08d6eda
2025-02-27 13:32:32 +09:00
Jean Boussier
0d62037fc0
[ruby/json] Ensure parser error snippets are valid UTF-8
Fix: https://github.com/ruby/json/issues/755

Error messages now include a snippet of the document
that doesn't parse to help locate the issue, however
the way it was done wasn't UTF-8 aware, and it could
result in exception messages with truncated characters.

It would be nice to go a bit farther and actually support
codepoints, but it's a lot of complexity to do it in C,
perhaps if we move that logic to Ruby given it's not a
performance sensitive codepath.

https://github.com/ruby/json/commit/e144793b72
2025-02-27 13:32:32 +09:00
yuuji.yaginuma
75f07afd18 [ruby/uri] Use a fully qualified name in warning messages
Currently, some warning messages don't contain a `URI` like the following.

```ruby
warning: URI::ABS_URI is obsolete. Use RFC2396_PARSER.regexp[:ABS_URI] explicitly.
```

But, without `URI` prefix, the suggested value doesn't work.
So I think we should use a fully qualified name to avoid confusion.

https://github.com/ruby/uri/commit/428eb10e44
2025-02-27 04:32:27 +00:00
Yuji Yaginuma
31bd669f67 [ruby/uri] Fix the mention to removed URI.escape/URI::Escape
This was removed by #9.

https://github.com/ruby/uri/commit/fec924238f
2025-02-27 04:30:23 +00:00
Nobuyoshi Nakada
d31c15d81f
[DOC] Reference to the idiom from Array#sort 2025-02-27 13:07:43 +09:00
Nobuyoshi Nakada
9394d2084c
[DOC] Fix indentation
Not to make preceding paragraphs a code block.
2025-02-27 13:00:34 +09:00
Nobuyoshi Nakada
931ac960b6
[Bug #21159] module names should not be modifiable 2025-02-27 11:07:36 +09:00
BurdetteLamar
1b6fddf4db [DOC] Tweaks for Hash#keep_if 2025-02-26 15:52:45 -05:00
BurdetteLamar
04e46bd75c [DOC] Tweaks for Hash#key 2025-02-26 15:52:13 -05:00
BurdetteLamar
8dce189078 [DOC] Tweaks for Hash#keys 2025-02-26 15:51:58 -05:00
Burdette Lamar
3bbb029d44
[DOC] Tweaks for Hash#invert 2025-02-26 09:28:52 -05:00
BurdetteLamar
43a729b1be [DOC] Tweaks for Hash#replace 2025-02-26 09:28:05 -05:00
BurdetteLamar
a870419f3a [DOC] Tweaks for Hash#inspect 2025-02-26 09:27:55 -05:00
Hiroshi SHIBATA
237ab21f25 [ruby/cgi] Escape/unescape unclosed tags as well
https://github.com/ruby/cgi/commit/cd1eb08076

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2025-02-26 07:34:04 +00:00
Hiroshi SHIBATA
fc60a04de9 [ruby/cgi] Use String#concat instead of String#+ for reducing cpu usage
https://github.com/ruby/cgi/commit/9907b76dad

Co-authored-by: "Yusuke Endoh" <mame@ruby-lang.org>
2025-02-26 07:34:03 +00:00
git
aa31c893a2 Update default gems list at eac8b1197f65162233465e1c32e2ce [ci skip] 2025-02-26 07:13:57 +00:00
Hiroshi SHIBATA
eac8b1197f [ruby/uri] Bump up v1.0.3
https://github.com/ruby/uri/commit/3213f4a0f8
2025-02-26 07:12:53 +00:00
Hiroshi SHIBATA
b407b6b5b2 [ruby/uri] Fix merger of URI with authority component
https://hackerone.com/reports/2957667

https://github.com/ruby/uri/commit/2789182478

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2025-02-26 07:08:45 +00:00
Hiroshi SHIBATA
57dcb4bb9b [ruby/uri] Truncate userinfo with URI#join, URI#merge and URI#+
https://github.com/ruby/uri/commit/3675494839
2025-02-26 07:08:44 +00:00
git
7d24e1d655 Update default gems list at ae0853b5f5f4bf78c2bd9e34cad6e5 [ci skip] 2025-02-26 06:21:38 +00:00
Hiroshi SHIBATA
ae0853b5f5 [ruby/cgi] Bump up 0.4.2.beta1
https://github.com/ruby/cgi/commit/3f5b4ed9e9
2025-02-26 06:20:36 +00:00
Naoto Ono
0c9f149b4d
Launchable: Fix launchable record session command failures (#12810)
Currently, the `launchable record session` command is failing some workflows such as YJIT on macOS. This occurs because of word splitting, as explained in https://www.shellcheck.net/wiki/SC2086. This PR addresses the issue.

```
+ launchable record session --build refs_pull_12785_merge_5ac818aaf7402e232de6b3e1b078765da3dc6279 --observation --flavor os=macos-14 --flavor test_task=check --flavor test_opts=--enable-yjit --flavor workflow=YJIT macOS Arm64 --test-suite yjit-test-all
Usage: launchable record session [OPTIONS]
Try 'launchable record session --help' for help.

Error: Got unexpected extra arguments (macOS Arm64)
Error: Process completed with exit code 2.
```

https://github.com/ruby/ruby/actions/runs/13535324545/job/37825826044#step:10:354
2025-02-26 03:50:54 +00:00
Nobuyoshi Nakada
14192921f5
Check LoadError first
The message from dlerror is not our concern.
2025-02-26 11:13:41 +09:00
Hiroshi SHIBATA
2194e65a98
Added assertion strings with Xcode 16.3 beta 2025-02-26 09:09:56 +09:00
Koichi ITO
6efd15a128 [ruby/prism] Restore a comment for Prism::Translation::Parser#initialize
This restores the missing method comments in https://github.com/ruby/prism/pull/3479.

https://github.com/ruby/prism/commit/78b8f67dee
2025-02-25 22:18:02 +00:00
Earlopain
044570fd76 [ruby/prism] Fix merge mishap
Caused by https://github.com/ruby/prism/pull/3478 and https://github.com/ruby/prism/pull/3443

I also made the builder reference more explicit to clearly distinquish
between `::Parser` and `Prism::Translation::Parser`

https://github.com/ruby/prism/commit/d52aaa75b6
2025-02-25 17:11:39 +00:00
Earlopain
790b3858e8 [ruby/prism] Add a custom builder class for the parser translator
I want to add new node types to the parser translator, for example `itblock`. The bulk of the work is already done by prism itself. In the `parser`
builder, this would be a 5-line change at most but we don't control that here.

Instead, we can add our own builder and either overwrite the few methods we need,
or just inline the complete builder. I'm not sure yet which would be better.

`rubocop-ast` uses its own builder for `parser`. For this to correctly work, it must explicitly choose to extend the
prism builder and use it, same as it currently chooses to use a different parser when prism is used.

I'd like to enforce that the builder for prism extends its custom one since it will lead to
some pretty weird issues otherwise. But first, I'd like to change `rubocop-ast` to make use of this.

https://github.com/ruby/prism/commit/b080e608a8
2025-02-25 15:44:56 +00:00