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

78961 Коммитов

Автор SHA1 Сообщение Дата
Jun Aruga f5ca8d0e31 [ruby/openssl] test/openssl/test_pkey.rb: Fix pending tests in FIPS case.
https://github.com/ruby/openssl/commit/f9980d88aa
2023-08-16 14:48:42 +09:00
Jun Aruga 8ca0d53fd0 [ruby/openssl] Use openssl? instead of OpenSSL::OPENSSL_VERSION_NUMBER.
Update the `openssl?` method by adding status argument.

Note the format is below.

* OpenSSL 3: 0xMNN00PP0 (major minor 00 patch 0)
* OpenSSL 1: 0xMNNFFPPS (major minor fix patch status)

See <https://www.openssl.org/docs/man1.1.1/man3/OPENSSL_VERSION_NUMBER.html>
for details.

https://github.com/ruby/openssl/commit/db8deaacd3
2023-08-16 14:48:42 +09:00
Kazuki Yamaguchi 12bdacdca5 [ruby/openssl] Include "additional data" message in OpenSSL errors
Error entries in the OpenSSL error queue may contain additional
contextual information associated with the error, which can be helpful
when debugging.

This "additional data" is currently only printed to stderr when
OpenSSL.debug is enabled. Let's include this in the exception messages
raised with ossl_raise(), too.

	$ ruby -Ilib -ropenssl -e'OpenSSL.debug=true; OpenSSL::SSL::SSLContext.new.ecdh_curves="P-256:not-a-curve"'
	-e:1: warning: error on stack: error:0A080106:SSL routines:gid_cb:passed invalid argument (group 'not-a-curve' cannot be set)
	-e:1:in `ecdh_curves=': passed invalid argument (group 'not-a-curve' cannot be set) (OpenSSL::SSL::SSLError)
		from -e:1:in `<main>'

https://github.com/ruby/openssl/commit/1c5bbdd68e
2023-08-16 14:48:41 +09:00
Kazuki Yamaguchi 382b42be94 [ruby/openssl] config: relax test assertions against error messages
Test that the error message contains the necessary text instead of the
exact match. Exceptions raised by ossl_raise() may carry additional
context information in the message.

https://github.com/ruby/openssl/commit/fd6f76c0d3
2023-08-16 14:48:41 +09:00
Kazuki Yamaguchi 01d368e7b0 [ruby/openssl] ssl: raise SSLError if loading ca_file or ca_path fails
When compiled with OpenSSL <= 1.1.1, OpenSSL::SSL::SSLContext#setup
does not raise an exception on an error return from
SSL_CTX_load_verify_locations(), but instead only prints a verbose-mode
warning. This is not helpful since it very likely indicates an actual
error, such as the specified file not being readable.

Also, OpenSSL's error queue is not correctly cleared:

	$ ruby -w -ropenssl -e'OpenSSL.debug=true; ctx=OpenSSL::SSL::SSLContext.new; ctx.ca_file="bad-path"; ctx.setup; pp OpenSSL.errors'
	-e:1: warning: can't set verify locations
	["error:02001002:system library:fopen:No such file or directory",
	 "error:2006D080:BIO routines:BIO_new_file:no such file",
	 "error:0B084002:x509 certificate routines:X509_load_cert_crl_file: system lib"]

The behavior is currently different when compiled with OpenSSL >= 3.0:
SSLError is raised if SSL_CTX_load_verify_file() or
SSL_CTX_load_verify_dir() fails.

This inconsistency was unintentionally introduced by commit https://github.com/ruby/openssl/commit/5375a55ffc35
("ssl: use SSL_CTX_load_verify_{file,dir}() if available", 2020-02-22).
However, raising SSLError seems more appropriate in this situation.
Let's adjust the OpenSSL <= 1.1.1 code so that it behaves the same way
as the OpenSSL >= 3.0 code currently does.

Fixes: https://github.com/ruby/openssl/issues/649

https://github.com/ruby/openssl/commit/7eb10f7b75
2023-08-16 14:48:41 +09:00
Jun Aruga 8dd5c20224 [ruby/openssl] Raise an error when the specified OpenSSL library directory doesn't exist.
OpenSSL built from the source creates the library directory to the
`/path/to/openssl_dir/lib64` as a default.
In the case, the `bundle exec rake compile -- --with-openssl-dir=<openssl_dir>`
cannot compile with the lib64 directory, and may compile with system OpenSSL's
libraries unintentionally. This commit is to check this case to avoid linking
with an unintentional library directory.

