Commit graph

20692 commits

Author SHA1 Message Date
David Rodríguez
d645b62b6d [rubygems/rubygems] Remove already fixed TODO
It was fixed by 3b0d44fbf5.

4cf3429599
2025-02-03 10:05:33 +09:00
Jean Boussier
98e1c2845a [ruby/json] Refactor convert_UTF8_to_JSON to split searching and escaping code
The goal is to be able to dispatch to more optimized search implementations
without having to duplicate the escaping code.

Somehow, this is a few % faster already:

```
== Encoding activitypub.json (52595 bytes)
ruby 3.4.1 (2024-12-25 revision 48d4efcb85) +YJIT +PRISM [arm64-darwin23]
Warming up --------------------------------------
               after     2.257k i/100ms
Calculating -------------------------------------
               after     22.930k (± 1.3%) i/s   (43.61 μs/i) -    115.107k in   5.020814s

Comparison:
              before:    21604.0 i/s
               after:    22930.1 i/s - 1.06x  faster

== Encoding citm_catalog.json (500298 bytes)
ruby 3.4.1 (2024-12-25 revision 48d4efcb85) +YJIT +PRISM [arm64-darwin23]
Warming up --------------------------------------
               after   137.000 i/100ms
Calculating -------------------------------------
               after      1.397k (± 1.1%) i/s  (715.57 μs/i) -      6.987k in   5.000408s

Comparison:
              before:     1344.4 i/s
               after:     1397.5 i/s - 1.04x  faster

== Encoding twitter.json (466906 bytes)
ruby 3.4.1 (2024-12-25 revision 48d4efcb85) +YJIT +PRISM [arm64-darwin23]
Warming up --------------------------------------
               after   249.000 i/100ms
Calculating -------------------------------------
               after      2.464k (± 1.8%) i/s  (405.81 μs/i) -     12.450k in   5.054131s

Comparison:
              before:     2326.5 i/s
               after:     2464.2 i/s - 1.06x  faster
```

