95849 Commits

Author SHA1 Message Date
Peter Zhu
55ea3ec00f Fix strict aliasing warning in rb_int128_to_numeric
If we don't have uint128, then rb_int128_to_numeric emits a strict
aliasing warning:

    numeric.c:3641:39: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
    3641 |         return rb_uint128_to_numeric(*(rb_uint128_t*)&n);
         |                                       ^~~~~~~~~~~~~~~~~
2025-12-08 15:01:05 -08:00
Étienne Barrié
66bda73190
Remove unused local variables in test/ruby/test_io_buffer.rb (#15451) 2025-12-09 10:58:35 +13:00
John Hawthorn
90a9b64238 Use rb_current_ec_noinline in ractor_{lock,unlock}
We're seeing an occasional crash on CI because this ends up inlined all
the way into ractor_wait_receive. On llvm (possibly other compilers) the
thread local address of ec ends up cached (not the value of ec, the
address ec is read from). So if we are migrated to another native
thread, that may be invalid.

Using rb_current_ec_noinline avoids this problems. It would be good to
adjust this code so that ec (or current ractor) is calculated once and
then passed through to both lock and unlock.
2025-12-08 11:48:20 -08:00
Nobuyoshi Nakada
e61b79b384
Fix a typo in the deprecation warning message 2025-12-09 02:16:45 +09:00
Koichi Sasada
bd752290e7 [ruby/timeout] Revert "Exclude constantly-failing test on x86_64-darwin"
This reverts commit https://github.com/ruby/timeout/commit/45816b1b2602.

https://github.com/ruby/timeout/commit/b54f91e9dd
2025-12-08 17:06:19 +00:00
Max Bernstein
fd45496f91
Update ZJIT docs (#15449) 2025-12-08 16:59:27 +00:00
Stan Lo
956f8d490c
ZJIT: Avoid redundant SP save in codegen (#15448) 2025-12-08 16:36:45 +00:00
Nobuyoshi Nakada
66b2cc3dab [ruby/resolv] Check the second RegGetValue type
https://github.com/ruby/resolv/commit/3678de9e30
2025-12-08 11:28:52 +00:00
Nobuyoshi Nakada
27d60e2984 [ruby/resolv] Fix warnings on cygwin
https://github.com/ruby/resolv/commit/075e76f997
2025-12-08 11:28:52 +00:00
Koichi Sasada
159430e8b6 ignore Thread creation error
on resource limited environment.

```
stderr output is not empty
   bootstraptest.test_ractor.rb_2446_1412.rb:23:in 'Ractor.new': can't create Thread: Cannot allocate memory (ThreadError)
```
2025-12-08 18:41:06 +09:00
Koichi Sasada
ced333677f fix SEGV on clang-16/18
Maybe because of TLS/coroutine problem, CI fails on clang-16/18

```
  1) Failure:
TestTimeout#test_ractor [/tmp/ruby/src/trunk_clang_18/test/test_timeout.rb:288]:
pid 307341 killed by SIGSEGV (signal 11) (core dumped)
| /tmp/ruby/src/trunk_clang_18/lib/timeout.rb:98: [BUG] Segmentation fault at 0x0000000000000030
| ruby 4.0.0dev (2025-12-07T16:51:02Z master 4f900c35bc) +PRISM [x86_64-linux]
|
| -- Control frame information -----------------------------------------------
| c:0006 p:---- s:0026 e:000025 l:y b:---- CFUNC  :sleep
| c:0005 p:---- s:0023 e:000022 l:y b:---- CFUNC  :wait
| c:0004 p:0020 s:0017 e:000016 l:n b:---- BLOCK  /tmp/ruby/src/trunk_clang_18/lib/timeout.rb:98 [FINISH]
| c:0003 p:---- s:0014 e:000013 l:y b:---- CFUNC  :synchronize
| c:0002 p:0072 s:0010 e:000009 l:n b:---- BLOCK  /tmp/ruby/src/trunk_clang_18/lib/timeout.rb:96 [FINISH]
| c:0001 p:---- s:0003 e:000002 l:y b:---- DUMMY  [FINISH]
|
| -- Ruby level backtrace information ----------------------------------------
| /tmp/ruby/src/trunk_clang_18/lib/timeout.rb:96:in 'block in create_timeout_thread'
| /tmp/ruby/src/trunk_clang_18/lib/timeout.rb:96:in 'synchronize'
| /tmp/ruby/src/trunk_clang_18/lib/timeout.rb:98:in 'block (2 levels) in create_timeout_thread'
| /tmp/ruby/src/trunk_clang_18/lib/timeout.rb:98:in 'wait'
| /tmp/ruby/src/trunk_clang_18/lib/timeout.rb:98:in 'sleep'
|
| -- Threading information ---------------------------------------------------
| Total ractor count: 3
| Ruby thread count for this ractor: 2
|
| -- Machine register context ------------------------------------------------
|  RIP: 0x0000602b1e08a5b5 RBP: 0x000071c65facd130 RSP: 0x000071c6258842e0
|  RAX: 0x0000000000000000 RBX: 0x000000006935f7c4 RCX: 0x0000000000000000
|  RDX: 0x0000602b1e520c20 RDI: 0x000071c620012480 RSI: 0x000071c620012480
|   R8: 0x0000000000000000  R9: 0x0000000000000000 R10: 0x0000000000000000
|  R11: 0x0000000000000000 R12: 0x000071c65fa2f640 R13: 0x000071c65fb66e48
|  R14: 0x0000000000000000 R15: 0xfdccaa3270000002 EFL: 0x0000000000010202
|
| -- C level backtrace information -------------------------------------------
| /tmp/ruby/build/trunk_clang_18/ruby(rb_print_backtrace+0x14) [0x602b1e31a6ea] /tmp/ruby/src/trunk_clang_18/vm_dump.c:1105
| /tmp/ruby/build/trunk_clang_18/ruby(rb_vm_bugreport) /tmp/ruby/src/trunk_clang_18/vm_dump.c:1450
| /tmp/ruby/build/trunk_clang_18/ruby(rb_bug_for_fatal_signal+0x15c) [0x602b1e2d960c] /tmp/ruby/src/trunk_clang_18/error.c:1131
| /tmp/ruby/build/trunk_clang_18/ruby(sigsegv+0x5a) [0x602b1e05528a] /tmp/ruby/src/trunk_clang_18/signal.c:948
| /lib/x86_64-linux-gnu/libc.so.6(0x71c65fd46320) [0x71c65fd46320]
| /tmp/ruby/build/trunk_clang_18/ruby(vm_check_ints_blocking+0x0) [0x602b1e08a5b5] /tmp/ruby/src/trunk_clang_18/vm_core.h:2097
| /tmp/ruby/build/trunk_clang_18/ruby(rb_current_execution_context) /tmp/ruby/src/trunk_clang_18/thread_sync.c:617
| /tmp/ruby/build/trunk_clang_18/ruby(rb_mutex_sleep) /tmp/ruby/src/trunk_clang_18/thread_sync.c:617
```

This patch introduces workaround by acquiring EC before swithcing coroutine.
2025-12-08 18:21:37 +09:00
yoshoku
1de15815a8 [ruby/rubygems] Fix native extension loading in newgem template for RHEL-based systems
Add fallback to `require` when `require_relative` fails to load native
extensions. This addresses an issue on RHEL-based Linux distributions
where Ruby scripts and built native extension shared libraries are
installed in separate directories.

https://github.com/ruby/rubygems/commit/68599bd107
2025-12-08 07:03:32 +00:00
Nobuyoshi Nakada
a82aa08fe0
Make ruby_reset_leap_second_info internal
It is exported only for the extension library to test, but the method
is no longer used since 29e31e72fb5a14194a78ec974c4ba56c33ad8d45.
2025-12-08 12:11:58 +09:00
Nobuyoshi Nakada
6a1f5b68cb
Make ruby_reset_timezone internal
It is used only in hash.c, when `ENV['TZ']` is set.
2025-12-08 12:11:58 +09:00
git
fbc5bb9120 Update default gems list at 4655b174d5fa71b69781c56701be63 [ci skip] 2025-12-08 03:07:35 +00:00
Hiroshi SHIBATA
4655b174d5 [ruby/timeout] v0.5.0
https://github.com/ruby/timeout/commit/837d5aac73
2025-12-08 03:06:40 +00:00
Kazuki Yamaguchi
be882278f2 Move RBIMPL_ATTR_DEPRECATED_* macros to the appropriate header file
Move these macros from include/ruby/backward.h to
include/ruby/internal/attr/deprecated.h, alongside the other similar
macros.

include/ruby/internal/intern/vm.h cannot currently use them because
include/ruby/backward.h is included too late.
2025-12-08 11:47:39 +09:00
Kazuki Yamaguchi
f2eece7199 Remove the internal-only attribute from ruby_reset_timezone()
The #ifdef is currently not taken because include/ruby/backward.h is
not included at this point. The attribute is unnecessary in an internal
header, so remove it.
2025-12-08 11:47:39 +09:00
Peter Zhu
4f900c35bc Output ivar length for T_OBJECT in obj_info 2025-12-07 08:51:02 -08:00
git
a4d1421373 [DOC] Update bundled gems list at 379d22ce8418448ade3d410e5c76dd 2025-12-07 16:35:47 +00:00
Stan Lo
379d22ce84
Bump RDoc version to 6.17.0 (#15439) 2025-12-07 16:35:04 +00:00
Nobuyoshi Nakada
db6071b521
[ruby/pathname] Raise the previous message
Fix ruby/pathname#75.

https://github.com/ruby/pathname/commit/5ba967b274
2025-12-07 23:20:25 +09:00
Nobuyoshi Nakada
a8a188e1fc
[ruby/pathname] Add more tests for Pathname#initialize
https://github.com/ruby/pathname/commit/a2edd25bc1
2025-12-07 23:20:24 +09:00
Nobuyoshi Nakada
806f2d3533
[ruby/pathname] [DOC] Pathname#freeze
https://github.com/ruby/pathname/commit/4580540a2b
2025-12-07 22:51:22 +09:00
Nobuyoshi Nakada
f2b250c150
[ruby/pathname] Define private method same_paths? for Ractor-safety
https://github.com/ruby/pathname/commit/d33d18e5e2
2025-12-07 22:51:22 +09:00
Nobuyoshi Nakada
4080abecd6
Ignore distclean failures
Just clean the directory if it exists and is empty.
2025-12-07 21:18:00 +09:00
Samuel Williams
eafaff9443
Re-introduce support for io_close hook. (#15434) 2025-12-08 00:55:13 +13:00
Peter Zhu
941e70ab38 Sync doc/stringio in sync_default_gems.rb 2025-12-07 17:34:45 +09:00
Nobuyoshi Nakada
68eab91b14
Allow to sync pathname manually
Still development of the gem continues, sync as possible manually.
2025-12-07 13:44:19 +09:00
Peter Zhu
fb80f84fc7 [DOC] Fix formatting in docs for String#[]= 2025-12-06 17:59:50 -08:00
Burdette Lamar
33837abb81 [ruby/stringio] [DOC] Tweaks for StringIO#pos=
(https://github.com/ruby/stringio/pull/194)

https://github.com/ruby/stringio/commit/3cef1e0e5f
2025-12-06 23:22:04 +00:00
Burdette Lamar
82577ac090 [ruby/stringio] [DOC] Tweaks for StringIO#pos
(https://github.com/ruby/stringio/pull/193)

https://github.com/ruby/stringio/commit/90728bbbca
2025-12-06 23:22:00 +00:00
Burdette Lamar
c9fe3cba39 [ruby/stringio] [DOC] Tweaks for StringIO#lineno=
(https://github.com/ruby/stringio/pull/192)

https://github.com/ruby/stringio/commit/8b1ee03cbe
2025-12-06 23:21:38 +00:00
Burdette Lamar
f298beb2d9 [ruby/stringio] [DOC] Tweaks for StringIO#lineno
(https://github.com/ruby/stringio/pull/191)

https://github.com/ruby/stringio/commit/f2a2a5a99e
2025-12-06 23:21:17 +00:00
Peter Zhu
588347a088 Fix id2ref for multi-Ractor
The id2ref table needs to be under a VM lock to ensure there are no race
conditions. The following script crashes:

    o = Object.new

    ObjectSpace._id2ref(o.object_id)

    10.times.map do
      Ractor.new do
        10_000.times do
          a = Object.new
          a.object_id
        end
      end
    end.map(&:value)

With:

    [BUG] Object ID seen, but not in _id2ref table: object_id=2800 object=T_OBJECT
    ruby 4.0.0dev (2025-12-06T15:15:43Z ractor-id2ref-fix e7f9abdc91) +PRISM [x86_64-linux]

    -- Control frame information -----------------------------------------------
    c:0001 p:---- s:0003 e:000002 l:y b:---- DUMMY  [FINISH]

    -- Threading information ---------------------------------------------------
    Total ractor count: 5
    Ruby thread count for this ractor: 1

    -- C level backtrace information -------------------------------------------
    miniruby(rb_print_backtrace+0x14) [0x6047d09b2dff] vm_dump.c:1105
    miniruby(rb_vm_bugreport) vm_dump.c:1450
    miniruby(rb_bug_without_die_internal+0x5f) [0x6047d066bf57] error.c:1098
    miniruby(rb_bug) error.c:1116
    miniruby(rb_gc_get_ractor_newobj_cache+0x0) [0x6047d066c8dd] gc.c:2052
    miniruby(gc_sweep_plane+0xad) [0x6047d079276d] gc/default/default.c:3513
    miniruby(gc_sweep_page) gc/default/default.c:3605
    miniruby(gc_sweep_step) gc/default/default.c:3886
    miniruby(gc_sweep+0x1ba) [0x6047d0794cfa] gc/default/default.c:4154
    miniruby(gc_start+0xbf2) [0x6047d0796742] gc/default/default.c:6519
    miniruby(heap_prepare+0xcc) [0x6047d079748c] gc/default/default.c:2090
    miniruby(heap_next_free_page) gc/default/default.c:2305
    miniruby(newobj_cache_miss) gc/default/default.c:2412
    miniruby(newobj_alloc+0xd) [0x6047d0798ff5] gc/default/default.c:2436
    miniruby(rb_gc_impl_new_obj) gc/default/default.c:2515
    miniruby(newobj_of) gc.c:996
    miniruby(rb_wb_protected_newobj_of) gc.c:1046
    miniruby(str_alloc_embed+0x28) [0x6047d08fda18] string.c:1019
    miniruby(str_enc_new) string.c:1069
    miniruby(prep_io+0x5) [0x6047d07cda14] io.c:9305
    miniruby(prep_stdio) io.c:9347
    miniruby(rb_io_prep_stdin) io.c:9365
    miniruby(thread_start_func_2+0x77c) [0x6047d093a55c] thread.c:679
    miniruby(thread_sched_lock_+0x0) [0x6047d093aacd] thread_pthread.c:2241
    miniruby(co_start) thread_pthread_mn.c:469
2025-12-06 10:08:24 -08:00
BurdetteLamar
87bc106b87 [ruby/stringio] [DOC] Change link to on-page
https://github.com/ruby/stringio/commit/a7c118d786
2025-12-06 17:49:13 +00:00
Theo Buehler
47c0dae188 [ruby/openssl] asn1integer_to_num: don't cast away const
ASN1_ENUMERATED_to_BN() has been const-correct for a long time in all
supported libcrytos, so we can remove this workaround.

https://github.com/ruby/openssl/commit/d0f36a7c65
2025-12-06 17:26:32 +00:00
Peter Zhu
1f0d41aa4d [ruby/date] Call rb_gc_register_mark_object after object allocation
It's possible that both half_days_in_day and day_in_nanoseconds are Ruby
objects, which means that creating day_in_nanoseconds may trigger GC.
Since half_days_in_day is not registered as a mark object until after
day_in_nanoseconds is allocated, the GC may reclaim half_days_in_day.

We can see this crash:

    ruby(rb_print_backtrace+0xb) [0x63a373c0] vm_dump.c:1105
    ruby(rb_vm_bugreport) vm_dump.c:1450
    ruby(rb_assert_failure_detail+0xdb) [0x6371d3a2] error.c:1216
    ruby(RB_FL_TEST_RAW+0x0) [0x6371d3d5] error.c:1192
    ruby(rb_assert_failure) (null):0
    ruby(rb_gc_impl_writebarrier+0xb4) [0x636f01e4] gc/default/default.c:6103
    ruby(pin_array_list_append+0x72) [0x638f9787] include/ruby/internal/gc.h:788
    ruby(rb_vm_register_global_object) vm.c:4713
    ruby(rb_gc_register_mark_object+0x3a) [0x6374144a] gc.c:3449
    .ext/i686-linux-gnu/date_core.so(Init_date_core+0x204) [0xdbec86c4] ext/date/date_core.c:9511
    .ext/i686-linux-gnu/date_core.so(Init_date_core) (null):0
    ruby(dln_load_and_init+0x71) [0x6392c541] dln.c:521
    ruby(dln_load_feature+0xd2) [0x6392c7d2] dln.c:566
    ruby(load_ext+0xc3) [0x637931b3] load.c:1210
    ruby(rb_vm_pop_frame+0x0) [0x638f80cd] vm.c:3120
    ruby(rb_vm_call_cfunc_in_box) vm.c:3122
    ruby(rb_long2num_inline+0x0) [0x637956f8] load.c:1353
    ruby(require_internal) load.c:1354
    ruby(rb_require_string_internal+0x60) [0x63795fa1] load.c:1457
    ruby(rb_require_string) load.c:1443

https://github.com/ruby/date/commit/cbec5948e0
2025-12-06 17:13:32 +00:00
Theo Buehler
8d3da814c0 [ruby/openssl] Convert ossl_x509ext.c to opaque ASN1_STRING
https://github.com/ruby/openssl/commit/a41cf28bab
2025-12-06 16:50:17 +00:00
Theo Buehler
38ad0806d7 [ruby/openssl] Convert ossl_ts.c to opaque ASN1_STRING
https://github.com/ruby/openssl/commit/8945f379b3
2025-12-06 16:50:17 +00:00
Theo Buehler
a07997bf81 [ruby/openssl] Convert ossl_ns_spki.c to opaque ASN1_STRING
https://github.com/ruby/openssl/commit/0941ebbda5
2025-12-06 16:50:17 +00:00
Theo Buehler
98c151b0e5 [ruby/openssl] Convert some of ossl_asn1.c to opaque ASN1_STRING
This uses the normal accessors but leaves out BIT STRINGS, which will
need compat implementations for ASN1_BIT_STRING_get_length() and
ASN1_BIT_STRING_set1() for older libcryptos.

https://github.com/openssl/openssl/issues/29184
https://github.com/openssl/openssl/issues/29185

https://github.com/ruby/openssl/commit/ba3d1cc5c2
2025-12-06 16:50:16 +00:00
Theo Buehler
d3aa7b889f [ruby/openssl] Convert ossl_ocsp.c to opaque ASN1_STRING
OpenSSL plans to make asn1_string_st opaque, the struct underlying most
ASN.1 types such as ASN1_*STRING, ASN1_ENUMERATED, ASN1_INTEGER, etc.
Most of ruby/openssl's C code can be straigtforwardly converted to use
accessors available since OpenSS

https://github.com/ruby/openssl/commit/374262435a
2025-12-06 16:50:16 +00:00
Theo Buehler
9dfb7bd7d4 [ruby/openssl] const correct ossl_bin2hex()
This helper only reads from its in parameter. Making that const
avoids a couple of casts in an upcoming change.

https://github.com/ruby/openssl/commit/970d5764e3
2025-12-06 16:50:16 +00:00
Peter Zhu
2e828dd98f Fix strict aliasing warning in ruby_swap128_int
The following warnings are emitted. We can use type punning to prevent
strict aliasing violations.

    io_buffer.c:1935:23: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
    1935 |     rb_uint128_t u = *(rb_uint128_t*)&x;
         |                       ^~~~~~~~~~~~~~~~~
    io_buffer.c:1937:13: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
    1937 |     return *(rb_int128_t*)&swapped;
         |
2025-12-06 08:31:41 -08:00
Nobuyoshi Nakada
da3b7d5ee3
[ruby/pathname] Freeze and hide internal constants
https://github.com/ruby/pathname/commit/60f5d58d73
2025-12-07 00:44:30 +09:00
Nobuyoshi Nakada
b675deeeb1
[ruby/pathname] Use File.path for conversion to path name
This method has been defined since 1.9, as the standard conversion
procedure.

https://github.com/ruby/pathname/commit/8f582dc65d
2025-12-07 00:44:30 +09:00
Nobuyoshi Nakada
7319db44fc
[ruby/pathname] Define to_path alias directly
The constant `TO_PATH` was defined for 1.9 compatibility but the code
for it was dropped 10 years ago.

https://github.com/ruby/pathname/commit/95ad4ceb19
2025-12-07 00:44:30 +09:00
Nobuyoshi Nakada
240afe50a1
Suppress noisy outputs
Fix up ruby/ruby#14700.
2025-12-07 00:38:25 +09:00
Peter Zhu
e7f9abdc91 Sync doc/stringio in sync_default_gems.rb 2025-12-06 07:15:43 -08:00