Commit graph

90891 commits

Author SHA1 Message Date
Earlopain
5cf7d948ad
[DOC] Fix contributing link
It moved in https://github.com/ruby/ruby/pull/13012 but wasn't updated here
2025-04-09 19:13:58 +09:00
Hiroshi SHIBATA
9f61541f76 Re-enabled to test at win32ole 2025-04-09 15:51:08 +09:00
Hiroshi SHIBATA
8ab517698a
sed is not requirement now 2025-04-09 10:31:33 +09:00
Hiroshi SHIBATA
9e93759b99
Restore assertion that is not related mswin platform 2025-04-09 10:20:22 +09:00
David Rodríguez
ab4a25e48e [rubygems/rubygems] Follow up to removal of rubyinstaller2 workaround
5b312fd040
2025-04-09 08:11:10 +09:00
Jean Boussier
ae45a7a952 [ruby/json] Cleanup jeaiii-ltoa to not need pragmas
97f2924d0a
2025-04-09 08:11:03 +09:00
Nobuyoshi Nakada
b1362e26c7 [ruby/json] Suppress -Wunknown-pragmas warnings
97f47d1cfd
2025-04-09 08:11:03 +09:00
Jun Aruga
d5f94941d8 [ruby/openssl] Fix the tests using SHA-1 Probabilistic Signature Scheme (PSS) parameters.
Fedora OpenSSL 3.5 on rawhide stopped accepting SHA-1 PSS[1] parameters.
This is different from the SHA-1 signatures which Fedora OpenSSL stopped
accepting since Fedora 41.[2]

This commit fixes the following test failures related to the SHA-1 PSS
parameters with Fedora OpenSSL 3.5.
Note these failures are the downstream Fedora OpenSSL RPM specific. The tests
pass without this commit with the upstream OpenSSL 3.5.

```
$ rpm -q openssl-libs openssl-devel
openssl-libs-3.5.0-2.fc43.x86_64
openssl-devel-3.5.0-2.fc43.x86_64

$ bundle exec rake test
...
E
===============================================================================================
Error: test_sign_verify_options(OpenSSL::TestPKeyRSA): OpenSSL::PKey::PKeyError: EVP_PKEY_CTX_ctrl_str(ctx, "rsa_mgf1_md", "SHA1"): digest not allowed (digest=SHA1)
/mnt/git/ruby/openssl/test/openssl/test_pkey_rsa.rb:113:in 'Hash#each'
/mnt/git/ruby/openssl/test/openssl/test_pkey_rsa.rb:113:in 'OpenSSL::PKey::PKey#sign'
/mnt/git/ruby/openssl/test/openssl/test_pkey_rsa.rb:113:in 'OpenSSL::TestPKeyRSA#test_sign_verify_options'
     110:       "rsa_pss_saltlen" => 20,
     111:       "rsa_mgf1_md" => "SHA1"
     112:     }
  => 113:     sig_pss = key.sign("SHA256", data, pssopts)
     114:     assert_equal 256, sig_pss.bytesize
     115:     assert_equal true, key.verify("SHA256", sig_pss, data, pssopts)
     116:     assert_equal true, key.verify_pss("SHA256", sig_pss, data,
===============================================================================================
E
===============================================================================================
Error: test_sign_verify_pss(OpenSSL::TestPKeyRSA): OpenSSL::PKey::RSAError: digest not allowed (digest=SHA1)
/mnt/git/ruby/openssl/test/openssl/test_pkey_rsa.rb:191:in 'OpenSSL::PKey::RSA#sign_pss'
/mnt/git/ruby/openssl/test/openssl/test_pkey_rsa.rb:191:in 'OpenSSL::TestPKeyRSA#test_sign_verify_pss'
     188:     data = "Sign me!"
     189:     invalid_data = "Sign me?"
     190:
  => 191:     signature = key.sign_pss("SHA256", data, salt_length: 20, mgf1_hash: "SHA1")
     192:     assert_equal 256, signature.bytesize
     193:     assert_equal true,
     194:       key.verify_pss("SHA256", signature, data, salt_length: 20, mgf1_hash: "SHA1")
===============================================================================================
...
577 tests, 4186 assertions, 0 failures, 2 errors, 0 pendings, 3 omissions, 0 notifications
```

