Граф коммитов

7360 Коммитов

Автор SHA1 Сообщение Дата
Takashi Kokubun b210c86a02 merge revision(s) 97449338d6cb42d9dd7c9ca61550616e7e6b6ef6: [Backport #20649]
[Bug #20649] Allow `nil` as 2nd argument of `assign_error`

	Fallback to the last token element in that case, for the backward
	compatibilities.
2024-09-02 03:07:09 -07:00
Takashi Kokubun 6a4e79533b merge revision(s) 1870505f478cc75993b296b7144a45137ace6937: [Backport #20651]
Fix wrong unreachable chunk remove when jump destination label is unremovable
2024-09-02 02:56:18 -07:00
Takashi Kokubun e0e23e7d5e merge revision(s) 29500e30346: [Backport #20667]
Update bundled gems list as of 2024-08-22
2024-09-02 02:52:51 -07:00
Takashi Kokubun be1089c8ec v3.3.4 2024-07-08 16:28:22 -07:00
Takashi Kokubun 17e21d8155 merge revision(s) fc33559c: [Backport #20570]
clear `kw_flag` if given hash is nil

	https://bugs.ruby-lang.org/issues/20570 is caused I missed to
	clear the `kw_flag` even if `keyword_hash` is nil.
2024-07-08 16:08:42 -07:00
Takashi Kokubun df8a08fb6a merge revision(s) 75aaeb35b82da26359b9418d2963384d0c55839c: [Backport #20239]
[Bug #20239] Fix overflow at down-casting
2024-07-08 16:04:30 -07:00
Takashi Kokubun 9d583dd43a merge revision(s) fba8aff7, d8c6e91748871ab2287d7703347847fe18a292d2: [Backport #20592]
[Bug #20592] Fix segfault when sending NULL to freeaddrinfo

	On alpine freeaddrinfo does not accept NULL pointer

	Fix dangling `else`
2024-07-08 15:58:13 -07:00
Takashi Kokubun 8a2e41d34b merge revision(s) 2dd46bb82ffc4dff01d7ea70922f0e407acafb4e: [Backport #20468]
[Bug #20468] Fix safe navigation in `for` variable
2024-07-08 15:55:17 -07:00
Takashi Kokubun a40645e115 merge revision(s) 01b13886: [Backport #20562]
[Bug #20562] Categorize `RUBY_FREE_AT_EXIT` warning as experimental
2024-07-08 15:42:06 -07:00
Takashi Kokubun f1c7b6f435 v3.3.3 2024-06-11 16:54:24 -07:00
Takashi Kokubun 23f4b78ad8 merge revision(s) 27321290: [Backport #20521]
[Bug #20521] ripper: Clean up strterm
2024-06-11 11:17:32 -07:00
Takashi Kokubun d3b1398212 merge revision(s) 1e08a9f0e9058186db18f29efc6458c00f10a856: [Backport #20499]
[Bug #20499] Use Xcode owned tools for Xcode clang

	Xcode has its own version tools that may be incompatible with genuine
	LLVM tools, use the tools in the same directory.
2024-06-11 11:11:23 -07:00
Takashi Kokubun e0fe6f7017 merge revision(s) f8abd24b1f28998157da1230b231419ef7b81722: [Backport #20522]
Improve YJIT performance warning regression test

	[Bug #20522]
2024-06-05 00:29:17 -07:00
Takashi Kokubun 1ff55bb09d merge revision(s) 05553cf22d43dd78b8f30cc4591230b5c000c538: [Backport #20517]
[Bug #20517] Make a multibyte character one token at meta escape
2024-06-04 14:58:37 -07:00
Takashi Kokubun 1df1538be4 merge revision(s) f54369830f, 338eb0065b, ac636f5709feb1d9d7a0c46a86be153be765cf21: [Backport #20516]
Revert "Rollback to released version numbers of stringio and strscan"

	This reverts commit 6a79e53823.

	[ruby/strscan] StringScanner#captures: Return nil not "" for unmached capture (https://github.com/ruby/strscan/pull/72)

	fix https://github.com/ruby/strscan/issues/70
	If there is no substring matching the group (s[3]), the behavior is
	different.

	If there is no substring matching the group, the corresponding element
	(s[3]) should be nil.

	```
	s = StringScanner.new('foobarbaz') #=> #<StringScanner 0/9 @ "fooba...">
	s.scan /(foo)(bar)(BAZ)?/  #=> "foobar"
	s[0]           #=> "foobar"
	s[1]           #=> "foo"
	s[2]           #=> "bar"
	s[3]           #=> nil
	s.captures #=> ["foo", "bar", ""]
	s.captures.compact #=> ["foo", "bar", ""]
	```

	```
	s = StringScanner.new('foobarbaz') #=> #<StringScanner 0/9 @ "fooba...">
	s.scan /(foo)(bar)(BAZ)?/  #=> "foobar"
	s[0]           #=> "foobar"
	s[1]           #=> "foo"
	s[2]           #=> "bar"
	s[3]           #=> nil
	s.captures #=> ["foo", "bar", nil]
	s.captures.compact #=> ["foo", "bar"]
	```

	https://docs.ruby-lang.org/ja/latest/method/MatchData/i/captures.html
	```
	/(foo)(bar)(BAZ)?/ =~ "foobarbaz" #=> 0
	$~.to_a        #=> ["foobar", "foo", "bar", nil]
	$~.captures #=> ["foo", "bar", nil]
	$~.captures.compact #=> ["foo", "bar"]
	```

	* StringScanner#captures is not yet documented.
	https://docs.ruby-lang.org/ja/latest/class/StringScanner.html

	https://github.com/ruby/strscan/commit/1fbfdd3c6f

	[ruby/strscan] Bump version

	https://github.com/ruby/strscan/commit/d6f97ec102
2024-06-04 13:14:09 -07:00
Takashi Kokubun 0a0338b06f merge revision(s) 9f708d48f6, 0301473fb5, 874e9fc34d, 7f0e26b7f99bf76408569892ce20318501f74729: [Backport #20516]
Clear runtime dependencies if default gems is specified.

	The current build system uses runtime dependencies from only
	`.bundle` directory. We shouldn't install runtime dependencies
	from rubygems.org when `make test-bundled-gems` is invoked.

	Fixed dependencies list format

	Don't need to remove ruby2_keywords dependency from drb

	Re-use strscan with ruby repo
2024-06-04 11:43:25 -07:00
Takashi Kokubun c9bec74b21 merge revision(s) 70ad58cb62b195ba86a5ef07a565b22b02a040ea: [Backport #20516]
Update bundled_gems
2024-05-31 17:13:33 -07:00
Takashi Kokubun ea196a3c9f merge revision(s) be7c91db44d6b8dba8fa11ff782965b4bfa0b3c8: [Backport #20515]
Do not pollute toplevel namespace
2024-05-30 14:53:54 -07:00
Takashi Kokubun 8f5b1bb64b merge revision(s) fd549b229b0822198ddc847703194263a2186ed1: [Backport #20515]
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: 22e4eeda65
	follow-up: https://github.com/ruby/ruby/pull/10875
2024-05-30 13:05:32 -07:00
Takashi Kokubun 74ba1914dd merge revision(s) 22e4eeda6561693367fc7a00b92b90f46b09cabd,1ab7c412d2e3880a7ad233c32e93961888f8145c: [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 18eaf0be90

	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: 18eaf0be90
	follow-up: https://github.com/ruby/ruby/pull/10805
2024-05-30 11:54:34 -07:00
Takashi Kokubun b13cf49036 merge revision(s) 055613fd868a8c94e43893f8c58a00cdd2a81f6d,127d7a35df10ee2bc99f44b888972b2c5361d84f,e2a9b87126d59e4766479a7aa12cf7a648f46506: [Backport #20447]
Fix pointer incompatiblity

	Since the subsecond part is discarded, WIDEVAL to VALUE conversion is
	needed.

	Some functions are not used when `THREAD_MODEL=none`

	`rb_thread_sched_destroy` is not used now at all
2024-05-30 11:13:15 -07:00
Takashi Kokubun e5a195edf6 v3.3.2 2024-05-29 17:23:11 -07:00
Takashi Kokubun a9b6a7bf72 merge revision(s) ce20367a0e2f1fcfabebf3b6bea732fc71fa79f7: [Backport #20500]
Define `incflags` also on mswin
2024-05-29 17:11:36 -07:00
Takashi Kokubun a96233161a merge revision(s) 5fa6ba9568e87e43e08a4daeba1572254c589fb1: [Backport #20500]
[Bug #20500] Search non-default directories for jemalloc

	Co-Authored-by: lish82 (Hiroki Katagiri)
2024-05-29 16:53:29 -07:00
Takashi Kokubun b2eb7f47b3 merge revision(s) 1faeb44dfcf777ace28321e80d0ebf942161a0a7,7f87ad9fc4bc45faf8cd33602a025f27c094b2fd: [Backport #20431]
Check if macros are defined before using

	Assume macros with the same prefix would be defined together.

	Refer autoconfigured endian macro (#10572)

	Remove the case `RB_IO_BUFFER_HOST_ENDIAN` is not defined.
2024-05-29 16:50:13 -07:00
Takashi Kokubun d65da20eb4 merge revision(s) ef3803ed4028810f9088019f0db1a366370ab53a: [Backport #20502]
Ignore the result of pthread_kill in ubf_wakeup_thread

	After an upgrade to Ruby 3.3.0, I experienced reproducible production crashes
	of the form:

	[BUG] pthread_kill: No such process (ESRCH)

	This is the only pthread_kill call in Ruby. The result of pthread_kill was
	previously ignored in Ruby 3.2 and below. Checking the result was added in
	be1bbd5b7d (MaNy).

	I have not yet been able to create a minimal self-contained example,
	but it should be safe to remove the checks.
2024-05-29 16:48:51 -07:00
Takashi Kokubun 0044b6aefc merge revision(s) bc002971b6ad483dbf69b8a275c44412bb6ab954: [Backport #20094]
[Bug #20094] Distinguish `begin` and parentheses
2024-05-29 16:35:18 -07:00
Takashi Kokubun b3f2ccea5e merge revision(s) 18eaf0be905e3e251423b42d6f4e56b7cae1bc3b: [Backport #20494]
[Bug #20494] Search non-default directories for GMP

	Co-Authored-by: lish82 (Hiroki Katagiri)
2024-05-29 16:18:29 -07:00
Takashi Kokubun cf643fabd5 merge revision(s) d292a9b98ce03c76dbe13138d20b9fbf613cc02d: [Backport #20453]
[Bug #20453] segfault in Regexp timeout

	https://bugs.ruby-lang.org/issues/20228 started freeing `stk_base` to
	avoid a memory leak. But `stk_base` is sometimes stack allocated (using
	`xalloca`), so the free only works if the regex stack has grown enough
	to hit `stack_double` (which uses `xmalloc` and `xrealloc`).

	To reproduce the problem on master and 3.3.1:

	```ruby
	Regexp.timeout = 0.001
	/^(a*)x$/ =~ "a" * 1000000 + "x"'
	```

	Some details about this potential fix:

	`stk_base == stk_alloc` on
	[init](dde99215f2/regexec.c (L1153)),
	so if `stk_base != stk_alloc` we can be sure we called
	[`stack_double`](dde99215f2/regexec.c (L1210))
	and it's safe to free. It's also safe to free if we've
	[saved](dde99215f2/regexec.c (L1187-L1189))
	the stack to `msa->stack_p`, since we do the `stk_base != stk_alloc`
	check before saving.

	This matches the check we do inside
	[`stack_double`](dde99215f2/regexec.c (L1221))
2024-05-29 15:52:15 -07:00
Takashi Kokubun 5c06e93074 merge revision(s) 6ade36c06b7cef948099b8f5f483763498705d12: [Backport #20414]
`Fiber#raise` recursively raises on nested resuming_fiber. (#10482)

	* Improve consistency of `Fiber.current.raise`.
2024-05-29 15:47:26 -07:00
Takashi Kokubun b44c02ad5a merge revision(s) c479492a6701dcef3d3a96de8946ecf7beb079d4: [Backport #20427]
Resize ary when `Array#sort!` block modifies embedded ary

	In cases where `rb_ary_sort_bang` is called with a block and
	tmp is an embedded array, we need to account for the block
	potentially impacting the capacity of ary.

	ex:
	```
	var_0 = (1..70).to_a
	var_0.sort! do |var_0_block_129, var_1_block_129|
	  var_0.pop
	  var_1_block_129 <=> var_0_block_129
	end.shift(3)
	```

	The above example can put the array into a corrupted state
	resulting in a heap buffer overflow and possible segfault:
	```
	ERROR: AddressSanitizer: heap-buffer-overflow on address [...]
	WRITE of size 560 at 0x60b0000034f0 thread T0 [...]
	```

	This commit adds a conditional to determine when the capacity
	of ary has been modified by the provided block. If this is
	the case, ensure that the capacity of ary is adjusted to
	handle at minimum the len of tmp.
2024-05-29 15:44:55 -07:00
Takashi Kokubun 5688bcb54a merge revision(s) 5d1702e01a36e11b183fe29ce10780a9b1a41cf0: [Backport #20413]
Enumerator should use a non-blocking fiber, change `rb_fiber_new` to be non-blocking by default. (#10481)
2024-05-29 15:43:01 -07:00
Takashi Kokubun a24f19742b merge revision(s) 58918788abd63901588e4aa1e39b5c057321c10a: [Backport #20342]
[Bug #20342] Consider wrapped load in `main` methods
2024-05-29 15:40:49 -07:00
Takashi Kokubun 72a45ac7a3 merge revision(s) 3a04ea2d0379dd8c6623c2d5563e6b4e23986fae: [Backport #20305]
[Bug #20305] Fix matching against an incomplete character

	When matching against an incomplete character, some `enclen` calls are
	expected not to exceed the limit, and some are expected to return the
	required length and then the results are checked if it exceeds.
2024-05-29 15:11:56 -07:00
Takashi Kokubun 6e46a363a8 merge revision(s) a7ff264477105b5dc0ade6facad4176a1b73df0b: [Backport #20393]
Don't clear pending interrupts in the parent process. (#10365)
2024-05-29 11:46:33 -07:00
Takashi Kokubun 2ae6df6d03 merge revision(s) 9f8f32bf9f3758ba67dd2afe7e07d9eccb68bbc7: [Backport #20289]
[ruby/zlib] In Zlib::GzipReader#eof? check if we're actually at eof

	Only consider it eof if we read ahead and something fills the buf.
	If not, we may only have empty blocks and the footer.

	Fixes https://github.com/ruby/zlib/pull/56

	https://github.com/ruby/zlib/commit/437bea8003
2024-05-29 11:35:23 -07:00
Takashi Kokubun 548c7cb9f5 merge revision(s) 7e4b1f8e1935a10df3c41ee60ca0987d73281126: [Backport #20322]
[Bug #20322] Fix rb_enc_interned_str_cstr null encoding

	The documentation for `rb_enc_interned_str_cstr` notes that `enc` can be
	a null pointer, but this currently causes a segmentation fault when
	trying to autoload the encoding. This commit fixes the issue by checking
	for NULL before calling `rb_enc_autoload`.
2024-05-29 11:07:07 -07:00
Takashi Kokubun 8f1084db9b merge revision(s) dc146babf47a84bbd1f176d766637d4a40327019,f23d5028059078a346efc977287b669d494a5a3f,a0f7de814ae5c299d6ce99bed5fb308a05d50ba0: [Backport #20296]
[Bug #20296] Clear errinfo when `exception: false`

	[Bug #20296] Refine the test

	[Bug #20296] Fix the default assertion message
2024-05-29 11:00:27 -07:00
Takashi Kokubun f12c947192 merge revision(s) e04146129ec6898dd6a9739dad2983c6e9b68056: [Backport #20292]
[Bug #20292] Truncate embedded string to new capacity
2024-05-29 10:19:49 -07:00
Takashi Kokubun a8b2317d16 merge revision(s) 78d9fe69479d32214a52ad7291c3973f1b6b7f6f: [Backport #20286]
Ensure that exiting thread invokes end-of-life behaviour. (#10039)
2024-05-29 10:02:15 -07:00
Takashi Kokubun 9cb804a2bd merge revision(s) 04729fe68dceddab045be7324e26c2bb15aa62c7: [Backport #20288]
Fix exception handling in `rb_fiber_scheduler_set`. (#10042)
2024-05-28 17:46:47 -07:00
Takashi Kokubun 6383d0afac merge revision(s) 015b0e2e1d312e2be60551587389c8da5c585e6f,ac1e9e443a0d6a4d4c0801c26d1d8bd33d9eb431: [Backport #20195]
YJIT: Fix unused warnings

	```
	warning: unused import: `condition::Condition`
	  --> src/asm/arm64/arg/mod.rs:13:9
	   |
	13 | pub use condition::Condition;
	   |         ^^^^^^^^^^^^^^^^^^^^
	   |
	   = note: `#[warn(unused_imports)]` on by default

	warning: unused import: `rb_yjit_fix_mul_fix as rb_fix_mul_fix`
	   --> src/cruby.rs:188:9
	    |
	188 | pub use rb_yjit_fix_mul_fix as rb_fix_mul_fix;
	    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

	warning: unused import: `rb_insn_len as raw_insn_len`
	   --> src/cruby.rs:142:9
	    |
	142 | pub use rb_insn_len as raw_insn_len;
	    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
	    |
	    = note: `#[warn(unused_imports)]` on by default
	```

	Make asm public so it stops warning about unused public stuff in there.

	YJIT: Fix ruby2_keywords splat+rest and drop bogus checks

	YJIT didn't guard for ruby2_keywords hash in case of splat calls that
	land in methods with a rest parameter, creating incorrect results.

	The compile-time checks didn't correspond to any actual effects of
	ruby2_keywords, so it was masking this bug and YJIT was needlessly
	refusing to compile some code. About 16% of fallback reasons in
	`lobsters` was due to the ISeq check.

	We already handle the tagging part with
	exit_if_supplying_kw_and_has_no_kw() and should now have a dynamic guard
	for all splat cases.

	Note for backporting: You also need 7f51959ff1.

	[Bug #20195]
2024-05-28 17:10:33 -07:00
Takashi Kokubun 9c81bbbbb7 merge revision(s) 7f51959ff14fbe06bc1afd283d1af17b26161cf4: [Backport #20204]
YJIT: Move guard up for a case of splat+rest

	Previously, YJIT put the guard for having enough items to extract from
	splat array at a place where the side exit is invalid, so if the guard
	fails, YJIT could raise something other than ArgumentError. Move the
	guard up to a place before any stack manipulation.

	[Bug #20204]
2024-05-28 16:55:49 -07:00
Takashi Kokubun 917f3e5d22 merge revision(s) f36a71e26995b69ff72bc132bbcf40ad89571414: [Backport #20307]
[Bug #20307] Fix `Hash#update` to make frozen copy of string keys
2024-05-28 15:17:51 -07:00
Takashi Kokubun b77b5c1915 merge revision(s) 5e0c17145131e073814c7e5b15227d0b4e73cabe: [Backport #20169]
Make io_fwrite safe for compaction

	[Bug #20169]

	Embedded strings are not safe for system calls without the GVL because
	compaction can cause pages to be locked causing the operation to fail
	with EFAULT. This commit changes io_fwrite to use rb_str_tmp_frozen_no_embed_acquire,
	which guarantees that the return string is not embedded.
2024-05-28 14:22:45 -07:00
NARUSE, Yui c56cd86388 v3.3.1 2024-04-23 19:20:14 +09:00
NARUSE, Yui 6d6818883b
merge revision(s) b176315827d1082f43628013a7d89fda02724d33: [Backport #20324] (#10329)
[Bug #20324] Uncomparable ranges are not overlapping
2024-03-22 01:33:40 +00:00
NARUSE, Yui 821719a505
merge revision(s) d3279a0c11ca45ca85027e7eb74dc4aac52c478b: [Backport #20327] (#10313)
[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.
2024-03-21 02:18:06 +00:00
NARUSE, Yui b2c2702f20
merge revision(s) 01fd262e62076277a41af72ea13f20deb1b462a2: [Backport #20245] (#10307)
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")
2024-03-21 00:05:07 +00:00
NARUSE, Yui 00cb72157a
merge revision(s) 3e6e3ca2627b1aa71b17de902cc1b8188246a828: [Backport #20207] (#10299)
Correctly handle consecutive lookarounds (#9738)

	Fix [Bug #20207]
	Fix [Bug #20212]

	Handling consecutive lookarounds in init_cache_opcodes is buggy, so it
	causes invalid memory access reported in [Bug #20207] and [Bug #20212].
	This fixes it by using recursive functions to detected lookarounds
	nesting correctly.
2024-03-20 17:13:59 +00:00