summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
2025-07-14merge revision(s) 097d742a1ed53afb91e83aef01365d68b763357b: [Backport #20009]Takashi Kokubun
[Bug #20009] Support marshaling non-ASCII name class/module
2025-07-14merge revision(s) 5ec9a392cdf7f971221dc073dd466bce877d8acb: [Backport #21439]Takashi Kokubun
[Bug #21439] Fix `PM_SPLAT_NODE` compilation error in for loops (#13597) [Bug #21439] Fix PM_SPLAT_NODE compilation error in for loops This commit fixes a crash that occurred when using splat nodes (*) as the index variable in for loops. The error "Unexpected node type for index in for node: PM_SPLAT_NODE" was thrown because the compiler didn't know how to handle splat nodes in this context. The fix allows code like `for *x in [[1,2], [3,4]]` to compile and execute correctly, where the splat collects each sub-array.
2025-07-14merge revision(s) 34b407a4a89e69dd04f692e2b29efa2816d4664a: [Backport #21394]Takashi Kokubun
Fix memory leak in Prism's RubyVM::InstructionSequence.new [Bug #21394] There are two ways to make RubyVM::InstructionSequence.new raise which would cause the options->scopes to leak memory: 1. Passing in any (non T_FILE) object where the to_str raises. 2. Passing in a T_FILE object where String#initialize_dup raises. This is because rb_io_path dups the string. Example 1: 10.times do 100_000.times do RubyVM::InstructionSequence.new(nil) rescue TypeError end puts `ps -o rss= -p #{$$}` end Before: 13392 17104 20256 23920 27264 30432 33584 36752 40032 43232 After: 9392 11072 11648 11648 11648 11712 11712 11712 11744 11744 Example 2: require "tempfile" MyError = Class.new(StandardError) String.prepend(Module.new do def initialize_dup(_) if $raise_on_dup raise MyError else super end end end) Tempfile.create do |f| 10.times do 100_000.times do $raise_on_dup = true RubyVM::InstructionSequence.new(f) rescue MyError else raise "MyError was not raised during RubyVM::InstructionSequence.new" end puts `ps -o rss= -p #{$$}` ensure $raise_on_dup = false end end Before: 14080 18512 22000 25184 28320 31600 34736 37904 41088 44256 After: 12016 12464 12880 12880 12880 12912 12912 12912 12912 12912
2025-07-14merge revision(s) ff222ac27afe712ef6ec2bb74c81cdde1a1fa176: [Backport #21370]Takashi Kokubun
compile.c: Handle anonymous variables in `outer_variable_cmp` [Bug #21370]
2025-07-14merge revision(s) 9f91f3617bab2ee220d298ddb874ef73b10dac23: [Backport #21383]Takashi Kokubun
Fix memory leak with invalid yield in prism [Bug #21383] The following script leaks memory: 10.times do 20_000.times do eval("class C; yield; end") rescue SyntaxError end puts `ps -o rss= -p #{$$}` end Before: 16464 25536 29424 35904 39552 44576 46736 51600 56096 59824 After: 13488 16160 18240 20528 19760 21808 21680 22272 22064 22336
2025-07-14merge revision(s) 056497319658cbefe22351c6ec5c9fa6e4df72bd: [Backport #21357]Takashi Kokubun
[Bug #21357] Fix crash in Hash#merge with block Prior to https://github.com/ruby/ruby/commit/49b306ecb9e2e9e06e0b1590bacc5f4b38169c3c the `optional_arg` passed from `rb_hash_update_block_i` to `tbl_update` was a hash value (i.e. a VALUE). After that commit it changed to an `update_call_args`. If the block sets or changes the value, `tbl_update_modify` will set the `arg.value` back to an actual value and we won't crash. But in the case where the block returns the original value we end up calling `RB_OBJ_WRITTEN` with the `update_call_args` which is not expected and may crash. `arg.value` appears to only be used to pass to `RB_OBJ_WRITTEN` (others who need the `update_call_args` get it from `arg.arg`), so I don't think it needs to be set to anything upfront. And `tbl_update_modify` will set the `arg.value` in the cases we need the write barrier.
2025-07-14merge revision(s) 49b306ecb9e2e9e06e0b1590bacc5f4b38169c3c: [Backport #21333]Takashi Kokubun
[Bug #21333] Prohibit hash modification inside Hash#update block
2025-07-09[ruby/prism] Accept a newline after the defined? keyword [Backport #21197] ↵Takashi Kokubun
(#13327) * [ruby/prism] Accept a newline after the defined? keyword [Bug #21197] https://github.com/ruby/prism/commit/22be955ce9 * Fix a compilation error Co-authored-by: Stan Lo <stan001212@gmail.com> --------- Co-authored-by: Kevin Newton <kddnewton@gmail.com> Co-authored-by: Stan Lo <stan001212@gmail.com>
2025-07-08Bump up resolv-0.6.2 for Ruby 3.4 (#13818)Hiroshi SHIBATA
2025-07-01Backport GH-13617 for s390x (#13757)Hiroshi SHIBATA
2025-06-18Fix use-after-free when resizing exivars (#13637)Jean Boussier
Fix generic_ivar_set_shape_ivptr for table rebuild [Bug #21438] Previously GC could trigger a table rebuild of the generic ivar st_table in the middle of calling the st_update callback. This could cause entries to be reallocated or rearranged and the update to be for the wrong entry. This commit adds an assertion to make that case easier to detect, and replaces the st_update with a separate st_lookup and st_insert. Also free after insert in generic_ivar_set_shape_ivptr Previously we were performing a realloc and then inserting the new value into the table. If the table was flagged as requiring a rebuild, this could trigger GC work and marking within that GC could access the ivptr freed by realloc. Co-authored-by: John Hawthorn <john@hawthorn.email> Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
2025-05-23test/lib/helper.rb is only for ruby/rdoc repoHiroshi SHIBATA
2025-05-22Sync RDoc 6.14.0Stan Lo
2025-05-22Merge RubyGems-3.6.9 and Bundler-2.6.9Hiroshi SHIBATA
2025-05-22Merge RubyGems-3.6.8 and Bundler-2.6.8Hiroshi SHIBATA
2025-05-13YJIT: Split the block on optimized getlocal/setlocal (#13331)Takashi Kokubun
2025-05-13[Bug #21331] Prohibit hash modification during stlike loopNobuyoshi Nakada
2025-05-13Revert "[Bug #21331] Prohibit modification during stlike loop"Nobuyoshi Nakada
This reverts commit bb180b87b43c45e17ff49735a26d7a188d5c8396, which caused "malloc during GC" error on wasm.
2025-05-13merge revision(s) bb180b87b43c45e17ff49735a26d7a188d5c8396: [Backport #21331]Takashi Kokubun
[Bug #21331] Prohibit modification during stlike loop
2025-05-06YJIT: End the block after OPTIMIZE_METHOD_TYPE_CALLTakashi Kokubun
2025-05-01[rubygems/rubygems] Fixed rubocop issue: Layout/SpaceInsideBlockBracesHiroshi SHIBATA
https://github.com/rubygems/rubygems/commit/77a52b011a
2025-05-01Run the proper version of `rake`Nobuyoshi Nakada
2025-04-14Revert "merge revision(s) 052794bfe1970e90f4f4f9e37fc362dd27903a8d: ↵Takashi Kokubun
[Backport #21197]" This reverts commit e630a0f7ae909dafe2e1dbc47baf90cd795b4a5f.
2025-04-14merge revision(s) 0d6263bd416338a339651fb97fe4d62701704c4b: [Backport #21220]Takashi Kokubun
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-14merge revision(s) 3a7b9ca93b91dcc086b9ac8b9957e59268f9493b: [Backport #21217]Takashi Kokubun
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-14merge revision(s) 052794bfe1970e90f4f4f9e37fc362dd27903a8d: [Backport #21197]Takashi Kokubun
[ruby/prism] Accept a newline after the defined? keyword [Bug #21197] https://github.com/ruby/prism/commit/22be955ce9
2025-04-09Test for the crashNobuyoshi Nakada
2025-04-08Merge RubyGems-3.6.7 and Bundler-2.6.7Hiroshi SHIBATA
2025-04-08Merge RubyGems-3.6.6 and Bundler-2.6.6Hiroshi SHIBATA
2025-04-03Use EnvUtil.apply_timeout_scaleHiroshi SHIBATA
2025-04-03Extend open_timeout for test failure on s390xHiroshi SHIBATA
https://rubyci.s3.amazonaws.com/s390x/ruby-master/log/20250403T060004Z.fail.html.gz
2025-04-02Picking test fix from ↵Hiroshi SHIBATA
https://github.com/ruby/ruby/commit/3d8a66568e8106b367665d716e0d3c8c8208aa07 The original change is https://github.com/ruby/ruby/commit/d78ff6a767ca813ac5fa178dd7611f20a993c191
2025-04-02[rubygems/rubygems] Bump up minimum required version for cmake 4Hiroshi SHIBATA
https://github.com/rubygems/rubygems/commit/3e77caeddf
2025-03-27Fix handling of `error`/`errno` in `io_internal_wait`. (#12961)Samuel Williams
[Bug #21195]
2025-03-20[Bug #21094] Update nested module names when setting temporary nameNobuyoshi Nakada
[Backport #21094]
2025-03-20[Bug #21186] multibyte char literal should be a single letter wordNobuyoshi Nakada
[Backport #21186]
2025-03-14Push a real iseq in rb_vm_push_frame_fname()Alan Wu
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-14Have `ast` live longer in ISeq.compile_file to fix GC stress crashAlan Wu
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[Bug #19841] Refine error on marshaling recursive USERDEFNobuyoshi Nakada
2025-03-10[Bug #21163] Fix hexadecimal float conversionNobuyoshi Nakada
2025-03-05Replace tombstone when converting AR to ST hashJohn Hawthorn
[Bug #21170] st_table reserves -1 as a special hash value to indicate that an entry has been deleted. So that that's a valid value to be returned from the hash function, do_hash replaces -1 with 0 so that it is not mistaken for the sentinel. Previously, when upgrading an AR table to an ST table, rb_st_add_direct_with_hash was used which did not perform the same conversion, this could lead to a hash in a broken state where one if its entries which was supposed to exist being marked as a tombstone. The hash could then become further corrupted when the ST table required resizing as the falsely tombstoned entry would be skipped but it would be counted in num entries, leading to an uninitialized entry at index 15. In most cases this will be really rare, unless using a very poorly implemented custom hash function. This also adds two debug assertions, one that st_add_direct_with_hash does not receive the reserved hash value, and a second in rebuild_table_with, which ensures that after we rebuild/compact a table it contains the expected number of elements. Co-authored-by: Alan Wu <alanwu@ruby-lang.org>
2025-03-03[Bug #21159] module names should not be modifiableNobuyoshi Nakada
2025-03-03[Feature #19521] Test for `Module#set_temporary_name`Nobuyoshi Nakada
2025-03-03Ensure IO.copy_stream buffer is an independent stringJeremy Evans
Otherwise, changes to the buffer by the destination write method could result in data changing for supposedly independent strings. Fixes [Bug #21131]
2025-03-03[Bug #21030] Fix step for non-numeric rangeNobuyoshi Nakada
When the end points of an inclusive range equal, `Range#step` should yields the element once.
2025-02-27Merge uri-1.0.3Hiroshi SHIBATA
2025-02-27Merge cgi-0.4.2Hiroshi SHIBATA
2025-02-25[Bug #21153] Add missing op-assign to top const in `command_asgn`Nobuyoshi Nakada
It was defined in `arg` only; add that pattern to `command_asgn` as well.
2025-02-20Merge RubyGems-3.6.5 and Bundler-2.6.5Hiroshi SHIBATA
2025-02-20Merge RubyGems-3.6.4 and Bundler-2.6.4Hiroshi SHIBATA