79677 Commits

Author SHA1 Message Date
Nobuyoshi Nakada
82e480ff40
Silent test-all on AppVeyor 2023-08-16 22:52:59 +09:00
haseponpon
089227e948
[DOC] Specify the unit of return value for Time#- 2023-08-16 22:51:17 +09:00
Stan Lo
5a40f7db54 [ruby/irb] Encapsulate input details in Statement objects
(https://github.com/ruby/irb/pull/682)

* Introduce Statement class

* Split Statement class for better clarity

https://github.com/ruby/irb/commit/65e8e68690
2023-08-16 10:13:46 +00:00
yui-knk
0982c5fa00 Resync Lrama v0.5.3
Previous sync included unrelated files and missed template file update.
2023-08-16 19:02:44 +09:00
David Rodríguez
fe240b672b
[rubygems/rubygems] Show better error when PAT can't authenticate to a private server
Before:

```
Fetching gem metadata from https://rubygems.org/........
Fetching source index from https://rubygems.pkg.github.com/my-org/

Bad username or password for https://x-access-token@rubygems.pkg.github.com/my-org/.
Please double-check your credentials and correct them.
```

After:

```
Fetching gem metadata from https://rubygems.org/........
Fetching source index from https://rubygems.pkg.github.com/my-org/

Access token could not be authenticated for https://x-access-token@rubygems.pkg.github.com/my-org/.
Make sure it's valid and has the necessary scopes configured.
```

https://github.com/rubygems/rubygems/commit/2ae69c964a
2023-08-16 15:03:38 +09:00
David Rodríguez
e678affe70
[rubygems/rubygems] Bad auth should not fallback either
https://github.com/rubygems/rubygems/commit/ba3ea27869
2023-08-16 15:03:38 +09:00
David Rodríguez
c076ac8a5f
[rubygems/rubygems] Use better status for authentication failures
https://github.com/rubygems/rubygems/commit/ffa395411f
2023-08-16 15:03:38 +09:00
David Rodríguez
2e04336b67
[rubygems/rubygems] Fix git source conservativeness
https://github.com/rubygems/rubygems/commit/9a0e0dfd5b
2023-08-16 15:03:38 +09:00
David Rodríguez
4a3777bf6b
[rubygems/rubygems] Extract s.name to a variable
https://github.com/rubygems/rubygems/commit/689c39b42f
2023-08-16 15:03:38 +09:00
David Rodríguez
e92ace6be7
[rubygems/rubygems] Remove unneeded stuff
This should be only for path sources, and unrelated to git.

https://github.com/rubygems/rubygems/commit/0d8f31eeed
2023-08-16 15:03:38 +09:00
David Rodríguez
7bb3e637ff
[rubygems/rubygems] Don't update locked sources when not necessary
https://github.com/rubygems/rubygems/commit/cfc82b592a
2023-08-16 15:03:38 +09:00
David Rodríguez
c57ab646cb
[rubygems/rubygems] Extract a default_source method
https://github.com/rubygems/rubygems/commit/784e08348e
2023-08-16 15:03:38 +09:00
David Rodríguez
002165f8fe
[rubygems/rubygems] Move lockfile_source variable out of condition branch
https://github.com/rubygems/rubygems/commit/efebc64250
2023-08-16 15:03:38 +09:00
David Rodríguez
6bc63ab9bb
[rubygems/rubygems] Refactor locked dep filtering more
We only need to check whether the spec if for a direct dependency once.

https://github.com/rubygems/rubygems/commit/65b455a5cb
2023-08-16 15:03:38 +09:00
David Rodríguez
86492fca65
[rubygems/rubygems] Avoid unnecessary loop through dependencies
https://github.com/rubygems/rubygems/commit/2ab63bb94d
2023-08-16 15:03:38 +09:00
Jun Aruga
f1df062944 [ruby/openssl] Enhance printing OpenSSL versions.
* Updated the `OpenSSL::OPENSSL_VERSION_NUMBER` comment explaining the format.
* Added the `OpenSSL::LIBRESSL_VERSION_NUMBER` to print LibreSSL version number,
  in the case that Ruby OpenSSL binding is compiled with LibreSSL. Note
  `test/openssl/utils.rb#libressl?` is not using this value in it for now.
* Update `rake debug` to print the values in a readable way, adding
  `OpenSSL::OPENSSL_VERSION_NUMBER` and `OpenSSL::LIBRESSL_VERSION_NUMBER`.

https://github.com/ruby/openssl/commit/d19e6360ed
2023-08-16 14:48:42 +09:00
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 e6e23b92e3019e27471c9bf7a97db5f95e7a9a29.

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