[1] https://en.wikipedia.org/wiki/Probabilistic_signature_scheme
[2] https://fedoraproject.org/wiki/Changes/OpenSSLDistrustSHA1SigVer

e0e771b76f
2025-04-08 17:46:42 +00:00
Eileen
5aa05f179c
Fix lldb debug scripts (#13048)
In ruby/ruby#13008 `RVALUE` was removed without replacement. This means
the lldb scripts that relied on `RVALUE` stopped working.

I updated the ones that were using it just for the bytesize to use
`slot_size` and then round to the nearest power of 40. We can't use
`slot_size` directly because in debug mode it's `48` but `RVALUE` is
`40` bytes.

For the `as_type` method, I updated it to check the type. It's only used
for `bignum` and `array` so that's a simple change.

Lastly, for the `dump_page` method I replaced it with `struct free_slot`
since that's looking at the freelist.

`struct RVALUE` has been removed from all the scripts and I verified
that `rp` is fixed. I'm not confident the `dump_page` method is fixed,
the freelist looks off, but for now this gets us closer.
2025-04-08 12:52:49 -04:00
Hiroshi SHIBATA
b68fe530f1
Windows 11 24H2 with VS 2019 16.11.45 couldn't handle long name test
```
  2) Error:
TestDir#test_children_long_name:
Test::Unit::ProxyError: No such file or directory @ apply2files - C:/Users/hsbt/AppData/Local/Temp/rubytest.zxydnz/d20250408-35424-2b0o6e/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/c
    V:/github.com/ruby/ruby/test/ruby/test_dir.rb:653:in 'File.unlink'
    V:/github.com/ruby/ruby/test/ruby/test_dir.rb:653:in 'block in TestDir#test_children_long_name'
    V:/github.com/ruby/ruby/lib/tmpdir.rb:105:in 'Dir.mktmpdir'
    V:/github.com/ruby/ruby/test/ruby/test_dir.rb:646:in 'TestDir#test_children_long_name'
```
2025-04-08 15:46:45 +09:00
Hiroshi SHIBATA
10d6ee6554
Skip some assertions of TestFileExhaustive#test_dirname with Windows platform.
These assertions didn't handle drive letter of Windows

```
  1) Failure:
TestFileExhaustive#test_dirname [V:/github.com/ruby/ruby/test/ruby/test_file_exhaustive.rb:1282]:
<"V:/"> expected but was
<"C:/">.
```
2025-04-08 15:46:45 +09:00
Kunshan Wang
d17ab5a430 [ruby/mmtk] Do root scanning in scan_vm_specific_roots
We rely on scan_vm_specific_roots to reach all stacks via the following
path:

    VM -> ractors -> threads -> fibers -> stacks

0a6a835aaa
2025-04-08 03:12:50 +00:00
John Hawthorn
b3b1d7b295 Remove spinlock in dtoa's Balloc, use xmalloc
The spinlock here performs poorly when there are multiple Ractors. The
improvement on single threaded performance doesn't seem that
significant, so I think we should just use malloc.
2025-04-07 16:56:44 -07:00
Kanstantsin Shautsou
4646ab8917 Use correct warn method 2025-04-07 16:37:39 +02:00
Peter Zhu
e3abdfbc84 Skip test_heaps_grow_independently for MMTk 2025-04-07 09:41:11 -04:00
Peter Zhu
d4406f0627 Grow GC heaps independently
[Bug #21214]

If we allocate objects where one heap holds transient objects and another
holds long lived objects, then the heap with transient objects will grow
along the heap with long lived objects, causing higher memory usage.

For example, we can see this issue in this script:

    def allocate_small_object = []
    def allocate_large_object = Array.new(10)

    arys = Array.new(1_000_000) do
      # Allocate 10 small transient objects
      10.times { allocate_small_object }
      # Allocate 1 large object that is persistent
      allocate_large_object
    end

    pp GC.stat
    pp GC.stat_heap

Before this change:

    heap_live_slots: 2837243
    {0 =>
      {slot_size: 40,
       heap_eden_pages: 1123,
       heap_eden_slots: 1838807},
     2 =>
      {slot_size: 160,
       heap_eden_pages: 2449,
       heap_eden_slots: 1001149},
    }

After this change:

    heap_live_slots: 1094474
    {0 =>
      {slot_size: 40,
       heap_eden_pages: 58,
       heap_eden_slots: 94973},
     2 =>
      {slot_size: 160,
       heap_eden_pages: 2449,
       heap_eden_slots: 1001149},
    }
2025-04-07 09:41:11 -04:00
Jean Boussier
432e5fa7e4 prism_compile.c: Avoid zero length allocation
The constant pool may be empty.
2025-04-07 12:00:09 +02:00
git
135e5bff9a Update bundled gems list at d485638a08 [ci skip] 2025-04-07 06:11:34 +00:00
Hiroshi SHIBATA
d485638a08 Allow win32ole test failure
```
D:/a/ruby/ruby/src/gems/src/win32ole/test/win32ole/test_win32ole_event.rb:80:in 'TestWIN32OLE_EVENT_SWbemSink#default_handler': undefined method '+' for nil (NoMethodError)
```

4007208388
2025-04-07 15:10:58 +09:00
Hiroshi SHIBATA
f70bf78403 Fixed wrong condition to avoid flaky ractor_test.rb 2025-04-07 15:10:58 +09:00
Hiroshi SHIBATA
be5dea9720 Rename test command for test-unit
b7d3c32f6e
2025-04-07 15:10:58 +09:00
Hiroshi SHIBATA
a4b4dad4ba Update bundled_gems 2025-04-07 15:10:58 +09:00
Yusuke Endoh
3a7b9ca93b Fix Integer.sqrt to never exceed actual value
`Integer.sqrt` uses `sqrt(3)` from libm for small values.
This method must return a value less than or equal to the actual integer
square root, but libm's sqrt does not always guarantee that.

This change corrects that by decrementing the result if necessary.

Fixes [Bug #21217]
2025-04-07 11:08:10 +09:00
Nobuyoshi Nakada
e25889951f
Ensure builtin binaries are aligned to ibf_header
Since IBF result string size should be multiple of 4, this should not
increase the binary size actually.
2025-04-06 12:24:23 +09:00
Naoto Ono
b5ac483d95
Fix the if condition to skip test_ractor.rb correctly (#13067)
Follow-up for a2b03ba7cb
2025-04-06 09:38:58 +09:00
Nobuyoshi Nakada
229784d160
[Bug #21150] macOS: unwinding coroutine workaround is only for arm64 2025-04-05 10:31:20 +09:00
Jean Boussier
085cc6e434 Ractor: revert to moving object bytes, but size pool aware
Using `rb_obj_clone` introduce other problems, such as `initialize_*`
callbacks invocation in the context of the parent ractor.

So we can revert back to copy the content of the object slots,
but in a way that is aware of size pools.
2025-04-04 16:26:29 +02:00
Nobuyoshi Nakada
eb765913c1
Console Cntl event is sent to root process sharing the console 2025-04-04 19:34:04 +09:00
Nobuyoshi Nakada
cec45aedb5
Cannot send signal to process group on Windows 2025-04-04 16:24:49 +09:00
Nobuyoshi Nakada
d22e766042
Cannot send SIGTERM to another process on Windows 2025-04-04 16:24:48 +09:00
Hiroshi SHIBATA
0251abca7f
Fixed mismatched indentation 2025-04-04 14:23:25 +09:00
Hiroshi SHIBATA
705a95323e
Removed unused variable 2025-04-04 14:21:05 +09:00
Hiroshi SHIBATA
b4a94011ca
Hardening auto-merge workflow
https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions#enabling-automerge-on-a-pull-request
2025-04-04 11:58:59 +09:00
git
cd8c203ffb Update bundled gems list at 05e74543f6 [ci skip] 2025-04-04 01:22:09 +00:00
Hiroshi SHIBATA
05e74543f6 Update bundled_gems 2025-04-04 10:21:31 +09:00
David Rodríguez
710bf4a472 [rubygems/rubygems] Rubyinstaller2 fixed this
08b3c48f41
2025-04-04 08:54:47 +09:00
David Rodríguez
f8c0225971 [rubygems/rubygems] Improve bug report instructions
* Explicitly recommend copying full command output and not just the bug
  report template part.
* Include quadruple quotes in the "What actually happened section" and
  tell users to copy full command output inside. Hopefully quadruple
  quotes will make the error report information (which includes triple
  quotes itself) render fine by default.
* Avoid "actually" as per quality_spec.rb recommendation.

0a3bf2edb1
2025-04-04 08:54:47 +09:00
Kazuki Yamaguchi
6b5e187d0e [ruby/openssl] pkcs7: fix test failure on RHEL 9
The test case test_split_content fails on RHEL 9 and Fedora 41 because
their OpenSSL packages do not accept SHA-1 signatures. This was only
caught after commit 69fd7f8863 added the missing assertion.

While the example PKCS#7 structures could be simply regenerated with
SHA-256, this test case could be simplified because it is checking two
different things.

Replace test_split_content with separate test cases: one verifying
signed-data authenticatedAttributes and another for decoding BER input.

Fixes https://github.com/ruby/openssl/issues/875

b32406b0c1
2025-04-03 17:58:30 +00:00
Kazuki Yamaguchi
3911113bc4 [ruby/openssl] pkcs7: update test case test_graceful_parsing_failure
Using test_pkcs7.rb as an example invalid input is not reliable because
we may happen to include a valid PKCS#7 PEM block in a heredoc.

76fead26d2
2025-04-03 17:58:29 +00:00
John Hawthorn
137b51e4d3 Remove rb_gc_start from cancel_single_ractor_mode
In 307732ccee Ractors were changed to
explicitly run GC when the first non-main one was activated in order to
disable the transient heap. Theap no longer exists so I don't think we
need to do this.
2025-04-03 10:39:47 -07:00
John Hawthorn
5eb3efcf2d Fix timeline_value not being marked in test
T_DATA with a NULL pointer are not marked. Let's wrap 1 instead to
ensure that our mark function is actually run.
2025-04-03 10:39:47 -07:00
Jean Boussier
4aa74b605c compile.c: avoid allocating 0 length call_data
if `body->ci_size` is `0`, there's no point allocating 0B,
it just wastes an entry in the allocator.
2025-04-03 16:57:57 +02:00
Hiroshi SHIBATA
fab133e629 Use EnvUtil.apply_timeout_scale 2025-04-03 20:03:18 +09:00
Hiroshi SHIBATA
3f152ce767 Extend open_timeout for test failure on s390x
20250403T060004Z.fail.html.gz
2025-04-03 20:03:18 +09:00
Nobuyoshi Nakada
1dddc6c78b
Remove no longer used union
IMEMO_NEW takes just one memo value, min/max argc are assigned
directly and packed argc is not used.
2025-04-03 16:56:24 +09:00
Jeremy Evans
29dafa5fc2 Fix assertion failure with anonymous splats
When calling a method that accepts an anonymous splat and literal
keywords without any arguments, an assertion failure was previously
raised. Set rest_index to 0 when setting rest to the frozen hash,
so the args_argc calculation is accurate.

While here, add more tests for methods with anonymous splats with
and without keywords and keyword splats to confirm behavior is
correct.

Also add a basic bootstrap test that would hit the previous assertion
failure.

Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
2025-04-02 19:31:05 -07:00
Herwin
b8e2bec914 Grammar fix in doc/exceptions.md: there => they're 2025-04-03 10:14:58 +09:00
Hiroshi SHIBATA
1598a2cab8 Enforce to use CMake 3 because CMake 4 is not compatible to build libyaml via vcpkg 2025-04-03 10:12:34 +09:00
Earlopain
d543fda433 [ruby/prism] Be explicit in tests which files parser can't parse
It also updates to latest `parser`, which allows numbered
parameters in pattern matching pin,
passing `patterns.txt` and `case.txt`

bdcc8b3dc5
2025-04-02 20:53:34 +00:00
Earlopain
334c261cc9 [ruby/prism] Fix parser translator when splatting in pattern matching pin
Because it ends up treating it as a local variable, and `a.x`
is not a valid local variable name.

I'm not big on pattern matching, but conceptually it makes sense to me
to treat anything inside ^() to not be
pattern matching syntax?

80dbd85c45
2025-04-02 20:51:54 +00:00