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

16361 Коммитов

Автор SHA1 Сообщение Дата
Nobuyoshi Nakada 4378de02f9
Test of environment variables order for HOME on Windows 2022-12-24 23:49:27 +09:00
Nobuyoshi Nakada 6a55b4601a
Add Dir.home test with encoding 2022-12-24 22:55:12 +09:00
Takashi Kokubun b9332ac8e7
MJIT: Cancel all on disastrous situations (#7019)
I noticed this while running test_yjit with --mjit-call-threshold=1, 
which redefines `Integer#<`. When Ruby is monkey-patched, 
MJIT itself could be broken.

Similarly, Ruby scripts could break MJIT in many different ways. I
prepared the same set of hooks as YJIT so that we could possibly
override it and disable it on those moments. Every constant under
RubyVM::MJIT is private and thus it's an unsupported behavior though.
2022-12-24 01:13:40 -08:00
Hiroshi SHIBATA f6620037ba Merge RubyGems-3.4.0 and Bundler-2.4.0 2022-12-24 16:57:07 +09:00
Nobuyoshi Nakada d5635dfe36
Extract setup of environment variables 2022-12-24 11:29:11 +09:00
Samuel Williams 11ad9a42d7
Fix missing handling of offset argument in `IO::Buffer` `pread` and `pwrite`. (#7012) 2022-12-24 07:52:10 +13:00
Yusuke Endoh a8485291bb test/test_trick.rb: Add tests for TRICK 2022 entries 2022-12-24 03:19:45 +09:00
Peter Zhu 1876cda972 Add tests for compacting shared arrays 2022-12-23 11:21:14 -05:00
Peter Zhu 7891f94071 Don't allow re-embedding frozen arrays
Frozen arrays should not move from heap allocated to embedded because
frozen arrays could be shared roots for other (shared) arrays. If the
frozen array moves from heap allocated to embedded it would cause issues
since the shared array would no longer know where to set the pointer
in the shared root.
2022-12-23 11:21:14 -05:00
Nobuyoshi Nakada 17b63ab6b1
[ruby/rdoc] Fix fragile tests
When the temporary path is long enough, the formatter may fold the
path and may hit a hyphen at the end of line, and miscounted.

https://github.com/ruby/rdoc/commit/5f46479543
2022-12-23 20:31:25 +09:00
Nobuyoshi Nakada 9c1f03a38a
Debug for zlinux CI [ci skip] 2022-12-23 16:57:15 +09:00
Nobuyoshi Nakada 792c50e917 [ruby/rdoc] Clean up home directories for each test
https://github.com/ruby/rdoc/commit/f067c174da
2022-12-23 11:05:09 +09:00
Kazuki Yamaguchi 75e7b85e3e [ruby/openssl] test/openssl/test_pkey.rb: allow failures in test_s_generate_parameters
The root cause has been fixed by OpenSSL 3.0.6, but Ubuntu 22.04's
OpenSSL package has not backported the patch yet.

Reference: https://github.com/ruby/openssl/issues/492

https://github.com/ruby/openssl/commit/f2e2a5e5ed
2022-12-23 09:39:15 +09:00
Joe Truba 0e11d2c3f8 [ruby/openssl] pkey/ec: check private key validity with OpenSSL 3
The behavior of EVP_PKEY_public_check changed between OpenSSL 1.1.1
and 3.0 so that it no longer validates the private key. Instead, private
keys can be validated through EVP_PKEY_private_check and
EVP_PKEY_pairwise_check.

[ky: simplified condition to use either EVP_PKEY_check() or
EVP_PKEY_public_check().]

https://github.com/ruby/openssl/commit/e38a63ab3d
2022-12-23 09:39:15 +09:00
Kazuki Yamaguchi a4b4997c69 [ruby/openssl] test/openssl/test_ssl.rb: do not run SSL tests if not available
https://github.com/ruby/openssl/commit/a3d230d4e0
2022-12-23 09:39:15 +09:00
Kazuki Yamaguchi dd6f3276e0 [ruby/openssl] ssl: disable NPN support on LibreSSL
As noted in commit https://github.com/ruby/openssl/commit/a2ed156cc9f1 ("test/test_ssl: do not run NPN tests
for LibreSSL >= 2.6.1", 2017-08-13), NPN is known not to work properly
on LibreSSL.

Disable NPN support on LibreSSL, whether OPENSSL_NO_NEXTPROTONEG is
defined or not.

NPN is less relevant today anyway. Let's also silence test suite when
it's not available.

https://github.com/ruby/openssl/commit/289f6e0e1f
2022-12-23 09:39:15 +09:00
Kazuki Yamaguchi 7c073cc112 [ruby/openssl] test/openssl/test_asn1.rb: remove pend for unsupported LibreSSL versions
Commit https://github.com/ruby/openssl/commit/af895bc5596b ("asn1: avoid truncating OID in
OpenSSL::ASN1::ObjectId#oid", 2016-12-15) added this test case.

The OBJ_obj2txt() issue was fixed by LibreSSL 2.5.1 (released in 2017)
and is no longer relevant today.

https://github.com/ruby/openssl/commit/6a188f1a29
2022-12-23 09:39:15 +09:00
Kazuki Yamaguchi 5591e4935d [ruby/openssl] test/openssl/test_asn1.rb: skip failing tests on LibreSSL 3.6.0
LibreSSL 3.6.0 expects the seconds part in UTCTime and GeneralizedTime
to be always present. LibreSSL 3.6.0 release note [1] says:

> - The ASN.1 time parser has been refactored and rewritten using CBS.
>   It has been made stricter in that it now enforces the rules from
>   RFC 5280.

[1] https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-3.6.0-relnotes.txt

https://github.com/ruby/openssl/commit/bbc540fe83
2022-12-23 09:39:15 +09:00
Nobuyoshi Nakada dc8c5bafcf
Clean intermediate source file in `TestMJIT#test_jit_failure` (#6994) 2022-12-22 13:06:31 -08:00
Jeremy Evans 7e8fa06022 Always issue deprecation warning when calling Regexp.new with 3rd positional argument
Previously, only certain values of the 3rd argument triggered a
deprecation warning.

First step for fix for bug #18797.  Support for the 3rd argument
will be removed after the release of Ruby 3.2.

Fix minor fallout discovered by the tests.

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2022-12-22 11:50:26 -08:00
Nobuyoshi Nakada 454c00723a Share argument parsing in `Regexp#initialize` and `Regexp.linear_time?` 2022-12-22 15:51:00 +09:00
Jeremy Evans 4213f42555
Make sure TracePoint#binding returns nil for c_call/c_return events
This makes sure the method returns nil for these events, as
described in NEWS, even if the TracePoint could create a binding.
2022-12-21 21:02:43 -08:00
Ufuk Kayserilioglu 99cee85775
Add copy with changes functionality for Data objects (#6766)
Implements [Feature #19000]

This commit adds copy with changes functionality for `Data` objects
using a new method `Data#with`.

Since Data objects are immutable, the only way to change them is by
creating a copy. This PR adds a `with` method for `Data` class instances
that optionally takes keyword arguments.

If the `with` method is called with no arguments, the behaviour is the
same as the `Kernel#dup` method, i.e. a new shallow copy is created
with no field values changed.

However, if keyword arguments are supplied to the `with` method, then
the copy is created with the specified field values changed. For
example:
```ruby
    Point = Data.define(:x, :y)
    point = Point.new(x: 1, y: 2)
    point.with(x: 3) # => #<data Point x: 3, y: 2>
```

Passing positional arguments to `with` or passing keyword arguments to
it that do not correspond to any of the members of the Data class will
raise an `ArgumentError`.

Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
2022-12-21 16:27:38 -08:00
Akinori MUSHA cc4c28ec2e Make Enumerartor.product return nil when called with a block 2022-12-21 19:13:15 +09:00
Akinori MUSHA 308ccbaeb2 Make product consistently yield an array of N elements instead of N arguments
Inconsistency pointed out by @mame:

```
>> Enumerator.product([1], [2], [3]).to_a
=> [[1, 2, 3]]
>> Enumerator.product([1], [2]).to_a
=> [[1, 2]]
>> Enumerator.product([1]).to_a
=> [1]
>> Enumerator.product().to_a
=> [nil]
```

Got fixed as follows:

```
>> Enumerator.product([1], [2], [3]).to_a
=> [[1, 2, 3]]
>> Enumerator.product([1], [2]).to_a
=> [[1, 2]]
>> Enumerator.product([1]).to_a
=> [[1]]
>> Enumerator.product().to_a
=> [[]]
```

This was due to the nature of the N-argument funcall in Ruby.
2022-12-21 18:19:19 +09:00
Nobuyoshi Nakada 1a24442193
test/socket/test_addrinfo.rb: Suppress Errno::EACCES on Windows 2022-12-21 15:18:34 +09:00
Nobuyoshi Nakada 502ca37dde [ruby/optparse] The encoding argument of `Regexp.new` has been ignored since 1.9
https://github.com/ruby/optparse/commit/766f567405
2022-12-21 14:09:12 +09:00
Sorah Fukumori 47988e63d6 test_readline#test_without_tty: Use EnvUtil.rubybin
`ruby` is not always available in certain build environments and
configure options. Choose appropriate command line using EnvUtil.
2022-12-21 09:40:09 +09:00
Benoit Daloze 0efa36ac06 Ensure Fiber storage is only accessed from the Fiber it belongs to 2022-12-20 19:32:23 +01:00
Benoit Daloze d557f17974 Use an experimental warning for Fiber#storage= 2022-12-20 19:32:23 +01:00
Benoit Daloze 45175962a6 Never use the storage of another Fiber, that violates the whole design
* See https://bugs.ruby-lang.org/issues/19078#note-30
2022-12-20 19:32:23 +01:00
Nobuyoshi Nakada 2e7e153a2a [Bug #19242] Prohibit circular causes to be loaded 2022-12-20 14:12:38 +09:00
dependabot[bot] ad1f61fe80 [rubygems/rubygems] Bump rb-sys
Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.48 to 0.9.52.
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.48...v0.9.52)

---
updated-dependencies:
- dependency-name: rb-sys
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-20 13:15:02 +09:00
dependabot[bot] ae30b42621 [rubygems/rubygems] Bump rb-sys in /test/rubygems/test_gem_ext_cargo_builder/custom_name
Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.48 to 0.9.52.
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.48...v0.9.52)

---
updated-dependencies:
- dependency-name: rb-sys
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-20 13:15:02 +09:00
Eloy Espinaco 0a9544ce4a [rubygems/rubygems] Cleanup intermediate artifacts after installing built extensions
https://github.com/rubygems/rubygems/commit/98b6a959bd
2022-12-20 13:15:02 +09:00
David Rodríguez 9d10b8393e [rubygems/rubygems] Use better name for variable
The installed file not always have the `.so` extension.

https://github.com/rubygems/rubygems/commit/6f6681bcb9

Co-authored-by: Eloy Espinaco <eloyesp@gmail.com>
2022-12-20 13:15:02 +09:00
Eloy Espinaco 012ef7d1d0 [rubygems/rubygems] Fix tests checking intermediate files
Some tests check that the shared objects are actually installed, but
checking an intermediate build file instead of the installed one.

https://github.com/rubygems/rubygems/commit/ad526073b0
2022-12-20 13:15:02 +09:00
Yusuke Endoh fe3dedb21a Prevent a "method redefined" warning 2022-12-17 08:51:20 +09:00
Yusuke Endoh 2013dd4658 Prevent warning "assigned but unused variable - initial_shape" 2022-12-17 08:40:36 +09:00
Nobuyoshi Nakada 1148636e3d [ruby/irb] PTY module is platform dependent
https://github.com/ruby/irb/commit/dbb3dc72ff
2022-12-19 17:49:59 +09:00
Samuel Williams 9da5a7e79d
Add tests for `Queue#pop` with fiber scheduler. (#6953) 2022-12-17 20:43:21 +13:00
Jemma Issroff 297df92407 Clean up Ruby Shape API
Make printing shapes better, use a struct instead of specific methods
for each field on a shape.

Co-Authored-By: Aaron Patterson <tenderlove@ruby-lang.org>
2022-12-16 13:27:45 -05:00
Nobuyoshi Nakada 3e49d62bc1 [Feature #18033] Parse more strictly conformant with ISO-8601
* 4-digits or more is required as year
* Minutes and seconds parts are not ommittable
2022-12-16 22:52:59 +09:00
Nobuyoshi Nakada 9515179d74 [Feature #18033] Add `precision:` option
Which limits the precision of subsecond. Defaulted to 9, that
means nanosecond.
2022-12-16 22:52:59 +09:00
Nobuyoshi Nakada 67c589afa0 [Feature #18033] More strict checks 2022-12-16 22:52:59 +09:00
Nobuyoshi Nakada 8c272f4481 [Feature #18033] Make Time.new parse time strings
`Time.new` now parses strings such as the result of `Time#inspect`
and restricted ISO-8601 formats.
2022-12-16 22:52:59 +09:00
Yusuke Endoh ee7a338d2b Unconditionally warn "unknown pack/unpack directive"
[Bug #19150]
2022-12-16 12:15:50 +01:00
Akinori MUSHA ad18d1297e Reject keyword arguments given to Enumerator::Product.new
The use of keyword arguments should be reserved for future extension.
2022-12-16 13:32:13 +09:00
Hiroshi SHIBATA d6624db926 [ruby/irb] Prefer to use File.open instead of Kernel.open
https://github.com/ruby/irb/commit/ed9e435a6b
2022-12-16 01:10:46 +00:00
Koichi Sasada ae19ac5b5b fixed encoding table
This reduces global lock acquiring for reading.
https://bugs.ruby-lang.org/issues/18949
2022-12-16 10:04:37 +09:00