https://github.com/ruby/openssl/commit/ca54087462
2023-08-16 14:48:41 +09:00
Kazuki Yamaguchi 0eaee5c000 [ruby/openssl] [DOC] enhance RDoc for exporting pkeys
Describe the behavior of OpenSSL::PKey::{DH,DSA,EC,RSA}#to_pem
and #to_der more clearly. They return a different result depending on
whether the pkey is a public or private key. This was not documented
adequately.

Also, suggest the use of OpenSSL::PKey::PKey#private_to_pem
and #public_to_pem instead, if possible.

https://github.com/ruby/openssl/commit/d22769af8f
2023-08-16 14:48:40 +09:00
Kazuki Yamaguchi fae6fd07fe [ruby/openssl] [DOC] prefer PKey#private_to_pem and #public_to_pem in RDoc
Suggest the use of OpenSSL::PKey::PKey#private_to_pem and #public_to_pem
in the top-level documentation. For new programs, these are recommended
over OpenSSL::PKey::RSA#export (also aliased as #to_s and #to_pem)
unless there is a specific reason to use it, i.e., unless the PKCS#1
output format specifically is required.

The output format of OpenSSL::PKey::RSA#export depends on whether the
key is a public key or a private key, which is very counter-intuitive.

Additionally, when called with arguments to encrypt a private key, as in
this example, OpenSSL's own, non-standard format is used. The man page
of PEM_write_bio_PrivateKey_traditional(3) in OpenSSL 1.1.1 or later
states that it "should only be used for compatibility with legacy
programs".

https://github.com/ruby/openssl/commit/56312038d6
2023-08-16 14:48:40 +09:00
Kazuki Yamaguchi 4541cd4cba [ruby/openssl] [DOC] prefer "password" to "passphrase"
Let's consistently use the word "password". Although they are considered
synonymous, the mixed usage in the rdoc can cause confusion.

OpenSSL::KDF.scrypt is an exception. This is because RFC 7914 refers to
the input parameter as "passphrase".

https://github.com/ruby/openssl/commit/06d67640e9
2023-08-16 14:48:40 +09:00
Kazuki Yamaguchi 4465941e68 [ruby/openssl] Revert "Relax error message check for OpenSSL 3.1"
This reverts commit https://github.com/ruby/openssl/commit/fc4629d246f2.

The test case "test_connect_certificate_verify_failed_exception_message"
does want to check the reason behind a certificate verification failure
to be included in the exception message.

https://github.com/ruby/openssl/commit/c309745eb8
2023-08-16 14:48:39 +09:00
Kazuki Yamaguchi cb344e4e25 [ruby/openssl] ssl: adjust "certificate verify failed" error on SSL_ERROR_SYSCALL
Enrich SSLError's message with the low-level certificate verification
result, even if SSL_get_error() returns SSL_ERROR_SYSCALL. This is
currently done on SSL_ERROR_SSL only.

According to the man page of SSL_get_error(), SSL_ERROR_SYSCALL may be
returned for "other errors, check the error queue for details". This
apparently means we have to treat SSL_ERROR_SYSCALL, if errno is not
set, as equivalent to SSL_ERROR_SSL.

https://github.com/ruby/openssl/commit/5113777e82
2023-08-16 14:48:39 +09:00
Kazuki Yamaguchi 66a70582f4 [ruby/openssl] ssl: adjust styles of ossl_start_ssl()
Expand tabs, insert some spaces, and adjust indentation of switch-case
to match Ruby's style.

https://github.com/ruby/openssl/commit/10833aa8f6
2023-08-16 14:48:39 +09:00
Josh Nichols af67ced3b0 [ruby/net-http] Update lib/net/http.rb
@natematykiewicz's suggestion to avoid another string allocation

https://github.com/ruby/net-http/commit/4a22c42338

Co-authored-by: Nate Matykiewicz <natematykiewicz@gmail.com>
2023-08-16 01:40:13 +00:00
Josh Nichols ae68a8df58 [ruby/net-http] Update lib/net/http/response.rb
@natematykiewicz's suggestion to avoid a string allocation

https://github.com/ruby/net-http/commit/925630f227

