summaryrefslogtreecommitdiff
path: root/test/ruby
AgeCommit message (Collapse)Author
2024-10-18merge revision(s) 6118e8a47394409b53164b60e79fadf348b97db3, ↵nagachika
dc64448202299633a235f310b8bf2192263f274f: [Backport #20716] Fix method caching bug when including/prepend module A that prepends module B Fix by always adding the generated iclass to the subclasses list, otherwise the method cache for the iclass is not cleared when the method in the module is overwritten. Fixes [Bug #20716] Remove an unused variable
2024-10-18merge revision(s) 35e124832e29b65c84d4e0e4e434616859f9bdf5: [Backport #20755]nagachika
[Bug #20755] Frozen string should not be writable via IO::Buffer
2024-10-18merge revision(s) 637067440f74043c6d79fc649ab8acf1afea25a5: [Backport #20752]nagachika
[Bug #20752] Slice of readonly `IO::Buffer` also should be readonly
2024-10-18merge revision(s) c1862cbb89a6bf42dcd07d92fe4f4bfeebca5775: [Backport #20719]nagachika
[Bug #20719] `Float` argument must be ASCII compatible
2024-10-18merge revision(s) d33e3d47b84a73b38644f2a3d41881ce9be6ef18: [Backport #20704]nagachika
[Bug #20704] Win32: Fix chdir to non-ASCII path On Windows, `chdir` in compilers' runtime libraries uses the active code page, but command line arguments in ruby are always UTF-8, since commit:33ea2646b98adb49ae2e1781753bf22d33729ac0.
2024-10-04Add `IO::Buffer` tests for read and write with length & offset.Samuel Williams
2024-08-18merge revision(s) 992596fb7af18a7f472589a607d0eb3fbb03b49a: [Backport #20344]nagachika
Fix next inside block argument stack underflow [Bug #20344] Fix compile_next adding removable adjust label
2024-08-18Allow waitpid(-1, Process::WNOHANG) to be woken if a waitpid(pid) isStan Hu
...pending If two threads are running, with one calling waitpid(-1, Process::WNOHANG), and another calling waitpid($some_pid), and then $some_other_pid exits, we would expect the waitpid(-1, Process::WNOHANG) call to retrieve that exit status. However, it cannot actually do so until $some_pid _also_ exits. This patch fixes the issue by calling do_waitpid unconditionally in waitpid_wait; this will ensure that a waitpid -1 actually reaps something (after first checking that no PID-directed call wants the process). [Bug #20490]
2024-08-18merge revision(s) 1870505f478cc75993b296b7144a45137ace6937: [Backport ↵nagachika
#20651] [Backport #20571] Fix wrong unreachable chunk remove when jump destination label is unremovable
2024-08-02Fix ceil when ndigits is largePeter Zhu
[Bug #20654] This commit fixes Integer#ceil and Float#ceil when the number is negative and ndigits is large such that 10**ndigits is a bignum. Previously, it would return 0 in such cases. However, this would cause unexpected behaviour such as: puts 1.ceil(-5) # => 100000 puts 1.ceil(-10) # => 10000000000 puts 1.ceil(-20) # => 0 This commit changes the last result so that it will return 100000000000000000000.
2024-08-02Fix floor when ndigits is largePeter Zhu
[Bug #20654] This commit fixes Integer#floor and Float#floor when the number is negative and ndigits is large such that 10**ndigits is a bignum. Previously, it would return 0 in such cases. However, this would cause unexpected behaviour such as: puts -1.floor(-5) # => -100000 puts -1.floor(-10) # => -10000000000 puts -1.floor(-20) # => 0 This commit changes the last result so that it will return -100000000000000000000.
2024-07-21merge revision(s) b15e88e0fcccb03b9cc5e4c1478ec9b10e26c961: [Backport #19619]nagachika
[Bug #19619] Preserve numbered parameters context Preserve numbered parameters context across method definitions
2024-07-20merge revision(s) e1104017e3080fd432c0b5fdc3ae6e004ffd0834: [Backport #19781]nagachika
YJIT: Fix cfp inconsistency on tailcall (#8107) [Bug #19781]
2024-07-20merge revision(s) 2dd46bb82ffc4dff01d7ea70922f0e407acafb4e: [Backport #20468]nagachika
[Bug #20468] Fix safe navigation in `for` variable
2024-07-15merge revision(s) d503e1b95a40e45d7767e0175de60092de4ba54e: [Backport #20030]nagachika
[Bug #20030] dispatch invalid escaped character without ignoring it
2024-07-15merge partially d292a9b98ce03c76dbe13138d20b9fbf613cc02d. Just add the test ↵nagachika
to ensure the issue doesn't exit in ruby_3_2 branch.
2024-07-15merge revision(s) 58918788abd63901588e4aa1e39b5c057321c10a: [Backport #20342]nagachika
[Bug #20342] Consider wrapped load in `main` methods
2024-07-15Revert "merge revision(s) e04146129ec6898dd6a9739dad2983c6e9b68056, ↵nagachika
d5080f6e8b77364483ff6727b1065e45e180f05d: [Backport #20292]" This reverts commit a54c717c7a74b91a3cdf20742c355e3ea42052d1.
2024-07-15merge revision(s) dc146babf47a84bbd1f176d766637d4a40327019, ↵nagachika
f23d5028059078a346efc977287b669d494a5a3f, a0f7de814ae5c299d6ce99bed5fb308a05d50ba0: [Backport #20296] [Bug #20296] Clear errinfo when `exception: false` [Bug #20296] Refine the test [Bug #20296] Fix the default assertion message
2024-07-15merge revision(s) e04146129ec6898dd6a9739dad2983c6e9b68056, ↵nagachika
d5080f6e8b77364483ff6727b1065e45e180f05d: [Backport #20292] [Bug #20292] Truncate embedded string to new capacity Fix -Wsign-compare on String#initialize MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ../string.c:1886:57: warning: comparison of integer expressions of different signedness: ‘size_t’ {aka ‘long unsigned int’} and ‘long int’ [-Wsign-compare] 1886 | if (STR_EMBED_P(str)) RUBY_ASSERT(osize <= str_embed_capa(str)); | ^~
2024-07-13merge revision(s) f36a71e26995b69ff72bc132bbcf40ad89571414: [Backport #20307]nagachika
[Bug #20307] Fix `Hash#update` to make frozen copy of string keys
2024-07-13merge revision(s) d19d683a354530a27b4cbb049223f8dc70c75849: [Backport #20250]nagachika
rb_obj_setup: do not copy RUBY_FL_SEEN_OBJ_ID [Bug #20250] We're seting up a new instance, so it never had an associated object_id.
2024-07-07merge revision(s) 82b57d7bfeefd717c10f7a5a3484aca6b3e708a3: [Backport #20162]nagachika
Fix memory leak when duplicating too complex object [Bug #20162] Creating a ST table then calling st_replace leaks memory because the st_replace overwrites the ST table without freeing any of the existing memory. This commit changes it to use st_copy instead. For example: RubyVM::Shape.exhaust_shapes o = Object.new o.instance_variable_set(:@a, 0) 10.times do 100_000.times { o.dup } puts `ps -o rss= -p #{$$}` end Before: 23264 33600 42672 52160 61600 71728 81056 90528 100560 109840 After: 14752 14816 15584 15584 15664 15664 15664 15664 15664 15664
2024-07-07merge revision(s) e626da82eae3d437b84d4f9ead0164d436b08e1a, ↵nagachika
f3af5ae7e6c1c096bbfe46d69de825a02b1696cf: [Backport #20311] Don't pin named structs defined in Ruby [Bug #20311] `rb_define_class_under` assumes it's called from C and that the reference might be held in a C global variable, so it adds the class to the VM root. In the case of `Struct.new('Name')` it's wasteful and make the struct immortal. Make Struct memory leak test faster [Bug #20311] It times out on some platform, so we can reduce iterations. On my machine it completes in 250ms and RSS grows 8X.
2024-07-06merge revision(s) 78d9fe69479d32214a52ad7291c3973f1b6b7f6f, ↵nagachika
04729fe68dceddab045be7324e26c2bb15aa62c7: [Backport #20286] [Backport #20286] Ensure that exiting thread invokes end-of-life behaviour. (#10039) Fix exception handling in `rb_fiber_scheduler_set`. (#10042)
2024-07-06merge revision(s) a7ff264477105b5dc0ade6facad4176a1b73df0b: [Backport #20393]nagachika
Don't clear pending interrupts in the parent process. (#10365)
2024-06-18Revert "merge revision(s) 22e4eeda6561693367fc7a00b92b90f46b09cabd, ↵nagachika
1ab7c412d2e3880a7ad233c32e93961888f8145c, fd549b229b0822198ddc847703194263a2186ed1: [Backport #20515]" This reverts commit dc4ca25e0a01e072ba3cf1fc47612aff72c980af.
2024-06-15merge revision(s) 22e4eeda6561693367fc7a00b92b90f46b09cabd, ↵nagachika
1ab7c412d2e3880a7ad233c32e93961888f8145c, fd549b229b0822198ddc847703194263a2186ed1: [Backport #20515] ci: Test whether GMP is working in compilers.yml (#10875) Avoid reoccurence of [Bug #20515] Requires https://github.com/ruby/ruby/pull/10876 since 18eaf0be905e3e251423b42d6f4e56b7cae1bc3b bug: https://bugs.ruby-lang.org/issues/20515 RUBY_CHECK_HEADER didn't define HAVE_{header-file} (#10876) --with-gmp is not working at all because HAVE_GMP_H was missing since 18eaf0be90. [Bug #20515] bug: https://bugs.ruby-lang.org/issues/20515 follow-up: https://bugs.ruby-lang.org/issues/20494 follow-up: 18eaf0be905e3e251423b42d6f4e56b7cae1bc3b follow-up: https://github.com/ruby/ruby/pull/10805 test_bignum: defined? returns String (#10880) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit didn't verify the test is working properly due to mistaken auto-merge… [Bug #20515] bug: https://bugs.ruby-lang.org/issues/20515 follow-up: 22e4eeda6561693367fc7a00b92b90f46b09cabd follow-up: https://github.com/ruby/ruby/pull/10875
2024-06-15Fix inconsistent evaluation of keyword splat (#10959)Peter Zhu
[Bug #20180] Backports #9624.
2024-06-15compile.c: use putspecialobject for RubyVM::FrozenCoreJean Boussier
[Bug #20569] `putobject RubyVM::FrozenCore`, is not serializable, we have to use `putspecialobject VM_SPECIAL_OBJECT_VMCORE`.
2024-05-18Fix `io_buffer_get_string` default length computation. (#8427)Samuel Williams
* Fix `io_buffer_get_string` default length computation. When an offset bigger than the size is given, the resulting length will be computed incorrectly. Raise an argument error in this case. * Validate all arguments.
2024-05-18Improvements to `IO::Buffer` `read`/`write`/`pread`/`pwrite`. (#7826)Samuel Williams
- Fix IO::Buffer `read`/`write` to use a minimum length.
2024-04-08Backport https://github.com/ruby/ruby/pull/9240 to Ruby 3.2KJ Tsanaktsidis
Merged into master in 7ba2506232d3fa6c4e82e3708c0ff746a1a8de5c [Bug #20050]
2024-04-07merge revision(s) d3279a0c11ca45ca85027e7eb74dc4aac52c478b: [Backport #20327]nagachika
[Bug #20327] Do not count subsecond to calculate UTC offset Assume that there will never be any time zones with UTC offsets that are subseconds. Historically, UTC offset has only been used down to the second. --- test/ruby/test_time_tz.rb | 8 ++++++++ time.c | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-)
2024-03-31merge revision(s) ↵nagachika
ac0163949a6ee678dfccec9f6e56422b91e5f0a9,01fd262e62076277a41af72ea13f20deb1b462a2: [Backport #20245] Compile code without Symbol GC always --- symbol.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) Fix crash when checking symbol encoding [Bug #20245] We sometimes pass in a fake string to sym_check_asciionly. This can crash if sym_check_asciionly raises because it creates a CFP with the fake string as the receiver which will crash if GC tries to mark the CFP. For example, the following script crashes: GC.stress = true Object.const_defined?("\xC3") --- symbol.c | 17 ++++++++++------- test/ruby/test_module.rb | 8 ++++++++ 2 files changed, 18 insertions(+), 7 deletions(-)
2024-03-31merge revision(s) ade56737e2273847426214035c0ff2340b43799a: [Backport #20190]nagachika
Fix coderange of invalid_encoding_string.<<(ord) Appending valid encoding character can change coderange from invalid to valid. Example: "\x95".force_encoding('sjis')<<0x5C will be a valid string "\x{955C}" --- string.c | 6 +++++- test/ruby/test_string.rb | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-)
2024-03-31merge revision(s) b14674b236445fb70f484603e678722760f678f4: [Backport #20194]nagachika
Memory leak with TracePoint on bmethod [Bug #20194] When disabling the TracePoint on bmethod, the hooks list is not freed. For example: obj = Object.new obj.define_singleton_method(:foo) {} bmethod = obj.method(:foo) tp = TracePoint.new(:return) {} 10.times do 100_000.times do tp.enable(target: bmethod) {} end puts `ps -o rss= -p #{$$}` end Before: 18208 22832 26528 29728 34000 37776 40864 44400 47680 51504 After: 16688 17168 17168 17248 17696 17760 17824 17824 17856 17920 --- test/ruby/test_settracefunc.rb | 13 +++++++++++++ vm_trace.c | 1 + 2 files changed, 14 insertions(+)
2024-02-25merge revision(s) f15123c34ce80f3928612befe2a9aaf4c9d27fda: [Backport #18743]nagachika
Fix stack trace for rescued StopIteration --- enumerator.c | 15 +++++++++++++-- test/ruby/test_enumerator.rb | 20 ++++++++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-)
2024-02-25Revert "merge revision(s) c8d162c889008028b148437d02f36f4edaa749fd: ↵nagachika
[Backport #19973]" This reverts commit 24dd529750c08b5603fb418a4f34998b9bf6c8f9.
2024-02-25merge revision(s) c8d162c889008028b148437d02f36f4edaa749fd: [Backport #19973]nagachika
[Bug #19973] Warn duplicated keyword arguments after keyword splat --- parse.y | 11 +++++++---- test/ruby/test_syntax.rb | 6 ++++++ 2 files changed, 13 insertions(+), 4 deletions(-)
2024-01-18merge revision(s) b3d612804946e841e47d14e09b6839224a79c1a4: [Backport #20150]nagachika
Fix memory leak in grapheme clusters [Bug #20150] String#grapheme_cluters and String#each_grapheme_cluster leaks memory because if the string is not UTF-8, then the created regex will not be freed. For example: str = "hello world".encode(Encoding::UTF_32LE) 10.times do 1_000.times do str.grapheme_clusters end puts `ps -o rss= -p #{$$}` end Before: 26000 42256 59008 75792 92528 109232 125936 142672 159392 176160 After: 9264 9504 9808 10000 10128 10224 10352 10544 10704 10896 --- string.c | 98 +++++++++++++++++++++++++++++++----------------- test/ruby/test_string.rb | 11 ++++++ 2 files changed, 75 insertions(+), 34 deletions(-)
2024-01-18merge revision(s) f9a48548cf3ef54fc0a385ccd78c708737055ecc: [Backport #20042]nagachika
restore the stack pointer on finalizer When error on finalizer, the exception will be ignored. To restart the code, we need to restore the stack pointer. fix [Bug #20042] --- gc.c | 4 ++++ test/ruby/test_gc.rb | 9 +++++++++ 2 files changed, 13 insertions(+)
2023-11-19merge revision(s) 9eac9d71786a8dbec520d0541a91149f01adf8ea: [Backport #19969]nagachika
[Bug #19969] Compact st_table after deleted if possible --- hash.c | 19 +++++++++++++++++++ st.c | 40 +++++++++++++++++++++++++++++----------- test/ruby/test_hash.rb | 9 +++++++++ 3 files changed, 57 insertions(+), 11 deletions(-)
2023-11-10merge revision(s) 17b0643392749f45b7aacb64fc1c1bd704d42b4c: [Backport #19924]nagachika
[Bug #19924] Source code should be unsigned char stream Use `peekc` or `nextc` to fetch the next character, instead of reading from `lex.pcur` directly, for compilers that plain char is signed. --- parse.y | 10 +++++----- test/ruby/test_parse.rb | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-)
2023-11-09merge revision(s) ↵nagachika
4329554f171fdb483cafa672df5f2a08741940c5,b5c74d548872388921402ff2db36be15e924a89b: [Backport #19985] [Bug #19985] Raise LoadError with the converted feature name `Kernel#require` converts feature name objects that have the `to_path` method such as `Pathname`, but had used the original object on error and had resulted in an unexpected `TypeError`. --- load.c | 14 +++++++++++--- test/ruby/test_require.rb | 26 +++++++++++++++++++++----- 2 files changed, 32 insertions(+), 8 deletions(-) Ease the `Encoding::CompatibilityError` test failure At the time this test first started using `assert_raise_with_message`, it did not touch `Encoding.default_internal`. --- test/ruby/test_require.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
2023-10-28merge revision(s) 19346c2336053b351673da030b00c704138252d8: [Backport #19754]nagachika
[Bug #19754] Make `IO::Buffer#get_string` check `offset` range (#8016) --- io_buffer.c | 3 +++ test/ruby/test_io_buffer.rb | 8 ++++++++ 2 files changed, 11 insertions(+)
2023-09-30merge revision(s) c42261059dfebabbf0391327a5e077545a9bc438: [Backport #19901]nagachika
[Bug #19901] fix leak in module clone Co-authored-by: Peter Zhu <peter@peterzhu.ca> --- class.c | 1 + test/ruby/test_module.rb | 12 ++++++++++++ 2 files changed, 13 insertions(+)
2023-09-30merge revision(s) 8b236e0c66da8f92e9fc33de66cfbc8e4b0c0763: [Backport #19896]nagachika
[Bug #19896] fix memory leak in vm_method This introduces a unified reference_count to clarify who is referencing a method. This also allows us to treat the refinement method as the def owner since it counts itself as a reference Co-authored-by: Peter Zhu <peter@peterzhu.ca> --- gc.c | 4 +- method.h | 6 +-- rjit_c.rb | 6 +-- test/ruby/test_module.rb | 4 +- vm_insnhelper.c | 2 +- vm_method.c | 105 +++++++++++++++++++---------------------------- 6 files changed, 54 insertions(+), 73 deletions(-)
2023-09-24merge revision(s) 96c5a4be7b0d72502001734770af0f4a735c544c: [Backport #19894]nagachika
Fix memory leak in complemented method entries [Bug #19894] When a copy of a complemented method entry is created, there are two issues: 1. IMEMO_FL_USER3 is not copied, so the complemented status is not copied over. 2. In rb_method_entry_clone we increment both alias_count and complemented_count. However, when we free the method entry in rb_method_definition_release, we only decrement one of the two counters, resulting in the rb_method_definition_t being leaked. Co-authored-by: Adam Hess <adamhess1991@gmail.com> --- method.h | 5 +++-- test/ruby/test_module.rb | 29 +++++++++++++++++++++++++++++ vm_method.c | 8 +++++--- 3 files changed, 37 insertions(+), 5 deletions(-)
2023-09-24merge revision(s) 25711683e86271385e8abe09a9c03782000e48db: [Backport #19864]nagachika
Fix regression when testing inclusion in unbounded ranges Caused by 04a92a6764bf678919cf4b68a27496a39d6b886a. This treats unbounded ranges of arbitrary objects the same as how unbounded string ranges are treated: (..x) === y # (y <=> x) <= 0 (...x) === y # (y <=> x) < 0 (x..) === y # (x <=> y) <= 0 Fixes [Bug #19864] --- range.c | 9 +++++++++ test/ruby/test_range.rb | 23 +++++++++++++++++++++++ 2 files changed, 32 insertions(+)