Commit graph

90590 commits

Author SHA1 Message Date
Nobuyoshi Nakada
47d75b65bf Make wrapper of main for wasm more generic 2025-03-16 17:33:58 +09:00
Nobuyoshi Nakada
453f88f7f1 Make ASAN default option string built-in libruby
The content depends on ruby internal, not responsibility of the
caller.  Revive `RUBY_GLOBAL_SETUP` macro to define the hook function.
2025-03-16 17:33:58 +09:00
Nobuyoshi Nakada
f23146f09f
Fix enums in comparisons 2025-03-16 12:27:56 +09:00
Nobuyoshi Nakada
06919949a6
[Bug #21141] [DOC] Clarify what time is in UTC 2025-03-16 12:09:18 +09:00
Nobuyoshi Nakada
35920f7a44
Refine TestSocket_TCPSocket#test_initialize_failure
* Use `assert_raise_kind_of` instead of `rescue` and `flunk`.
* Use `assert_include` for the pattern that may contain regexp meta
  characters.
2025-03-15 16:02:19 +09:00
Nobuyoshi Nakada
29c0ca58c2 Test for the crash 2025-03-15 15:50:46 +09:00
Luke Jahnke
b148dfef5a Fix crash in TCPSocket.open
Fix segfault crash observable with TCPSocket.open(nil, nil)
2025-03-15 15:50:46 +09:00
Burdette Lamar
efb2d43637
[DOC] Tweaks for Hash#to_h (#12918) 2025-03-14 10:41:27 -04:00
Jean Boussier
de48e47ddf Invoke inherited callbacks before const_added
[Misc #21143]

Conceptually this makes sense and is more consistent with using
the `Name = Class.new(Superclass)` alternative method.

However the new class is still named before `inherited` is called.
2025-03-14 09:51:57 +01:00
ydah
dd7deef338 Organize block_param_def by defining opt_block_param for non-terminal symbols 2025-03-14 17:10:33 +09:00
ydah
f5f1951808 Refactor parse.y to replace tIDENTIFIER and tCONSTANT with ident_or_const inline rules 2025-03-14 12:32:03 +09:00
BurdetteLamar
a4328a424b [DOC] Tweaks for Hash#to_hash 2025-03-13 21:12:08 -04:00
BurdetteLamar
057ee25d1b [DOC] Tweaks for Hash#to_proc 2025-03-13 21:11:47 -04:00
Aaron Patterson
ae7890df33 Use the EC parameter in instructions.
The forwarding instructions should use the `ec` parameter passed to
vm_exec_core instead of trying to look up the EC via `GET_EC()`.  It's
cheaper to get the local than to try looking up a global
2025-03-13 15:21:37 -07:00
ydah
84f51eb02a Use user defined parameterizing rules args_tail_basic 2025-03-14 00:20:35 +09:00
Kevin Newton
f2483c79fe [ruby/prism] Use Set.new over to_set
422d5c4c64
2025-03-13 14:24:48 +00:00
Peter Zhu
31cf2684b0 Output object_id in object metadata for MMTk 2025-03-13 10:12:24 -04:00
Peter Zhu
bdb25959fb Move object_id to flags for ObjectSpace dumps
Moving object_id dumping from ObjectSpace to the GC flags allows ObjectSpace
to not assume the FL_SEEN_OBJ_ID flag and instead move it to the responsibility
of the GC.
2025-03-13 10:12:24 -04:00
Earlopain
3d4c7c3802 [ruby/prism] Use reverse_each in the parser translator
Avoids an array allocation which matters more and more
the larger the file is.

I have it at 14% of runtime.

f65b90f27d
2025-03-13 13:52:45 +00:00
Earlopain
67e6ccb23f [ruby/prism] Optimize array inclusion checks in the parser translator
I see `Array.include?` as 2.4% runtime. Probably because of `LPAREN_CONVERSION_TOKEN_TYPES` but
the others will be faster as well.

Also remove some inline array checks. They are specifically optimized in Ruby since 3.4, but for now prism is for >= 2.7

ca9500a3fc
2025-03-13 13:52:45 +00:00
Yusuke Endoh
ee1f39ef88 Add a document to autoload
Users are responsible for avoiding circular autoload.

[Misc #21154]
2025-03-13 22:08:01 +09:00
Earlopain
4b844f7d9e [ruby/prism] Ensure backwards compatibility with the custom parser builder
Temoprary backwards-compat code so that current users
don't break.

Eventually the Translation::Parser initializer should asser that the correct class is passed in.

66b0162b35
2025-03-13 12:06:58 +00:00
Earlopain
7c88cbb4a6 [Feature #20971] Deprecate rb_path_check
https://bugs.ruby-lang.org/issues/20971
2025-03-13 18:43:48 +09:00
git
faa8ccb685 Update bundled gems list as of 2025-03-12 2025-03-13 07:01:36 +00:00
Yutaro Ohno
482b5307f2 [DOC] Correct output in calling_methods.rdoc 2025-03-13 13:43:36 +09:00
Hiroshi SHIBATA
f9aadc62ed Use ghcr.io/ruby/fedora:latest instead of docker.io for avoiding rate limit 2025-03-13 13:08:15 +09:00
git
200bf3134a Update default gems list at 069ecfe869 [ci skip] 2025-03-13 01:43:37 +00:00
Jean Boussier
069ecfe869 [ruby/json] Release 2.10.2
350c1fd154
2025-03-13 10:33:38 +09:00
Jean Boussier
e6a2cf9fd7
[ruby/json] Fix potential out of bound read in json_string_unescape.
cf242d89a0
2025-03-13 10:33:25 +09:00
Hartley McGuire
8cc85dc00f [rubygems/rubygems] Remove array allocation from Candidate#<=>
In a large application I profiled allocations while running `bundle
update` and found that this method was ~60% of allocations while
resolving (and Candidate#<=> is almost half of the total runtime).

This commit removes the array allocation in Candidate#<=> (and similar
methods since the implementations are so simple). The array is always
the same two elements so they can just be compared directly.

6a7c411ba7
2025-03-13 10:24:21 +09:00
Kevin Newton
af76b7f4d9 [ruby/prism] Revert "Mark extension as Ractor-safe"
56eaf53732
2025-03-12 19:56:22 +00:00
Kevin Newton
242e99eb0f [ruby/prism] Mark extension as Ractor-safe
10e5431b38
2025-03-12 19:15:03 +00:00
Alan Wu
08b3a45bc9 Push a real iseq in rb_vm_push_frame_fname()
Previously, vm_make_env_each() (used during proc
creation and for the debug inspector C API) picked up the
non-GC-allocated iseq that rb_vm_push_frame_fname() creates,
which led to a SEGV when the GC tried to mark the non GC object.

Put a real iseq imemo instead. Speed should be about the same since
the old code also did a imemo allocation and a malloc allocation.

Real iseq allows ironing out the special-casing of dummy frames in
rb_execution_context_mark() and rb_execution_context_update(). A check
is added to RubyVM::ISeq#eval, though, to stop attempts to run dummy
iseqs.

[Bug #21180]

Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
2025-03-12 15:00:26 -04:00
Alan Wu
9b9661883b Have ast live longer in ISeq.compile_file to fix GC stress crash
Previously, live range of `ast_value` ended on the call right before
rb_ast_dispose(), which led to premature collection and use-after-free.

We observed this crashing on -O3, -DVM_CHECK_MODE, with GCC 11.4.0 on
Ubuntu.

Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
2025-03-12 15:00:26 -04:00
Peter Zhu
a8d63ecdb8 Fix flaky test_AREF_fstring_key
The code between the two ObjectSpace.count_objects could trigger a GC,
which could free string objects causing this test to fail.

We can see this failure on CI http://ci.rvm.jp/results/trunk-random2@ruby-sp2-noble-docker/5651016

    TestHashOnly#test_AREF_fstring_key [test/ruby/test_hash.rb:1991]:
    <197483> expected but was
    <129689>.
2025-03-12 13:27:03 -04:00
Sarun Rattanasiri
9ec8dc9c65 [ruby/openssl] mark initialize_copy as :nodoc:
17f87d2cf0
2025-03-12 16:03:47 +00:00
Nobuyoshi Nakada
b8af9325c0
[DOC] Discourage use of USERDEF 2025-03-12 18:42:39 +09:00
Nobuyoshi Nakada
9459bedd84
[Bug #19841] Refine error on marshaling recursive USERDEF 2025-03-12 18:42:38 +09:00
Nobuyoshi Nakada
2782cc75a9
Win32: Remove intermediate files for rubyspec-capiext 2025-03-12 18:20:40 +09:00
Nobuyoshi Nakada
3239af9b5d
Win32: Make object files in the same place as the DLLs 2025-03-12 18:20:39 +09:00
Hiroshi SHIBATA
1a222816fb Restore to use rm_rf for failing example
3861666452
2025-03-12 18:02:09 +09:00
Jean Boussier
1d07deb422 [ruby/json] Raise a ParserError on all incomplete unicode escape sequence.
This was the behavior until `2.10.0` unadvertently changed it.

`"\u1"` would raise, but `"\u1zzz"` wouldn't.

7d0637b9e6
2025-03-12 18:02:09 +09:00
Hiroshi SHIBATA
de9ce8c0e0 Use erb executable again
Co-authored-by: David Rodríguez <deivid.rodriguez@riseup.net>
2025-03-12 18:02:09 +09:00
Jacob Atzen
63dbb2f8a2 [rubygems/rubygems] Update docs for with/without consistency
The with and without flags accepts both comma and space separated values.

b6149f61e3
2025-03-12 18:02:09 +09:00
David Rodríguez
510edbccf9 [rubygems/rubygems] Fix ENAMETOOLONG error when creating compact index cache
If a custom rubygems source URI is long enough, Bundler may end up
raising an `ENAMETOOLONG` error and crash.

This commit fixes the problem by trimming the cache slug size to fit
usual OS requirements.

df40ff1e14

Co-authored-by: mbclu <mbclu@users.noreply.github.com>
Co-authored-by: martinemde <martinemde@users.noreply.github.com>
2025-03-12 18:02:09 +09:00
David Rodríguez
13020ac069 [rubygems/rubygems] Path helper to build paths in compact index cache
d28f9b8515
2025-03-12 18:02:09 +09:00
David Rodríguez
51958bae66 [rubygems/rubygems] Prefer FileUtils.rm_r to FileUtils.rm_rf for specs
Because it does not swallow errors if it fails to remove the given
folders, making issues easier to debug.

0db12d7afc
2025-03-12 18:02:09 +09:00
David Rodríguez
f656d34f10 [rubygems/rubygems] Refactor specs to not try to remove folders that don't exist
This has the following benefits:

* Avoid duplicated work in some specs that first build a repo, and then
  overwrite it with a completely different set of gems.
* Reduce RSpec nesting and improve readability.
* The change also made surfaces several specs that were incorrect since
  they were unintentionally not testing the right thing.

ed430883e0
2025-03-12 18:02:09 +09:00
Naoto Ono
c68088038f
Launchable: Disable request retries when a timeout exception occurs (#12877)
When a Launchable server is unstable, a ReadTimeoutException occurs in the Launchable CLI. In such case, the Launchable CLI retries requests, which slows down CI execution. In this PR, I configured the environment variable SKIP_TIMEOUT_RETRY to disable retry attempts on requests(Link: https://github.com/launchableinc/cli/pull/992).

```
WARNING:urllib3.connectionpool:Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='api.mercury.launchableinc.com', port=443): Read timed out. (read timeout=15)")': /intake/organizations/ruby/workspaces/ruby/commits/collect/options
  WARNING:urllib3.connectionpool:Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='api.mercury.launchableinc.com', port=443): Read timed out. (read timeout=15)")': /intake/organizations/ruby/workspaces/ruby/commits/collect/options
  WARNING:urllib3.connectionpool:Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='api.mercury.launchableinc.com', port=443): Read timed out. (read timeout=15)")': /intake/organizations/ruby/workspaces/ruby/commits/collect/options
  HTTPSConnectionPool(host='api.mercury.launchableinc.com', port=443): Max retries exceeded with url: /intake/organizations/ruby/workspaces/ruby/commits/collect/options (Caused by ReadTimeoutError("HTTPSConnectionPool(host='api.mercury.launchableinc.com', port=443): Read timed out. (read timeout=15)"))
  Exception in thread "main" javax.net.ssl.SSLException: Connection reset
  	at sun.security.ssl.Alert.createSSLException(Alert.java:127)
  	at sun.security.ssl.TransportContext.fatal(TransportContext.java:331)
  	at sun.security.ssl.TransportContext.fatal(TransportContext.java:274)
  	at sun.security.ssl.TransportContext.fatal(TransportContext.java:269)
  	at sun.security.ssl.SSLSocketImpl.handleException(SSLSocketImpl.java:1572)
  	at sun.security.ssl.SSLSocketImpl.access$400(SSLSocketImpl.java:73)
  	at sun.security.ssl.SSLSocketImpl$AppInputStream.read(SSLSocketImpl.java:982)
  	at org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.java:137)
  	at org.apache.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInputBufferImpl.java:153)
  	at org.apache.http.impl.io.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:280)
  	at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:138)
  	at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56)
  	at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259)
  	at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:163)
  	at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:157)
  	at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273)
  	at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)
  	at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:272)
  	at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186)
  	at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
  	at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
  	at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
  	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
  	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:108)
  	at com.launchableinc.ingest.commits.CommitGraphCollector.transfer(CommitGraphCollector.java:131)
  	at com.launchableinc.ingest.commits.CommitIngester.run(CommitIngester.java:145)
  	at com.launchableinc.ingest.commits.CommitIngester.main(CommitIngester.java:72)
  	Suppressed: java.net.SocketException: Broken pipe (Write failed)
  		at java.net.SocketOutputStream.socketWrite0(Native Method)
  		at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:111)
  		at java.net.SocketOutputStream.write(SocketOutputStream.java:155)
  		at sun.security.ssl.SSLSocketOutputRecord.encodeAlert(SSLSocketOutputRecord.java:81)
  		at sun.security.ssl.TransportContext.fatal(TransportContext.java:362)
  		... 25 more
  Caused by: java.net.SocketException: Connection reset
  	at java.net.SocketInputStream.read(SocketInputStream.java:210)
  	at java.net.SocketInputStream.read(SocketInputStream.java:141)
  	at sun.security.ssl.SSLSocketInputRecord.read(SSLSocketInputRecord.java:464)
  	at sun.security.ssl.SSLSocketInputRecord.bytesInCompletePacket(SSLSocketInputRecord.java:68)
  	at sun.security.ssl.SSLSocketImpl.readApplicationRecord(SSLSocketImpl.java:1350)
  	at sun.security.ssl.SSLSocketImpl.access$300(SSLSocketImpl.java:73)
  	at sun.security.ssl.SSLSocketImpl$AppInputStream.read(SSLSocketImpl.java:966)
  	... 20 more
  Couldn't get commit history from `/github/workspace/src`. Do you run command root of git-controlled directory? If not, please set a directory use by --source option.
  HTTPSConnectionPool(host='api.mercury.launchableinc.com', port=443): Read timed out. (read timeout=60)
  Command '['java', '-jar', '/root/.local/pipx/venvs/launchable/lib/python3.10/site-packages/launchable/jar/exe_deploy.jar', 'ingest:commit', '-endpoint', 
```

3793952924
2025-03-12 02:34:03 +00:00
git
9ef9069c3d Update bundled gems list at 1ba93fdfd2 [ci skip] 2025-03-12 02:06:13 +00:00