Co-authored-by: Nate Matykiewicz <natematykiewicz@gmail.com>
2023-08-16 01:40:12 +00:00
Josh Nichols ea321a654d [ruby/net-http] use +'' everywhere
https://github.com/ruby/net-http/commit/1077427152
2023-08-16 01:40:11 +00:00
Josh Nichols 70da92cdf7 [ruby/net-http] Fix on 2.7
https://github.com/ruby/net-http/commit/5194fd541e
2023-08-16 01:40:10 +00:00
Josh Nichols 4d21134f3f [ruby/net-http] freeze rest of lib
https://github.com/ruby/net-http/commit/455a74734a
2023-08-16 01:40:09 +00:00
Josh Nichols 4165ec91d8 [ruby/net-http] update net/http/response to be frozen string literal
https://github.com/ruby/net-http/commit/dc3b4a75ca
2023-08-16 01:40:08 +00:00
Josh Nichols 2fbd8dca18 [ruby/net-http] turn on frozen strings for net/http/generic_request
https://github.com/ruby/net-http/commit/b92ade088d
2023-08-16 01:40:08 +00:00
Josh Nichols 8d04260acd [ruby/net-http] turn on frozen strings for net/http/header
https://github.com/ruby/net-http/commit/a5203c9f92
2023-08-16 01:40:07 +00:00
Josh Nichols 0300ea5a6c [ruby/net-http] Improve performance of HTTPHeader#content_type
In the existing implementation, `main_type` and `sub_type` would end up
being called multiple times potentially.

Instead of doing that, save the result so it can be re-used.

https://github.com/ruby/net-http/commit/179976f7ea
2023-08-16 01:39:08 +00:00
Takashi Kokubun 8d985b1855 Clarify the actual Visual Studio version [ci skip] 2023-08-15 17:07:40 -07:00
Nobuyoshi Nakada 47b1a52826
Split installation from build section 2023-08-16 08:40:43 +09:00
Takashi Kokubun efd611ceb6 Revert "[ruby/yarp] rust: Initial yarp-sys"
This reverts commit e6e23b92e3.

It seems like it wasn't added for ruby/ruby.

We could fix tool/sync_default_gems.rb to deal with this, but we have a
pull request that changes that part now, so let me only revert this for
now and revisit this after merging that pull request.
2023-08-15 13:54:46 -07:00
Steve Loveless e6e23b92e3 [ruby/yarp] rust: Initial yarp-sys
Still need to add more tests

Update Cargo.toml; add README

Switch yp_string_t_type variants to SNAKE_CASE

Add unescape tests

Add encoding callback tests

Add pack_parse test

Add diagnostic test

Add comment test

Add node tests

Add string_list tests

Add other string tests

Add shared string test

Add list tests

Fixes for updated branch

Run bundle install before running Rust tests

Fix version test

ci: Add proper config for rust-toolchain step for sanitizers

ci: Fix tests, clippy

Remove extra `bundle install`; run `bundle exec rake`

Didn't realize `setup-ruby`'s `bundle-cache: true` runs `bundle install`.

Remove `rake compile` from build.rs

This is complicating CI for me; maybe we add it back later.

Undo README formatting changes

Fix UB in C callbacks

Use slice+str instead of String for raw things

Move bindings to bindings module

Handle non-UTF-8 strings in paths

rust ci: test with sanitizers; add -D warnings

Update rust-bindings.yml

Update Cargo.toml

Don't need to compile extra crate_types

PR changes

Apply patch from @kddnewton

Delete unescape_tests.rs

Fix things after rebasing

