90918 Commits

Author SHA1 Message Date
ydah
e996699820 Refactor assignment rules to remove unnecessary lhs parameter 2025-04-14 01:15:20 +09:00
Haruna Tsujita
3700ae2e99
Fix typos finised -> finished (#13104) 2025-04-13 20:46:40 +09:00
Nobuyoshi Nakada
8c9cd65d82
Fix unnecessary false in CLEANLIBS 2025-04-13 16:53:18 +09:00
git
cfa74dda45 Update bundled gems list as of 2025-04-13 2025-04-13 07:00:08 +00:00
Daniel Colson
29b26fd3e7 Fix macro for disabled match cache
The `MEMOIZE_LOOKAROUND_MATCH_CACHE_POINT` macro needs an argument
otherwise we end up with:

```
../regexec.c:3955:2: error: called object type 'void' is not a function or function pointer
 3955 |         STACK_POS_END(stkp);
      |         ^~~~~~~~~~~~~~~~~~~
../regexec.c:1680:41: note: expanded from macro 'STACK_POS_END'
 1680 |     MEMOIZE_LOOKAROUND_MATCH_CACHE_POINT(k);\
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
../regexec.c:3969:7: error: called object type 'void' is not a function or function pointer
 3969 |       STACK_POP_TIL_POS_NOT;
      |       ^~~~~~~~~~~~~~~~~~~~~
../regexec.c:1616:41: note: expanded from macro 'STACK_POP_TIL_POS_NOT'
 1616 |     MEMOIZE_LOOKAROUND_MATCH_CACHE_POINT(stk);\
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
```

The macro definition with the match cache enabled already has the
correct argument. This one is for when the match cache is disabled (I
had disabled it while trying to learn more about how it works.)
2025-04-13 11:44:49 +09:00
viralpraxis
543dd77cc3 [ruby/prism] Fix parsing rescued exception via indexed assignment
Given this code

```ruby
begin
  raise '42'
rescue => A[]
end
```

Prism fails with this backtrace

```
Error: test_unparser/corpus/literal/rescue.txt(Prism::ParserTest): NoMethodError: undefined method `arguments' for nil
prism/lib/prism/translation/parser/compiler.rb:1055:in `visit_index_target_node'
prism/lib/prism/node.rb:9636:in `accept'
prism/lib/prism/compiler.rb:30:in `visit'
prism/lib/prism/translation/parser/compiler.rb:218:in `visit_begin_node'
```

Seems like

```diff
-            visit_all(node.arguments.arguments),
+            visit_all(node.arguments&.arguments || []),
```

fixes the problem.

https://github.com/ruby/prism/commit/76d01aeb6c
2025-04-12 17:43:57 +00:00
ydah
a35a101b4c Change the indent after lhs in generation rules from spaces to tabs
Change the indent to match the characters used in other generation rules. This makes it easier to find lhs.
2025-04-13 01:23:39 +09:00
Aaron Patterson
3628e9e30d Remove unused field on Thread struct
It looks like stat_insn_usage was introduced with YARV, but as far as I
can tell the field has never been used.  I think we should remove the
field since we don't use it.
2025-04-11 10:28:26 -07:00
Hiroshi SHIBATA
0a35c5b4d9 Restore Windows 2022 build with VS2019 toolset 2025-04-11 13:24:03 +09:00
Hiroshi SHIBATA
8a15f80653 Fixed wrong usage of matrix.vs. That label is os version, not vs version 2025-04-11 12:18:56 +09:00
Hiroshi SHIBATA
0e79279327
Note the detailed version of Visual Studio 2025-04-11 11:11:38 +09:00
Hiroshi SHIBATA
a2b39e5ca6
Added instruction for autocrlf issue of Git on Windows 2025-04-11 11:01:05 +09:00
Hiroshi SHIBATA
1bd029b1ea
Note the detailed version of Windows SDK 2025-04-11 10:55:31 +09:00
Hiroshi SHIBATA
af69421c91
Added instruction for MSYS2 without RubyInstaller-Devkit 2025-04-11 10:49:26 +09:00
John Hawthorn
f13e86a70e Allow gdb's rp to work on classes offline
It's useful to be able to get information about classes without a
running process, ie. when debugging a coredump.
2025-04-10 11:33:46 -07:00
HoneyryderChuck
e3dd766e99 [ruby/resolv] refactoring class-hash to be ractor-safe
mutable constants can't be shared across ractors; this changes that design to define the required variables as constants on the Resource class, which makes them reachable using ractors; the ClassHash is kept in order not to break integrations relying on its existence, but under the hood it's doing the same thing

https://github.com/ruby/resolv/commit/639c01dc7f
2025-04-10 15:58:04 +00:00
HoneyryderChuck
54a85caed4 [ruby/resolv] config read from file should return frozen data!
https://github.com/ruby/resolv/commit/afb57f40a1
2025-04-10 15:58:03 +00:00
David Rodríguez
756479324f Sync Bundler and adapt to new spec setup 2025-04-10 19:21:51 +09:00
Hiroshi SHIBATA
684cfa42d7 Avoid to infinite require loop for irb.
if irb and that dependency are broken, it caused infinite loop with force_activate("irb").
2025-04-10 18:44:40 +09:00
Nobuyoshi Nakada
8003a06854
[DOC] Use slashes in mingw confiure examples
To show that mingw `sh` expects forward slashes as path separators, not
backslashes, configure in another directory than the source directory.
2025-04-10 17:39:56 +09:00
Xavier Noria
08ce6268ee Document order of execution const_added vs inherited 2025-04-10 10:33:36 +02:00
Hiroshi SHIBATA
b47a04eb91 Refactor bundled condition 2025-04-10 17:29:39 +09:00
Hiroshi SHIBATA
598b0e8b72 The current force_activate always fails without Gemfile 2025-04-10 17:29:39 +09:00
Hiroshi SHIBATA
3390b6a515 Added simple failing example 2025-04-10 17:29:39 +09:00
Xavier Noria
c5c0bb5afc Restore the original order of const_added and inherited callbacks
Originally, if a class was defined with the class keyword, the cref had a
const_added callback, and the superclass an inherited callback, const_added was
called first, and inherited second.

This was discussed in

    https://bugs.ruby-lang.org/issues/21143

and an attempt at changing this order was made.

While both constant assignment and inheritance have happened before these
callbacks are invoked, it was deemed nice to have the same order as in

    C = Class.new

This was mostly for alignment: In that last use case things happen at different
times and therefore the order of execution is kind of obvious, whereas when the
class keyword is involved, the order is opaque to the user and it is up to the
interpreter.

However, soon in

    https://bugs.ruby-lang.org/issues/21193

Matz decided to play safe and keep the existing order.

This reverts commits:

    de097fbe5f3df105bd2a26e72db06b0f5139bc1a
    de48e47ddf78aba02fd9623bc7ce685540a10743
2025-04-10 10:20:31 +02:00
Yusuke Endoh
0d6263bd41 Fix coverage measurement for negative line numbers
Fixes [Bug #21220]

Co-Authored-By: Mike Bourgeous <mike@mikebourgeous.com>
Co-Authored-By: Jean Boussier <jean.boussier@gmail.com>
2025-04-09 23:45:54 +09:00
Nobuyoshi Nakada
ce0d5cc069
Refine dirname test on Windows
- Compare with the root of the target file
- Fix root path of UNC path
2025-04-09 19:14:36 +09:00
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
https://github.com/rubygems/rubygems/commit/5b312fd040
2025-04-09 08:11:10 +09:00
Jean Boussier
ae45a7a952 [ruby/json] Cleanup jeaiii-ltoa to not need pragmas
https://github.com/ruby/json/commit/97f2924d0a
2025-04-09 08:11:03 +09:00
Nobuyoshi Nakada
b1362e26c7 [ruby/json] Suppress -Wunknown-pragmas warnings
https://github.com/ruby/json/commit/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

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

https://github.com/ruby/mmtk/commit/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 d485638a08a4561cd2f9c28d29b6d0 [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)
```

https://github.com/ruby/ruby/actions/runs/14299035797/job/40072083885?pr=13078
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