summaryrefslogtreecommitdiff
path: root/ext
AgeCommit message (Collapse)Author
2025-12-24ext/-test-/scheduler/scheduler.c: explicitly ignore the result of writeYusuke Endoh
``` scheduler.c:44:5: warning: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 44 | write(blocking_state->notify_descriptor, "x", 1); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ```
2025-12-23[DOC] Fix backticks in Coverage.peek_resultPeter Zhu
2025-12-19Fix: Specifying 0 should cause an immediate timeout (#15641)Misaki Shioi
This change fixes a bug in which specifying 0 for timeout-related options (such as the `timeout` option of `Addrinfo.getaddrinfo`) incorrectly results in an infinite wait. (This change overwrites https://github.com/ruby/ruby/pull/15626 .)
2025-12-19Fix: Do not check open_timeout twice (#15626)Misaki Shioi
2025-12-17ObjectSpace.{dump,dump_all,dump_shapes} needs vm barrier. (#15569)Luke Gruber
This allows these methods to be called from ractors. Add new exported function `rb_vm_lock_with_barrier()` that requires users to include "vm_sync.h"
2025-12-17Add host information to timeout error messages in `TCPSocket.new` and ↵Misaki Shioi
`Socket.tcp` (#15582) This change adds host information to the error messages shown when a timeout occurs while passing timeout options to `TCPSocket.new` or `Socket.tcp`, for improved usability. (When the `fast_fallback option` is enabled, there may be multiple possible destinations, so the host name is shown instead of an IP address.) As part of this change, the error messages in `Addrinfo.getaddrinfo` and `Addrinfo#connect_internal`, both of which are used by `Socket.tcp`, have also been improved in the same way.
2025-12-17Bundle strscan-3.1.6Hiroshi SHIBATA
2025-12-17Bundle stringio-3.2.0Hiroshi SHIBATA
2025-12-17[ruby/psych] v5.3.1Hiroshi SHIBATA
https://github.com/ruby/psych/commit/8345af9ffb
2025-12-17`Socket.tcp` and `TCPSocket.new` raises `IO::TiemoutError` with user ↵Misaki Shioi
specified timeout (#15602) * `Socket.tcp` and `TCPSocket.new` raises `IO::TiemoutError` with user specified timeout In https://github.com/ruby/ruby/pull/11880, `rsock_connect()` was changed to raise `IO::TimeoutError` when a user-specified timeout occurs. However, when `TCPSocket.new` attempts to connect to multiple destinations, it does not use `rsock_connect()`, and instead raises `Errno::ETIMEDOUT` on timeout. As a result, the exception class raised on timeout could differ depending on whether there were multiple destinations or not. To align this behavior with the implementation of `rsock_connect()`, this change makes `TCPSocket.new` raise `IO::TimeoutError` when a user-specified timeout occurs. Similarly, `Socket.tcp` is updated to raise `IO::TimeoutError` when a timeout occurs within the method. (Note that the existing behavior of `Addrinfo#connect_internal`, which Socket.tcp depends on internally and which raises `Errno::ETIMEDOUT` on timeout, is not changed.) * [ruby/net-http] Raise `Net::OpenTimeout` when `TCPSocket.open` raises `IO::TimeoutError`. With the changes in https://github.com/ruby/ruby/pull/15602, `TCPSocket.open` now raises `IO::TimeoutError` when a user-specified timeout occurs. This change updates #connect to handle this case accordingly. https://github.com/ruby/net-http/commit/f64109e1cf
2025-12-17[ruby/io-wait] bump up to 0.4.0Nobuyoshi Nakada
https://github.com/ruby/io-wait/commit/ae676c9d6d
2025-12-17Fix: Recalculate the timeout duration considering `open_timeout` (#15596)Misaki Shioi
This change updates the behavior so that, when there is only a single destination and `open_timeout` is specified, the remaining `open_timeout` duration is used as the connection timeout.
2025-12-16Fix: Do not pass negative timeout to Addrinfo#connect_internal (#15578)Misaki Shioi
This change fixes a bug where, with `Socket.tcp`’s `fast_fallback option` disabled, specifying `open_timeout` could unintentionally pass a negative value to `Addrinfo#connect_internal`, `causing an ArgumentError`. ``` ❯ ruby -rsocket -e 'p Socket.tcp("localhost", 9292, open_timeout: 1, fast_fallback: false)' /Users/misaki-shioi/src/install/lib/ruby/4.0.0+0/socket.rb:64:in 'IO#wait_writable': time interval must not be negative (ArgumentError) sock.wait_writable(timeout) or ^^^^^^^ from /Users/misaki-shioi/src/install/lib/ruby/4.0.0+0/socket.rb:64:in 'Addrinfo#connect_internal' from /Users/misaki-shioi/src/install/lib/ruby/4.0.0+0/socket.rb:141:in 'Addrinfo#connect' from /Users/misaki-shioi/src/install/lib/ruby/4.0.0+0/socket.rb:964:in 'block in Socket.tcp_without_fast_fallback' from /Users/misaki-shioi/src/install/lib/ruby/4.0.0+0/socket.rb:231:in 'Array#each' from /Users/misaki-shioi/src/install/lib/ruby/4.0.0+0/socket.rb:231:in 'Addrinfo.foreach' from /Users/misaki-shioi/src/install/lib/ruby/4.0.0+0/socket.rb:945:in 'Socket.tcp_without_fast_fallback' from /Users/misaki-shioi/src/install/lib/ruby/4.0.0+0/socket.rb:671:in 'Socket.tcp' from -e:1:in '<main>' ```
2025-12-16Box: move extensions from namespace to boxNobuyoshi Nakada
2025-12-15[ruby/psych] Replace C extension with Data#initialize bind_callnick evans
https://github.com/ruby/psych/commit/6a826693ba
2025-12-15Revert "Fix Socket.tcp cleanup after Thread#kill (#15131)" (#15565)Luke Gruber
This reverts commit 3038286a4bf7832f1c42c8cc9774ee6ff19876fc. The following CI failure scared me: https://github.com/ruby/ruby/actions/runs/20241051861/job/58108997049 ``` 1) Timeout: TestResolvDNS#test_multiple_servers_with_timeout_and_truncated_tcp_fallback ``` Since it could be related, I'm reverting this for now.
2025-12-15Fix Socket.tcp cleanup after Thread#kill (#15131)Luke Gruber
Socket.tcp launches ruby threads to resolve hostnames, and those threads communicate through a queue implemented with `IO.pipe`. When the thread that called `Socket.tcp` is killed, the resolver threads still try to communicate through the pipe even though it may be closed. The method `Socket.tcp_with_fast_fallback` tries to deal with this by killing the threads in an ensure block, and then closing the pipe. However, calling `Thread#kill` is not a blocking operation, it only sets a flag on the thread telling it to raise during the next interrupt. The thread needs to be joined to ensure it is terminated. The following script demonstrates the issue: ```ruby require "socket" ts = [] 5.times do ts << Thread.new do loop do 1_000.times do |i| puts "#{i}" t = Thread.new do Socket.tcp("ruby-lang.org", 80) end sleep 0.001 t.kill end end end end ts.each(&:join) ``` output: ``` /Users/luke/workspace/ruby-dev/ruby-build-debug/.ext/common/socket.rb:1019:in 'IO#write': closed stream (IOError) from /Users/luke/workspace/ruby-dev/ruby-build-debug/.ext/common/socket.rb:1019:in 'IO#putc' from /Users/luke/workspace/ruby-dev/ruby-build-debug/.ext/common/socket.rb:1019:in 'block in Socket::HostnameResolutionResult#add' from /Users/luke/workspace/ruby-dev/ruby-build-debug/.ext/common/socket.rb:1017:in 'Thread::Mutex#synchronize' from /Users/luke/workspace/ruby-dev/ruby-build-debug/.ext/common/socket.rb:1017:in 'Socket::HostnameResolutionResult#add' from /Users/luke/workspace/ruby-dev/ruby-build-debug/.ext/common/socket.rb:980:in 'Socket.resolve_hostname' from /Users/luke/workspace/ruby-dev/ruby-build-debug/.ext/common/socket.rb:719:in 'block (2 levels) in Socket.tcp_with_fast_fallback' /Users/luke/workspace/ruby-dev/ruby-build-debug/.ext/common/socket.rb:1019:in 'IO#write': closed stream (IOError) from /Users/luke/workspace/ruby-dev/ruby-build-debug/.ext/common/socket.rb:1019:in 'IO#putc' from /Users/luke/workspace/ruby-dev/ruby-build-debug/.ext/common/socket.rb:1019:in 'block in Socket::HostnameResolutionResult#add' from /Users/luke/workspace/ruby-dev/ruby-build-debug/.ext/common/socket.rb:1017:in 'Thread::Mutex#synchronize' from /Users/luke/workspace/ruby-dev/ruby-build-debug/.ext/common/socket.rb:1017:in 'Socket::HostnameResolutionResult#add' from /Users/luke/workspace/ruby-dev/ruby-build-debug/.ext/common/socket.rb:978:in 'Socket.resolve_hostname' from /Users/luke/workspace/ruby-dev/ruby-build-debug/.ext/common/socket.rb:719:in 'block (2 levels) in Socket.tcp_with_fast_fallback' ```
2025-12-15[ruby/openssl] Ruby/OpenSSL 4.0.0Kazuki Yamaguchi
https://github.com/ruby/openssl/commit/5af1edab18
2025-12-15[ruby/openssl] ossl.c: improve docs for constants and methods under ::OpenSSLKazuki Yamaguchi
https://github.com/ruby/openssl/commit/b0de8ba9bd
2025-12-15[ruby/openssl] Freeze more constants for Ractor compatibilityKazuki Yamaguchi
https://github.com/ruby/openssl/commit/695126f582
2025-12-14[ruby/openssl] pkcs7: raise OpenSSL::PKCS7::PKCS7Error in #initializeKazuki Yamaguchi
When d2i_PKCS7_bio() and PEM_read_bio_PKCS7() fail to decode the input, OpenSSL::PKCS7.new currently raises ArgumentError. The usual practice in ruby/openssl where an error originates from the underlying OpenSSL library is to raise OpenSSL::OpenSSLError. Raise OpenSSL::PKCS7::PKCS7Error instead for consistency with OpenSSL::PKCS7.read_smime and all other existing #initialize methods that handle DER/PEM-encoded inputs. https://github.com/ruby/openssl/commit/67a608ce53
2025-12-14[ruby/openssl] x509cert: update doc for OpenSSL::X509::Certificate#==Kazuki Yamaguchi
Mention the underlying OpenSSL function. Add a note about the unreliable comparison when called on an incomplete object. Fixes https://github.com/ruby/openssl/issues/844 https://github.com/ruby/openssl/commit/736af5b3c7
2025-12-14[ruby/io-console] bump up to 0.8.2Nobuyoshi Nakada
https://github.com/ruby/io-console/commit/fbc7e1f31f
2025-12-14[Bug #21779] Uniquify `InitVM` functions as well as `Init`Nobuyoshi Nakada
Avoid possible name conflict when `--with-static-linked-ext`.
2025-12-14Removed duplicate codeNobuyoshi Nakada
2025-12-13[ruby/openssl] ossl.c: implement OpenSSL::OpenSSLError#detailed_messageKazuki Yamaguchi
An OpenSSL function sometimes puts more than one error entry into the thread-local OpenSSL error queue. Currently, we use the highest-level entry for generating the exception message and discard the rest. Let ossl_make_error() capture all current OpenSSL error queue contents into OpenSSL::OpenSSLError#errors and extend OpenSSL::OpenSSLError#detailed_message to include the information. An example: $ ruby -Ilib -ropenssl -e'OpenSSL::X509::ExtensionFactory.new.create_ext("a", "b")' -e:1:in 'OpenSSL::X509::ExtensionFactory#create_ext': a = b: error in extension (name=a, value=b) (OpenSSL::X509::ExtensionError) OpenSSL error queue reported 2 errors: error:11000082:X509 V3 routines:do_ext_nconf:unknown extension name error:11000080:X509 V3 routines:X509V3_EXT_nconf_int:error in extension (name=a, value=b) from -e:1:in '<main>' https://github.com/ruby/openssl/commit/d28f7a9a13
2025-12-13[ruby/io-console] strip trailing spaces [ci skip]Nobuyoshi Nakada
https://github.com/ruby/io-console/commit/379e7c17ed
2025-12-13[ruby/io-console] console_cursor_pos respects scroll position on windowsYO4
https://github.com/ruby/io-console/commit/ae33785820
2025-12-13[ruby/io-console] console_goto respects scroll position on windowsYO4
https://github.com/ruby/io-console/commit/d2a6c69697
2025-12-13[ruby/io-console] avoid jumping scroll position when winsize changedYO4
On windows, IO.console.winsize= now respects the current view area and screen buffer size. https://github.com/ruby/io-console/commit/817aa65ea3
2025-12-13[ruby/io-console] Remove useless rb_check_arity() callNobuyoshi Nakada
https://github.com/ruby/io-console/commit/df444b93f1
2025-12-12Avoid race condition in `test_without_handle_interrupt_signal_works`. (#15504)Samuel Williams
2025-12-12monitor.c: skip GET_EC() on exitJean Boussier
2025-12-11[ruby/psych] bump snakeyaml-engine to 2.10 (jruby)kares
https://github.com/ruby/psych/commit/506bf75ab2
2025-12-11[ruby/json] Release 2.18.0Jean Boussier
https://github.com/ruby/json/commit/1cdd2122d5
2025-12-11[ruby/json] Add `allow_control_characters` parsing optionJean Boussier
While it's not allowed by the spec, some parsers like Oj do accept it, and it can be blocking a transition. Having this feature can help people migrate. https://github.com/ruby/json/commit/3459499cb3
2025-12-10Remove object_id in NEWOBJ tracepoint testJean Boussier
Generating an object_id for any type other than T_OBJECT (and T_CLASS) will inevitably allocate an IMEMO/fields objects, which isn't supported in a NEWOBJ tracepoint. See: https://bugs.ruby-lang.org/issues/21710#note-23
2025-12-10Always treat encoding as TYPEDDATAJohn Hawthorn
Encodings are RTypedData, not the deprecated RData. Although the structures are compatible we should use the correct API.
2025-12-10[ruby/json] Add a specific error for unescaped newlinesJean Boussier
It's the most likely control character so it's worth giving a better error message for it. https://github.com/ruby/json/commit/1da3fd9233
2025-12-10Modernize Monitor TypedDataJean Boussier
Make it embedded and compaction aware.
2025-12-10Monitor: avoid repeated calls to `rb_fiber_current()`Jean Boussier
That call is surprisingly expensive, so trying doing it once in `#synchronize` and then passing the fiber to enter and exit saves quite a few cycles.
2025-12-10[ruby/win32-registry] v0.1.2Hiroshi SHIBATA
https://github.com/ruby/win32-registry/commit/2a6ab00f67
2025-12-10[ruby/date] v3.5.1Hiroshi SHIBATA
https://github.com/ruby/date/commit/1d0aadc295
2025-12-10[ruby/psych] v5.3.0Hiroshi SHIBATA
https://github.com/ruby/psych/commit/d8053b0d16
2025-12-10Add `NUM2PTR` and `PTR2NUM` macrosNobuyoshi Nakada
These macros have been defined here and there, so collect them.
2025-12-09[ruby/resolv] use domain suffix from 'Domain' instead of 'NV Domain'YO4
'NV Domain' does not change results of `powershell -command Get-DnsClientGlobalSetting`. 'Domain' do this. https://github.com/ruby/resolv/commit/d49e3d5b84
2025-12-08[ruby/resolv] Check the second RegGetValue typeNobuyoshi Nakada
https://github.com/ruby/resolv/commit/3678de9e30
2025-12-08[ruby/resolv] Fix warnings on cygwinNobuyoshi Nakada
https://github.com/ruby/resolv/commit/075e76f997
2025-12-08Make `ruby_reset_leap_second_info` internalNobuyoshi Nakada
It is exported only for the extension library to test, but the method is no longer used since 29e31e72fb5a14194a78ec974c4ba56c33ad8d45.
2025-12-06[ruby/stringio] [DOC] Tweaks for StringIO#pos=Burdette Lamar
(https://github.com/ruby/stringio/pull/194) https://github.com/ruby/stringio/commit/3cef1e0e5f