https://github.com/ruby/yarp/commit/273790e40b
2023-08-15 20:52:06 +00:00
Peter Zhu 0f94e65359 Add stat force_incremental_marking_finish_count
This commit adds key force_incremental_marking_finish_count to
GC.stat_heap. This statistic returns the number of times the size pool
has forced incremental marking to finish due to running out of slots.
2023-08-15 15:18:05 -04:00
Burdette Lamar 8c5b9ebf71
[DOC] Improve doc guide compliance (#8221) 2023-08-15 14:43:58 -04:00
Nobuyoshi Nakada d9d4ae511a
Group configure outputs on GitHub Actions 2023-08-15 23:30:41 +09:00
Nobuyoshi Nakada 6066f8d337
Fix a typo to suppress updating rbconfig.rb during `make up` 2023-08-15 23:30:41 +09:00
Nobuyoshi Nakada b76c2ec005
Use `::` form workflow commands 2023-08-15 23:30:40 +09:00
Alan Wu 9acc73d7c5
YJIT: Optional parameter rework and bugfix (#8220)
* YJIT: Fix splatting empty array with rest param

* YJIT: Rework optional parameter handling to fix corner case

The old code had a few unintuitive parts. The starting PC of the callee
was set in different places; `num_param`, which one would assume to be
static for a particular callee seemingly tallied to different amounts
depending on the what the caller passed; `opts_filled_with_splat` was
greater than zero even when the opts were not filled by items in the
splat array. Functionally, the bits that lets the callee know which
keyword parameters are unspecified were not passed properly when there
are optional parameters and a rest parameter, and then optional
parameters are all filled.

Make `num_param` non-mut and use parameter information in the callee
iseq as-is. Move local variable nil fill and placing of the rest array
out of `gen_push_frame()` as they are only ever relevant for iseq calls.
Always place the rest array at `lead_num + opt_num` to fix the
previously buggy situation.

* YJIT: Compile splat calls to iseqs with rest params

Test interactions with optional parameters.
2023-08-15 10:08:48 -04:00
Peter Zhu 2f57db6c77 [DOC] Rename "memory pool" to "heap" 2023-08-15 08:54:27 -04:00
Peter Zhu 01f74b2852 [DOC] Improve docs about keys in GC.stat_heap 2023-08-15 08:54:27 -04:00
Peter Zhu 2498140777 [DOC] Improve docs for GC.start 2023-08-15 08:54:27 -04:00
Peter Zhu 300bc14589 [DOC] Improve some GC docs 2023-08-15 08:54:27 -04:00
Nobuyoshi Nakada a11b907745
Add description to the empty test file [ci skip] 2023-08-15 12:49:05 +09:00
git b554198572 * append newline at EOF. [ci skip] 2023-08-15 02:37:12 +00:00
Nobuyoshi Nakada 542424fc56
An empty test file for satisfy chkbuild [ci skip] 2023-08-15 11:19:05 +09:00
Nobuyoshi Nakada b1f6c4b568
Remove a misplaced and duplicate file [ci skip] 2023-08-15 11:07:53 +09:00
Peter Zhu 52837fcec2 [DOC] Remove Document-class from trace_point.rb 2023-08-14 11:48:39 -04:00
Takashi Kokubun 75c9487a98
YJIT: Chain guard classes on instance_of (#8209) 2023-08-14 10:18:19 -04:00
Nobuyoshi Nakada 2a3acbc420
Fix test and precheck order for old GNU Make 2023-08-14 11:30:05 +09:00
Burdette Lamar d33555eeae
[DOC] RDoc for numeric.rb (#8216) 2023-08-13 21:23:41 -04:00
BurdetteLamar 3080cf3dec [DOC] Don't suppress autolinks 2023-08-13 15:47:12 -04:00
Stan Lo 7f8f62c93b [ruby/irb] Support seamless integration with ruby/debug
(https://github.com/ruby/irb/pull/575)

* Support native integration with ruby/debug

* Prevent using multi-irb and activating debugger at the same time

Multi-irb makes a few assumptions:

- IRB will manage all threads that host sub-irb sessions
- All IRB sessions will be run on the threads created by IRB itself

However, when using the debugger these assumptions are broken:

- `debug` will freeze ALL threads when it suspends the session (e.g. when
  hitting a breakpoint, or performing step-debugging).
- Since the irb-debug integration runs IRB as the debugger's interface,
  it will be run on the debugger's thread, which is not managed by IRB.

So we should prevent the 2 features from being used at the same time.
To do that, we check if the other feature is already activated when
executing the commands that would activate the other feature.

https://github.com/ruby/irb/commit/d8fb3246be
2023-08-13 18:30:34 +00:00
Stan Lo 9099d62ac7 [ruby/irb] Move IO configuration to IRB::Irb
(https://github.com/ruby/irb/pull/681)

It shouldn't be `RubyLex`'s responsibility to handle IO. So this moves
the configuration to `IRB::Irb`.

https://github.com/ruby/irb/commit/daff750076
2023-08-13 15:23:04 +00:00
Nobuyoshi Nakada 3af5badae8 [ruby/irb] Remove useless `begin`/`end` [ci skip]
(https://github.com/ruby/irb/pull/680)

The `rescue` was removed at https://github.com/ruby/irb/commit/420e7d227011.

https://github.com/ruby/irb/commit/8fa688e9c0
2023-08-13 15:02:29 +00:00
Nobuyoshi Nakada eb221a3734
Prohibit copying to `fixtures` and dot-direcotry just under `test`
Do not add directories which would let chkbuild fires accidentally, to
just under `test`.  The "fixtures" directory is often used to place
test stuffs.
2023-08-13 15:30:58 +09:00
Nobuyoshi Nakada 83718b6bb2
Move test files of ruby/set under `test/set`
Chkbuild fires accidentally on `test/fixtures` directory.
2023-08-13 15:24:58 +09:00
Nobuyoshi Nakada efc9127790
Prefix `excludes` with a dot to prevent chkbuild from firing wrongly
Chkbuild runs for each directories just under `test` directory when
`test-all` failed.  `test/excludes` itself should not be a target.
2023-08-13 15:23:54 +09:00