16554 Commits
Author SHA1 Message Date
Hiroshi SHIBATA 7cdea3bd49 Merge zlib-3.0.1 2026-03-10 15:58:49 +09:00
Hiroshi SHIBATA e8e2fe6b5b Skip some broken tests with mingw platform 2026-01-13 16:23:44 +09:00
Hiroshi SHIBATA f9b2ebc9ab Truncate x-oauth-basic strings from tests of rubygems 2025-10-07 19:54:25 +09:00
Hiroshi SHIBATA 2c01a34978 Merge URI-0.12.5 2025-10-07 19:54:25 +09:00
Hiroshi SHIBATA 9f00b8872d Bump up resolv-0.2.3 for Ruby 3.2 2025-07-09 06:18:51 +09:00
Hiroshi SHIBATA 647e1ff938 Use EnvUtil.apply_timeout_scale 2025-04-04 07:38:56 +09:00
Hiroshi SHIBATA fa95d1b0b8 Extend open_timeout for test failure on s390x
https://rubyci.s3.amazonaws.com/s390x/ruby-master/log/20250403T060004Z.fail.html.gz
2025-04-04 07:38:56 +09:00
Hiroshi SHIBATA b79909fc5a Followed up 7c400c66c9 2025-04-03 19:36:39 +09:00
Hiroshi SHIBATA 7c400c66c9 Use IPv4 for test server because TestNetHTTPS is failing with s390x
https://rubyci.s3.amazonaws.com/s390x/ruby-3.2/log/20250403T005659Z.fail.html.gz
2025-04-03 14:44:09 +09:00
Hiroshi SHIBATA d75d4275e4 [rubygems/rubygems] Bump up minimum required version for cmake 4
https://github.com/rubygems/rubygems/commit/3e77caeddf
2025-04-02 10:37:08 +09:00
Hiroshi SHIBATA 469a0a4a08 merge revision(s) da4464b824: [Backport #19426]
[Bug #19426] Fix endless `Range#step` with `#succ` method
2025-03-13 14:27:06 +09:00
Hiroshi SHIBATA 998c26cd28 merge revision(s) 79eb75a8dd: [Backport #20025]
[Bug #20025] Check if upper/lower before fallback to case-folding
2025-03-13 14:27:06 +09:00
Hiroshi SHIBATA 774e3f0003 merge revision(s) 08b3a45bc9: [Backport #21180]
Push a real iseq in rb_vm_push_frame_fname()

	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-13 14:27:06 +09:00
Hiroshi SHIBATA 2c49513291 it is not working with Ruby 3.2 2025-03-13 14:27:06 +09:00
Hiroshi SHIBATA 64d93539e7 Merge strscan-3.0.7 2025-03-13 14:27:06 +09:00
Hiroshi SHIBATA 6dd8bd0d90 merge revision(s) f423f6e10c: [Backport #21131]
Ensure IO.copy_stream buffer is an independent string

	Otherwise, changes to the buffer by the destination write method
	could result in data changing for supposedly independent strings.

	Fixes [Bug #21131]
2025-03-13 14:27:06 +09:00
John HawthornandAlan Wu bb6b3c98dc Replace tombstone when converting AR to ST hash
[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-06 11:05:43 +09:00
Hiroshi SHIBATA 9e5d68f03f Merge cgi-0.3.7 2025-02-26 19:19:19 +09:00
Hiroshi SHIBATA 946907f218 Merge uri-0.12.4 2025-02-26 19:19:19 +09:00
nagachika f9adaab928 merge revision(s) e0d600ec19: [Backport #21012]
Avoid opt_aset_with optimization inside multiple assignment

	Previously, since the opt_aset_with optimization was introduced,
	use of the opt_aset_with optimization inside multiple assignment
	would result in a segfault or incorrect instructions.

	Fixes [Bug #21012]

	Co-authored-by: Nobuyoshi Nakada <nobu.nakada@gmail.com>
2025-01-25 14:37:41 +09:00
nagachika 845763fdf3 merge revision(s) b176d4f52e: [Backport #21008]
[Bug #21008] Normalize before sum to float

	After switching to `Float`-mode when summing `Numeric` objects,
	normalization for `Float` is still needed.
2025-01-11 15:32:49 +09:00
nagachika f150d67b7d merge revision(s) 8034e9c3d0: [Backport #20995]
[Bug #20995] Protect `IO.popen` block from exiting by exception
2025-01-11 15:30:06 +09:00
nagachika 4e59c10646 merge revision(s) 19c39e4cfa, d78ff6a767: [Backport #20984]
[Bug #20984] ENV.inspect should be encoding aware

	[Bug #20984] Fix test with locale encoding
2025-01-11 15:28:05 +09:00
nagachika 3110d5c8ab merge revision(s) e90b447655: [Backport #20924]
[Bug #20924] Fix reading with delimiter in wide character encodings
2024-12-15 16:18:43 +09:00
nagachika 303a83d35c merge revision(s) 660b995365: [Backport #20915]
[Bug #20915] Fix SEGV with `TracePoint#parameters` and aliased C method

	The following snippet results with a SEGV:

	```ruby
	C = Class.new do
	  alias_method :new_to_s, :to_s
	end

	TracePoint.new(:c_call, &:parameters).enable { C.new.new_to_s }
	```

	at MRI 3.3.6 and ruby 3.4.0dev

	The root cause of the issue lies in the `rb_tracearg_parameters` function
	within the `RUBY_EVENT_C_RETURN` branch. Specifically, when the invoked
	method is an alias for a C function,
	`rb_method_entry_without_refinements(..., trace_arg->called_id, ...)`
	may return NULL. In that case we can fallback to `trace_arg->id`.
2024-12-15 15:28:25 +09:00
nagachika 937319126a merge revision(s) 02b70256b5, 6b4f8945d6: [Backport #20909]
Check negative integer underflow

	Many of Oniguruma functions need valid encoding strings
2024-11-30 18:34:32 +09:00
nagachika 87249cbddb merge revision(s) a8c2d5e7be: [Backport #20907]
Ensure fiber scheduler re-acquires mutex when interrupted from sleep. (#12158)

	[Bug #20907]
2024-11-30 14:31:31 +09:00
nagachika bb065f0844 merge revision(s) 3b7892b6e4: [Backport #20871]
Fix a bug in rb_include_module that stops nested inclusion into module subclasses

	This bug was present since the code was originally added by me
	in 3556a834a2.

	Fixes [Bug #20871]
2024-11-30 14:29:18 +09:00
Hiroshi SHIBATA d3098d2068 Removed extra assertions for Ruby 3.2 2024-11-22 08:06:01 +09:00
KJ Tsanaktsidis 9e1a78059d Fix flaky "Expected 499 to be >= 500" assertion in test_gc_compact.rb
There have been some sproradically flaky tests related to GC compaction,
which fail with:

  1) Failure:
TestGCCompact#test_moving_hashes_down_size_pools [/test/ruby/test_gc_compact.rb:442]:
Expected 499 to be >= 500.

What's happening here, is that, _sometimes_, depending on very unlucky
combinations of machine things, one of the expected-to-be-moved hashes
might be found on the machine stack during GC, and thus pinned.

One factor which seems to make this _more_ likely is that GCC 11 on
Ubuntu 22.04 seems to want to allocate 440 bytes of stack space for
`gc_start`, which is much more than it actually uses on the common code
path. The result is that there are some 50-odd VALUE-sized cells "live"
on the stack which may well contain valid heap pointers from previous
function calls, and will need to be pinned.

This is, of course, totally normal and expected; Ruby's GC is
conservative and if there is the possibility that a VALUE might be live
on the machine stack, it can't be moved. However, it does make these
tests flaky.

This commit "fixes" the tests by performing the work in a fiber; the
fiber goes out of scope and should be collected by the call to
verify_compaction_references, so there should be no references to the
to-be-moved objects floating around on the machine stack.

Fixes [#20021]
2024-11-22 08:06:01 +09:00
Peter Zhu 9aa313f2f8 Assert that at least one element has been embedded
It's not guaranteed that the first element will always be embedded.
2024-11-22 08:06:01 +09:00
Peter Zhu c692229197 Assert that resizing arrays will re-embed them 2024-11-22 08:06:01 +09:00
Peter Zhu 605592b9be Assert that resizing objects will re-embed them 2024-11-22 08:06:01 +09:00
Matt Valentine-House ed41225edd Fix Error in GC Compaction specs
Previously if any of the tests that move objects between size pools
failed to move anything, then the call to stats.dig would return `nil`
which would then cause assert_operator to error.

This should be a test Failure, rather than an Error so this commit uses
a default value of 0 if stats.dig fails to find a key.

Also refactor object movement tests to use stats.dig, rather than :[]
2024-11-22 08:06:01 +09:00
MSP-Greg 1e56c26ace [ruby/net-http] test_https.rb - fix test_session_reuse_but_expire
https://github.com/ruby/net-http/commit/5544243c41
2024-11-19 19:31:46 +09:00
Job Snijders 870e5b2b4f [ruby/openssl] Only CSR version 1 (encoded as 0) is allowed by PKIX standards
RFC 2986, section 4.1 only defines version 1 for CSRs. This version
is encoded as a 0. Starting with OpenSSL 3.3, setting the CSR version
to anything but 1 fails.

Do not attempt to generate a CSR with invalid version (which now fails)
and invalidate the CSR in test_sign_and_verify_rsa_sha1 by changing its
subject rather than using an invalid version.

This commit fixes the following error.

```
 2) Error: test_version(OpenSSL::TestX509Request): OpenSSL::X509::RequestError:
X509_REQ_set_version: passed invalid argument
/home/runner/work/openssl/openssl/test/openssl/test_x509req.rb:18:in `version='
/home/runner/work/openssl/openssl/test/openssl/test_x509req.rb:18:in `issue_csr'
/home/runner/work/openssl/openssl/test/openssl/test_x509req.rb:43:in
`test_version'
     40:     req = OpenSSL::X509::Request.new(req.to_der)
     41:     assert_equal(0, req.version)
     42:
  => 43:     req = issue_csr(1, @dn, @rsa1024, OpenSSL::Digest.new('SHA256'))
     44:     assert_equal(1, req.version)
     45:     req = OpenSSL::X509::Request.new(req.to_der)
     46:     assert_equal(1, req.version)
```

https://github.com/ruby/openssl/commit/c06fdeb091
2024-11-19 19:31:46 +09:00
nagachika a7b013b392 merge revision(s) d71be7274b: [Backport #20873]
[Bug #20873] Consider `-FIXNUM_MIN` overflow

	`-FIXNUM_MIN` is usually greater than `FIXNUM_MAX` on platforms using
	two's complement representation.
2024-11-10 15:15:53 +09:00
9bcc5c5fd9 Fix update_coderange for binary strings
Although a binary (aka ASCII-8BIT) string will never have a broken
coderange, it still has to differentiate between "valid" and "7bit".

On Ruby 3.4/trunk this problem is masked because we now clear the
coderange more agressively in rb_str_resize, and we happened to always
be strinking this string, but we should not assume that.

On Ruby 3.3 this created strings where `ascii_only?` was true in cases
it shouldn't be as well as other problems.

Fixes [Bug #20883]

Co-authored-by: Daniel Colson <danieljamescolson@gmail.com>
Co-authored-by: Matthew Draper <matthew@trebex.net>
2024-11-10 15:13:24 +09:00
nagachika ee3428aa0e merge revision(s) 56ecc243e2: [Backport #20868]
[Bug #20868] Fix Method#hash to not change after compaction

	The hash value of a Method must remain constant after a compaction, otherwise
	it may not work as the key in a hash table.

	For example:

	    def a; end

	    # Need this method here because otherwise the iseq may be on the C stack
	    # which would get pinned and not move during compaction
	    def get_hash
	      method(:a).hash
	    end

	    puts get_hash # => 2993401401091578131

	    GC.verify_compaction_references(expand_heap: true, toward: :empty)

	    puts get_hash # => -2162775864511574135
2024-11-10 13:04:43 +09:00
nagachika 288e24b73a merge revision(s) 29c480dd6f: [Backport #20853]
[Bug #20853] Fix Proc#hash to not change after compaction

	The hash value of a Proc must remain constant after a compaction, otherwise
	it may not work as the key in a hash table.
2024-11-10 12:55:34 +09:00
Hiroshi SHIBATA 35bd3d110f Skip MinGW failure with GitHub Actions update
We should fix this later
2024-11-06 15:35:34 +09:00
Hiroshi SHIBATA e548ff67ea Pend some tests because these are not working with macOS 15 and Xcode 16 2024-11-06 15:35:34 +09:00
nagachika cb75fcef6f merge revision(s) 6118e8a473, dc64448202: [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-18 13:57:08 +09:00
nagachika 087e4ed6cc merge revision(s) 35e124832e: [Backport #20755]
[Bug #20755] Frozen string should not be writable via IO::Buffer
2024-10-18 13:57:08 +09:00
nagachika 5777fe5ab5 merge revision(s) 637067440f: [Backport #20752]
[Bug #20752] Slice of readonly `IO::Buffer` also should be readonly
2024-10-18 11:30:05 +09:00
nagachika 18074c5081 merge revision(s) c1862cbb89: [Backport #20719]
[Bug #20719] `Float` argument must be ASCII compatible
2024-10-18 11:25:12 +09:00
nagachika 48af30b068 merge revision(s) d33e3d47b8: [Backport #20704]
[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-18 11:22:30 +09:00
Samuel Williams 3d4d5c8d8c Add IO::Buffer tests for read and write with length & offset. 2024-10-04 10:09:39 +09:00
nagachika 21c708ee80 merge revision(s) 992596fb7a: [Backport #20344]
Fix next inside block argument stack underflow

	[Bug #20344]
	Fix compile_next adding removable adjust label
2024-08-18 18:07:14 +09:00
Stan Hu 65fed1c3e4 Allow waitpid(-1, Process::WNOHANG) to be woken if a waitpid(pid) is
...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-18 18:02:09 +09:00