8fb5ae807f
2025-02-03 10:05:25 +09:00
Nobuyoshi Nakada
581d85058c
Add out of range tests of random number generator 2025-02-03 00:27:43 +09:00
Nobuyoshi Nakada
db02a6b3ab
[Bug #21103] Fix local variable index calculation with forwarding
Forwarding argument is optimized not to packed when no other arguments
and an internal object refers values before it.  This size is decided
at called time, calculate the local variable index from the fixed end
point.
2025-02-01 22:03:47 +09:00
Nobuyoshi Nakada
7604588f6f
[Feature #19521] Test for Module#set_temporary_name 2025-01-31 10:43:36 +09:00
Peter Zhu
d729c1575e Output object_id in ObjectSpace.dump
Outputs the object ID in the dump for objects that have it seen.
2025-01-30 11:48:14 -05:00
Fabio Sangiovanni
f0dc9dcdc7 rb_alias: improve "undefined method" error message by invoking
`rb_print_undef` with `target_klass` as argument.
2025-01-31 00:20:47 +09:00
Kazuki Yamaguchi
1b731c1f43 [ruby/openssl] pkey: avoid calling i2d_PUBKEY family on an incomplete key
Call ossl_pkey_check_public_key() to ensure that
EVP_PKEY_missing_parameters() passes. This check should be cheap.

DSA#{to_der,to_pem,export,to_s} and PKey#{public_to_der,public_to_pem}
cause a segfault if the receiver is an empty DSA instance with no
parameters set.

Fixes <https://github.com/ruby/openssl/issues/845>.

5aeed935e5
2025-01-29 17:14:41 +00:00
Kazuki Yamaguchi
81c83fd79f [ruby/openssl] test/openssl/test_ossl.rb: use clock_gettime for measuring time
The benchmark library is planned to become a bundled gem in Ruby 3.5.
While we can add it in our Gemfile, it is only used in
test_memcmp_timing and the usage can be easily replaced with a few
Process.clock_gettime calls.

9a746ed1a4
2025-01-29 17:14:40 +00:00
Yusuke Endoh
e01b4ca1c8 [ruby/error_highlight] Ensure first_line and last_line are set
Fixes https://github.com/ruby/error_highlight/pull/58

9ddc1f31a9
2025-01-29 08:51:42 +00:00
Jean Boussier
50e34fd768
Allow JSON::Fragment to be used even in strict mode 2025-01-28 15:42:20 +09:00
Étienne Barrié
89e316ad06
Introduce JSON::Coder
Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
2025-01-28 15:41:47 +09:00
dependabot[bot]
2dc870edbe [rubygems/rubygems] Bump the rb-sys group across 2 directories with 1 update
Bumps the rb-sys group with 1 update in the /test/rubygems/test_gem_ext_cargo_builder/custom_name/ext/custom_name_lib directory: [rb-sys](https://github.com/oxidize-rb/rb-sys).
Bumps the rb-sys group with 1 update in the /test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example directory: [rb-sys](https://github.com/oxidize-rb/rb-sys).

Updates `rb-sys` from 0.9.107 to 0.9.108
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.107...v0.9.108)

Updates `rb-sys` from 0.9.107 to 0.9.108
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.107...v0.9.108)

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

Signed-off-by: dependabot[bot] <support@github.com>

9f5bc8abfa
2025-01-28 15:31:44 +09:00
Nobuyoshi Nakada
96a5da6786
Fix "Relax expectations of errors from getgrnam"
Use `assert_raise_kind_of` instead of `assert_raise`, that rejects sub
classes of the given exceptions.
2025-01-24 17:06:45 +09:00
Hiroshi SHIBATA
0fdc9b9fd1 Migrate irb and reline to the bundled gems 2025-01-24 15:46:46 +09:00
Kevin Newton
c290861336 [ruby/prism] Fix rescue modifier precedence
Fixes [Bug #21048]

07202005cb
2025-01-22 19:58:27 +00:00
Kazuki Yamaguchi
87316d58fa [ruby/openssl] pkey: change PKey::{RSA,DSA,DH}#params to use nil for missing parameters
The returned Hash from these methods contain 0 in place of a missing
parameter in the key, for example:

	pkey = OpenSSL::PKey.read(OpenSSL::PKey::RSA.new(2048).public_to_pem)
	pp pkey.params
	#=>
	# {"n"=>#<OpenSSL::BN 2869346734[...snip]>,
	#  "e"=>#<OpenSSL::BN 65537>,
	#  "d"=>#<OpenSSL::BN 0>,
	#  "p"=>#<OpenSSL::BN 0>,
	#  "q"=>#<OpenSSL::BN 0>,
	#  "dmp1"=>#<OpenSSL::BN 0>,
	#  "dmq1"=>#<OpenSSL::BN 0>,
	#  "iqmp"=>#<OpenSSL::BN 0>}

Let's use nil instead, which is more appropriate for indicating a
missing value.

f247ec3dec
2025-01-23 01:45:52 +09:00
Kazuki Yamaguchi
47fe59cd82 [ruby/openssl] pkey: add tests for PKey::{RSA,DSA,DH}#params
Add missing test cases to verify the current behavior. The next patch
will rewrite those methods.

c0e0669f9b
2025-01-23 01:45:51 +09:00
Kazuki Yamaguchi
72480389d1 [ruby/openssl] ssl: fix SSLSocket#sysread leaking locktmp String on timeout
Commit 3bbf5178a9 made blocking methods on SSLSocket follow the
IO#timeout= value. The commit changed io_wait_readable() to potentially
raise an exception without unlocking the String.

The String is currently locked for the entire duration of a #sysread
method call. This does not seem to be necessary, as SSL_read() does not
require that the same buffer is specified when retrying. Locking the
String during each SSL_read() call should be sufficient.

8f791d73f5
2025-01-22 16:45:19 +00:00
tomoya ishida
8c4134a31e [ruby/irb] Use EnvUtil.rubybin instead of "ruby" in copy command
test
(https://github.com/ruby/irb/pull/1071)

`ruby` is not always available.

f6c5106364
2025-01-22 15:58:56 +00:00
tomoya ishida
c066453118 [ruby/irb] Fix pager preview with escape sequence and newlines
(https://github.com/ruby/irb/pull/1069)

a139562a07
2025-01-22 23:08:34 +09:00
tomoya ishida
7813edbe19 [ruby/irb] Show a quick preview of inspect result before pager
launch
(https://github.com/ruby/irb/pull/1040)

* Quickly show inspect preview even if pretty_print takes too much time

* Show a message "Inspecting..." while generating pretty_print content

* Update inspecting message

Co-authored-by: Stan Lo <stan001212@gmail.com>

* Update rendering test for preparing inspect message

* Don't show preview if pretty_print does not take time

---------

03c36586e6

Co-authored-by: Stan Lo <stan001212@gmail.com>
2025-01-22 23:08:34 +09:00
Prajjwal Singh
c6e8ee4514 [ruby/irb] Add copy command (https://github.com/ruby/irb/pull/1044)
Closes https://github.com/ruby/irb/pull/753

a24ac53d48
2025-01-22 23:08:34 +09:00
Nobuyoshi Nakada
7070b1b196
Relax expectations of errors from getgrnam
The list of errors cited in 58bc97628c
is not exhaustive and other errors may be raised by `getgrnam`.
Additionally, these errors are system dependent and may not be listed
on all platforms.
2025-01-22 18:19:54 +09:00
Kazuki Yamaguchi
43c48e3030 [ruby/openssl] Require OpenSSL 1.1.1 or later
Drop support for OpenSSL 1.1.0. OpenSSL 1.1.0 was a non-LTS release and
it has reached upstream EOL in 2019-12 along with OpenSSL 1.0.2.
Distributions that shipped with OpenSSL 1.1.0 include:

 - Debian 9 (EOL 2022-06)
 - Ubuntu 18.04 LTS (EOL 2023-04)

ba83abe920
2025-01-21 18:14:14 +00:00
Kazuki Yamaguchi
e7bd1d1a9a [ruby/openssl] pkey/dh: do not skip test_params_ok? on LibreSSL
cd91cef590
2025-01-21 18:14:12 +00:00
Peter Zhu
be66448311 [ruby/mmtk] Bump mmtk-core
Fixes a bug where there is an infinite loop when MMTK_HEAP_MIN is small.

12c7ede20b
2025-01-21 17:02:18 +00:00
Peter Zhu
6d806031ed [ruby/mmtk] Add tests for MMTK_HEAP_MIN
a725b95f51
2025-01-21 17:02:17 +00:00
Kazuki Yamaguchi
441862dc9f [ruby/openssl] Require OpenSSL 1.1.0 or later
Drop support for OpenSSL 1.0.2. It has reached upstream EOL in 2019-12.

Most distributions that shipped with OpenSSL 1.0.2 have also reached
EOL, or provide a newer version in the package repository:

 - RHEL 7 (EOL 2024-06)
 - Ubuntu 16.04 LTS (EOL 2021-04)
 - Amazon Linux 2 (EOL 2026-06, but OpenSSL 1.1.1 can be installed via
   the openssl11{,-devel} package)

38ec6fd50e
2025-01-20 17:12:57 +00:00
tompng
86b262179d [ruby/json] Reject invalid number: - -.1 -e0
b9bfeecfa9
2025-01-20 14:20:55 +01:00
tompng
525d7a68e4 [ruby/json] Raise parse error on invalid comments
2f57f40467
2025-01-20 14:20:55 +01:00
tompng
c026e44bb5 [ruby/json] Fix parsing incomplete unicode escape "\uaaa"
86c0d4eb7e
2025-01-20 14:20:55 +01:00
Étienne Barrié
e8676cada8 [ruby/json] Introduce JSON::Fragment
9e3500f345

Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
2025-01-20 14:20:55 +01:00
Jean Boussier
33708f2dc4 [ruby/json] Fix a regression in the parser with leading /
Ref: https://github.com/ruby/ruby/pull/12598

This could lead to an infinite loop.

f8cfa2696a
2025-01-20 10:31:56 +01:00
Jean Boussier
ef585744c0 Finalize Kevin's handrolled parser.
And get rid of the Ragel parser.

This is 7% faster on activitypub, 15% after on twitter and 11% faster
on citm_catalog.

There might be some more optimization opportunities, I did a quick
optimization pass to fix a regression in string parsing, but other
than that I haven't dug much in performance.
2025-01-20 16:09:00 +09:00
Peter Zhu
5fceba6614 [ruby/mmtk] Add mmtk_heap_max to GC.config
6a78ffaf16
2025-01-17 15:44:24 +00:00
Peter Zhu
179899c616 [ruby/mmtk] Add mmtk_heap_min to GC.config
5bbac70c69
2025-01-16 21:40:31 +00:00
Peter Zhu
d05f6a9b8f [ruby/mmtk] Add NoGC back to MMTK_PLAN test
89f8b8be04
2025-01-16 16:20:06 +00:00
Peter Zhu
2538f4d521 [ruby/mmtk] Add mmtk_heap_mode to GC.config
810f897603
2025-01-16 16:20:04 +00:00
Michael Rykov
3638f67069 [rubygems/rubygems] fix @licenses array unmarshalling
12f3e78c95
2025-01-16 19:41:11 +09:00
Hiroshi SHIBATA
4e563d9c51
Disabled to existence test for win32ole 2025-01-16 12:35:21 +09:00
Hiroshi SHIBATA
721891688b
Migrate win32ole as bundled gems 2025-01-16 12:35:21 +09:00
Jean Boussier
91918bb01f [ruby/json] Refactor JSONFixturesTest
c69963fbe5
2025-01-16 09:01:11 +09:00
Peter Zhu
ab1565ebe3 [ruby/mmtk] Add mmtk_plan to GC.config
67da9ea5b8
2025-01-15 18:08:03 +00:00
tomoya ishida
e5ad894959 [ruby/irb] Colorize backref token bold green like global variables
(https://github.com/ruby/irb/pull/1065)

0b60a5be1d
2025-01-15 17:57:46 +00:00
Earlopain
65fa58d3ae [ruby/prism] Mark some parser translator tests as being known failures
Without a change from `parser`, this is impossible to correctly handle.

ca1d44e808
2025-01-15 17:40:16 +00:00
Lars Kanis
6286d3858c Fix ENV tests on Windows on ARM64
Due to the x64 emulation of Windows 11 on ARM the environment variable PROCESSOR_ARCHITECTURE is set by the process startup code.
It must therefore be excluded from tests.
Otherwise tests fail like so:

```
[30585/32394] TestProcess#test_execopts_unsetenv_others = 0.10 s
 16) Failure:
TestProcess#test_execopts_unsetenv_others [C:/Users/Lars/ruby/test/ruby/test_process.rb:446]:
<""> expected but was
<"PROCESSOR_ARCHITECTURE=ARM64\n">.

[30616/32394] TestProcess#test_execopts_env = 0.16 s
 17) Failure:
TestProcess#test_execopts_env [C:/Users/Lars/ruby/test/ruby/test_process.rb:326]:
<"PATH\n"> expected but was
<"PATH\n" + "PROCESSOR_ARCHITECTURE\n">.
```
2025-01-15 23:37:20 +09:00
Hiroshi SHIBATA
2bfa49f288 Skip related tests with Gem::RDoc 2025-01-15 16:52:56 +09:00
Hiroshi SHIBATA
86d871d29c Migrate rdoc as bundled gems 2025-01-15 16:52:56 +09:00
Kevin Newton
cb419e3912 [PRISM] Handle forwarding inside eval
Fixes [Bug #21031]
2025-01-14 18:41:50 -05:00