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

8452 Коммитов

Автор SHA1 Сообщение Дата
Samuel Williams f27eb8148f
Sync io-console gem. 2021-12-29 13:27:40 +13:00
NARUSE, Yui 82c8acbcfd Prevent installing zlib library 2021-12-25 21:01:43 +09:00
Nobuyoshi Nakada 8247b193c0
[ruby/io-console] bump up to 0.5.10
https://github.com/ruby/io-console/commit/806c65e22b
2021-12-25 18:38:51 +09:00
Nobuyoshi Nakada 9368fa6c30
[ruby/io-console] No longer support dead versions
https://github.com/ruby/io-console/commit/e9478509e9
2021-12-25 18:38:51 +09:00
Kazuki Yamaguchi efce9ecf72 [ruby/openssl] Ruby/OpenSSL 3.0.0
https://github.com/ruby/openssl/commit/bff4080091
2021-12-25 03:31:59 +09:00
Samuel Williams 548c8f5f7a
Prefer to use RTEST when checking result of `rb_io_wait`. (#5341)
* Prefer to use RTEST when checking result of `rb_io_wait`.

* Consistently use false for signifying no events ready.
2021-12-25 02:26:06 +13:00
Akinori MUSHA 67aab88a22 Import digest v3.1.0 from ruby/digest 2021-12-24 20:06:23 +09:00
Hiroshi SHIBATA 106a0e5195 [ruby/readline-ext] Bump version to 0.1.4
https://github.com/ruby/readline-ext/commit/6f86713b19
2021-12-24 17:53:52 +09:00
Kenta Murata 9ccfc78346 [ruby/bigdecimal] Remove unused variable
https://github.com/ruby/bigdecimal/commit/ac7daa5f15
2021-12-24 09:44:23 +09:00
Kenta Murata 65d35502bd
[ruby/bigdecimal] Version 3.1.1
https://github.com/ruby/bigdecimal/commit/2ef67c2cc7
2021-12-24 02:29:02 +09:00
Kenta Murata a1d9fbef05
[ruby/bigdecimal] Fix the result precision of BigDecimal#divmod
https://github.com/ruby/bigdecimal/commit/a32f6cb9e2
2021-12-24 02:29:01 +09:00
Kenta Murata 680a4ebb3c
[ruby/bigdecimal] Version 3.1.0
https://github.com/ruby/bigdecimal/commit/c3453d2b97
2021-12-24 02:29:01 +09:00
Burdette Lamar 0262f34905
[ruby/bigdecimal] Enhanced RDoc for BigDecimal (https://github.com/ruby/bigdecimal/pull/209)
* Enhanced RDoc for BigDecimal

* Update ext/bigdecimal/bigdecimal.c

Remove the instance number of `Float::DIG`.

* Update ext/bigdecimal/bigdecimal.c

Add BigDecimal call-seq without ndigits.

* Update ext/bigdecimal/bigdecimal.c

Replace the word sum with value or result in the description of BigDecimal().

* Update ext/bigdecimal/bigdecimal.c

Remove the instance value of Float::DIG.

* Update ext/bigdecimal/bigdecimal.c

Fix mis-description of precision

* Update ext/bigdecimal/bigdecimal.c

Fix the description of precision determination

* Update ext/bigdecimal/bigdecimal.c

Add the description of the precision in the Rational case.

https://github.com/ruby/bigdecimal/commit/acabb132a4

Co-authored-by: Kenta Murata <3959+mrkn@users.noreply.github.com>
2021-12-24 02:29:01 +09:00
Kenta Murata 79712fc083
[ruby/bigdecimal] Let BigDecimal#quo accept precision
Fix GH-214.

https://github.com/ruby/bigdecimal/commit/13e0e93f37
2021-12-24 02:29:00 +09:00
Kenta Murata 0b8638cd74
[ruby/bigdecimal] Add TODO comment
https://github.com/ruby/bigdecimal/commit/ef9cf4e69e
2021-12-24 02:29:00 +09:00
Kenta Murata 98918209b7
[ruby/bigdecimal] Allow passing both float and precision in BigDecimal#div
Fix GH-212.

https://github.com/ruby/bigdecimal/commit/900bb7fcf5
2021-12-24 02:29:00 +09:00
Jean Boussier d0897e3f3a
[ruby/bigdecimal] Improve extconf to allow using bigdecimal as a git gem
e.g.
```
gem "bigdecimal", github: "ruby/bigdecimal"
```

It would fail because bundler regenerates the `gemspec`,
so `bigdecimal_version` is gone.

https://github.com/ruby/bigdecimal/commit/bccaa66f2c
2021-12-24 02:28:59 +09:00
Kenta Murata 84ae7a5df9
[ruby/bigdecimal] Add BigDecimal#precision_scale
https://github.com/ruby/bigdecimal/commit/c019caeaba
2021-12-24 02:28:59 +09:00
Kenta Murata ea713009ba
[ruby/bigdecimal] [Doc] Add documentation of BigDecimal#n_significant_digits
https://github.com/ruby/bigdecimal/commit/ceaf16b03e
2021-12-24 02:28:59 +09:00
Kenta Murata aca96f7ec7
[ruby/bigdecimal] Add BigDecimal#scale
Fixes GH-198.

https://github.com/ruby/bigdecimal/commit/4fbec55680
2021-12-24 02:28:58 +09:00
BurdetteLamar 0c63aa11bc
[ruby/bigdecimal] Set rounding mode in example
https://github.com/ruby/bigdecimal/commit/8fc83dd2fe
2021-12-24 02:28:58 +09:00
BurdetteLamar a8243d07e1
[ruby/bigdecimal] Set rounding mode in example
https://github.com/ruby/bigdecimal/commit/42c999f728
2021-12-24 02:28:57 +09:00
BurdetteLamar de5c14d4d8
[ruby/bigdecimal] Enhanced RDoc for selected methods
https://github.com/ruby/bigdecimal/commit/0de9298d15
2021-12-24 02:28:57 +09:00
BurdetteLamar e043829a7f
[ruby/bigdecimal] Enhanced RDoc for selected methods
https://github.com/ruby/bigdecimal/commit/6139ea1092
2021-12-24 02:28:57 +09:00
Kenta Murata d905abb457
[ruby/bigdecimal] Fix BigDecimal#precision for single DECDIG case
Fix GH-205

https://github.com/ruby/bigdecimal/commit/7d198394a2
2021-12-24 02:28:56 +09:00
Kenta Murata 38e98cbdb7
[ruby/bigdecimal] Keep obj-to-Real link when VpReallocReal returns different pointer
https://github.com/ruby/bigdecimal/commit/252748de17
2021-12-24 02:28:56 +09:00
Kenta Murata 75f552e973
[ruby/bigdecimal] Fix the precision of the adjusted quotient
https://github.com/ruby/bigdecimal/commit/8dc8cd339d
2021-12-24 02:28:56 +09:00
Kenta Murata 7b2cfce543
[ruby/bigdecimal] Let BigDecimal_DoDivmod use the same precision calculation as BigDecimal_divide
https://github.com/ruby/bigdecimal/commit/11cb2c8840
2021-12-24 02:28:55 +09:00
Kenta Murata e1265c8198
[ruby/bigdecimal] Use larger precision in divide for irrational or recurring results
Just in case for irrational or recurring results, the precision of the
quotient is set to at least more than 2*Float::DIG plus alpha.

[Bug #13754] [Fix GH-94]

https://github.com/ruby/bigdecimal/commit/99442c75d3
2021-12-24 02:28:55 +09:00
Kenta Murata 8ee8ac6423
[ruby/bigdecimal] Fix trailing zeros handling in rb_uint64_convert_to_BigDecimal
Fix GH-192

https://github.com/ruby/bigdecimal/commit/eebc98b85a
2021-12-24 02:28:55 +09:00
BurdetteLamar ed7f4c24d7
[ruby/bigdecimal] Respond to review
https://github.com/ruby/bigdecimal/commit/f528a0006e
2021-12-24 02:28:54 +09:00
BurdetteLamar ed8ec5dcb3
[ruby/bigdecimal] Respond to review
https://github.com/ruby/bigdecimal/commit/4eadcdf0a6
2021-12-24 02:28:54 +09:00
BurdetteLamar 44acab76af
[ruby/bigdecimal] Respond to review
https://github.com/ruby/bigdecimal/commit/6d69422e37
2021-12-24 02:28:53 +09:00
BurdetteLamar 973e508472
[ruby/bigdecimal] Respond to review for #precision
https://github.com/ruby/bigdecimal/commit/681cd2d81d
2021-12-24 02:28:53 +09:00
BurdetteLamar 5888d3030d
[ruby/bigdecimal] Enhanced RDoc for bigdecimal.c
https://github.com/ruby/bigdecimal/commit/3a35f92f8b
2021-12-24 02:28:53 +09:00
BurdetteLamar 01b2ccaa95
[ruby/bigdecimal] Enhanced RDoc for bigdecimal.c
https://github.com/ruby/bigdecimal/commit/31a7a37426
2021-12-24 02:28:52 +09:00
Jean Boussier ec478d947f
[ruby/bigdecimal] Fix negative Bignum conversion
Introduced in https://github.com/ruby/bigdecimal/commit/4792a917d806

`rb_absint_size` return the number of bytes needed to fit
the absolute integer, but negative integers need the sign, so one more
bit, and potentially one more byte.

https://github.com/ruby/bigdecimal/commit/0f3d5d0eb7
2021-12-24 02:28:51 +09:00
Olle Jonsson 03507498b6
[ruby/bigdecimal] VpCheckException: improve grammar
I added a space before the parenthesis, too.

https://github.com/ruby/bigdecimal/commit/159af10b17
2021-12-24 02:28:47 +09:00
Nobuyoshi Nakada 40a1af6151
Install ruby/digest.h when from ext/digest 2021-12-23 20:12:45 +09:00
Kazuki Yamaguchi ac757b218c [ruby/openssl] pkey: use EVP_PKEY_CTX_new_from_name() on OpenSSL 3.0
Replace EVP_PKEY_CTX_new_id() with the new EVP_PKEY_CTX_new_from_name()
which takes the algorithm name in a string instead of in an NID.

https://github.com/ruby/openssl/commit/d6535d13d1
2021-12-20 23:42:04 +09:00
Kazuki Yamaguchi 61e426ae05 [ruby/openssl] pkey: assume a pkey always has public key components on OpenSSL 3.0
OpenSSL 3.0's EVP_PKEY_get0() returns NULL for provider-backed pkeys.
This causes segfault because it was supposed to never return NULL
before.

We can't check the existence of public key components in this way on
OpenSSL 3.0. Let's just skip it for now.

https://github.com/ruby/openssl/commit/ccdb6f7bfa
2021-12-20 23:42:04 +09:00
Kazuki Yamaguchi 0b3482c0e7 [ruby/openssl] ssl: add constants for new SSL_OP_* flags
Add all SSL_OP_* constants defined in OpenSSL 3.0.0 which are not
specific to DTLS.

https://github.com/ruby/openssl/commit/b1ee2f23b2
2021-12-20 23:42:03 +09:00
Kazuki Yamaguchi b2fb503dab [ruby/openssl] engine: disable OpenSSL::Engine on OpenSSL 3.0
The entire ENGINE API is deprecated in OpenSSL 3.0 in favor of the new
"Provider" concept.

OpenSSL::Engine will not be defined when compiled with OpenSSL 3.0.
We would need a way to interact with providers from Ruby programs, but
since the concept is completely different from the ENGINE API, it will
not be through the current OpenSSL::Engine interface.

https://github.com/ruby/openssl/commit/69a27d8de4
2021-12-20 23:42:03 +09:00
Kazuki Yamaguchi c1a7c6df18 [ruby/openssl] hmac: fix wrong usage of EVP_DigestSignFinal()
According to the manpage, the "siglen" parameter must be initialized
beforehand.

https://github.com/ruby/openssl/commit/6a60c7b2e7
2021-12-20 23:42:02 +09:00
Kazuki Yamaguchi 8ebf597885 [ruby/openssl] pkey: deprecate PKey#set_* methods
OpenSSL 3.0 made EVP_PKEY immutable. This means we can only have a const
pointer of the low level struct and the following methods can no longer
be provided when linked against OpenSSL 3.0:

 - OpenSSL::PKey::RSA#set_key
 - OpenSSL::PKey::RSA#set_factors
 - OpenSSL::PKey::RSA#set_crt_params
 - OpenSSL::PKey::DSA#set_pqg
 - OpenSSL::PKey::DSA#set_key
 - OpenSSL::PKey::DH#set_pqg
 - OpenSSL::PKey::DH#set_key
 - OpenSSL::PKey::EC#group=
 - OpenSSL::PKey::EC#private_key=
 - OpenSSL::PKey::EC#public_key=

There is no direct replacement for this functionality at the moment.
I plan to introduce a wrapper around EVP_PKEY_fromdata(), which takes
all key components at once to construct an EVP_PKEY.

https://github.com/ruby/openssl/commit/6848d2d969
2021-12-20 23:42:02 +09:00
Kazuki Yamaguchi b93ae54258 [ruby/openssl] pkey/ec: deprecate OpenSSL::PKey::EC#generate_key!
OpenSSL::PKey::EC#generate_key! will not work on OpenSSL 3.0 because
keys are made immutable. Users should use OpenSSL::PKey.generate_key
instead.

https://github.com/ruby/openssl/commit/5e2e66cce8
2021-12-20 23:42:02 +09:00
Kazuki Yamaguchi 0d698be04f [ruby/openssl] pkey/dh: deprecate OpenSSL::PKey::DH#generate_key!
OpenSSL::PKey::DH#generate_key! will not work on OpenSSL 3.0 because
keys are made immutable. Users should use OpenSSL::PKey.generate_key
instead.

https://github.com/ruby/openssl/commit/8ee6a582c7
2021-12-20 23:42:02 +09:00
Kazuki Yamaguchi 50b90c5fc3 [ruby/openssl] pkey/ec: avoid using EC#public_key= in EC#dh_compute_key
Similarly to DH#compute_key, work around it by constructing a
SubjectPublicKeyInfo. This should be considered as a temporary
implementation.

https://github.com/ruby/openssl/commit/fc9aabc18d
2021-12-20 23:42:01 +09:00
Kazuki Yamaguchi dc3f37c6cc [ruby/openssl] pkey/dh: avoid using DH#set_key in DH#compute_key
DH#set_key will not work on OpenSSL 3.0 because keys are immutable.
For now, let's reimplement DH#compute_key by manually constructing a
DER-encoded SubjectPublicKeyInfo structure and feeding it to
OpenSSL::PKey.read.

Eventually, we should implement a new method around EVP_PKEY_fromdata()
and use it instead.

https://github.com/ruby/openssl/commit/46ca47060c
2021-12-20 23:42:01 +09:00
Kazuki Yamaguchi df6589e418 [ruby/openssl] pkey: use EVP_PKEY_dup() if available
We can use it to implement OpenSSL::PKey::PKey#initialize_copy. This
should work on all key types, not just DH/DSA/EC/RSA types.

https://github.com/ruby/openssl/commit/66cd8cbaaf
2021-12-20 23:42:01 +09:00
Kazuki Yamaguchi c1a36ebfda [ruby/openssl] pkey: allocate EVP_PKEY on #initialize
Allocate an EVP_PKEY when the content is ready: when #initialize
or #initialize_copy is called, rather than when a T_DATA is allocated.
This is more natural because the lower level API has been deprecated
and an EVP_PKEY is becoming the minimum unit of handling keys.

https://github.com/ruby/openssl/commit/74f6c61756
2021-12-20 23:42:01 +09:00
Kazuki Yamaguchi 02a58fbfd1 [ruby/openssl] pkey: do not check NULL argument in ossl_pkey_new()
Passing NULL to ossl_pkey_new() makes no sense in the first place, and
in fact it is ensured not to be NULL in all cases.

https://github.com/ruby/openssl/commit/316cb2a41f
2021-12-20 23:42:00 +09:00
Kazuki Yamaguchi 6ef0f272eb [ruby/openssl] pkey: use OSSL_DECODER to load encrypted PEM on OpenSSL 3.0
OpenSSL 3.0 has rewritten routines to load pkeys (PEM_read_bio_* and
d2i_* functions) around the newly introduced OSSL_DECODER API.

This comes with a slight behavior change. They now decrypt and parse
each encountered PEM block, then check the kind of the block. This used
to be the reverse: they checked the PEM header to see the kind, and then
decrypted the content. This means that the password callback may now be
called repeatedly.

Let's use the OSSL_DECODER API directly on OpenSSL 3.0 so that the
return value from the password callback will be reused automatically.

https://github.com/ruby/openssl/commit/a84ea531bb
2021-12-20 23:42:00 +09:00
Hiroshi SHIBATA 87b968c903
[ruby/psych] psych depends stringio only CRuby
https://github.com/ruby/psych/commit/e7bbf26cb2
2021-12-20 18:26:58 +09:00
Hiroshi SHIBATA 706c7a27fa [ruby/psych] Bump version to 4.0.3
https://github.com/ruby/psych/commit/75ab76e788
2021-12-20 18:25:50 +09:00
Nobuyoshi Nakada 54f0e63a8c Remove `NODE_DASGN_CURR` [Feature #18406]
This `NODE` type was used in pre-YARV implementation, to improve
the performance of assignment to dynamic local variable defined at
the innermost scope.  It has no longer any actual difference with
`NODE_DASGN`, except for the node dump.
2021-12-13 12:53:03 +09:00
Nobuyoshi Nakada e4b35b158a [ruby/cgi] Check integer overflow in long range
https://hackerone.com/reports/1328463

https://github.com/ruby/cgi/commit/ccaf6027e0
2021-12-12 13:05:15 +09:00
Hiroshi SHIBATA c41751f10e
[ruby/io-wait] Bump up 0.2.1
https://github.com/ruby/io-wait/commit/c97ab9a212
2021-12-09 19:28:54 +09:00
Yusuke Endoh 17e7219679 ext/ripper/lib/ripper/lexer.rb: Do not deprecate Ripper::Lexer::State#[]
The old code of IRB still uses this method. The warning is noisy on
rails console.
In principle, Ruby 3.1 deprecates nothing, so let's avoid the
deprecation for the while.
I think It is not so hard to continue to maintain it as it is a trivial
shim.

https://github.com/ruby/ruby/pull/5093
2021-12-09 00:30:17 +09:00
Peter Zhu 9f0c6f20c5 [Bug #18382] Fix crash in compaction for ObjectSpace.trace_object_allocations
ObjectSpace.trace_object_allocations can crash when auto-compaction is
enabled.
2021-12-02 13:06:44 -05:00
Nobuyoshi Nakada 524a808d23
Define Ripper::Lexer::Elem#to_s
Alias `#inspect` as `#to_s` also in the new `Ripper::Lexer::Elem`
class, so that `puts Ripper::Lexer.new(code).scan` shows the
attributes.
2021-12-02 18:29:45 +09:00
schneems 8944009be7 Deprecate `Lexer::Elem#[]` and `Lexer::State#[]`
Discussed in https://github.com/ruby/ruby/pull/5093#issuecomment-964426481. 

> it would be enough to mimic only [] for almost all cases

This adds back the `Lexer::Elem#[]` and `Lexer::State#[]` and adds deprecation warnings for them.
2021-12-02 15:55:42 +09:00
schneems 3685b5af95 Only iterate Lexer heredoc arrays
The last element in the `@buf` may be either an array or an `Elem`. In the case it is an `Elem` we iterate over every element, when we do not need to. This check guards that case by ensuring that we only iterate over an array of elements.
2021-12-02 15:55:42 +09:00
schneems 3f74eaa7a8 ~1.10x faster Change Ripper.lex structs to classes
## Concept

I am proposing we replace the Struct implementation of data structures inside of ripper with real classes.

This will improve performance and the implementation is not meaningfully more complicated.

## Example

Struct versus class comparison:

```ruby
Elem = Struct.new(:pos, :event, :tok, :state, :message) do
  def initialize(pos, event, tok, state, message = nil)
    super(pos, event, tok, State.new(state), message)
  end

  # ...

  def to_a
    a = super
    a.pop unless a.empty?
    a
  end
end

class ElemClass
  attr_accessor :pos, :event, :tok, :state, :message

  def initialize(pos, event, tok, state, message = nil)
    @pos = pos
    @event = event
    @tok = tok
    @state = State.new(state)
    @message = message
  end

  def to_a
    if @message
      [@pos, @event, @tok, @state, @message]
    else
      [@pos, @event, @tok, @state]
    end
  end
end

# stub state class creation for now
class State; def initialize(val); end; end
```

## MicroBenchmark creation

```ruby
require 'benchmark/ips'
require 'ripper'

pos = [1, 2]
event = :on_nl
tok = "\n".freeze
state = Ripper::EXPR_BEG

Benchmark.ips do |x|
  x.report("struct") { Elem.new(pos, event, tok, state) }
  x.report("class ") { ElemClass.new(pos, event, tok, state) }
  x.compare!
end; nil
```

Gives ~1.2x faster creation:

```
Warming up --------------------------------------
              struct   263.983k i/100ms
              class    303.367k i/100ms
Calculating -------------------------------------
              struct      2.638M (± 5.9%) i/s -     13.199M in   5.023460s
              class       3.171M (± 4.6%) i/s -     16.078M in   5.082369s

Comparison:
              class :  3170690.2 i/s
              struct:  2638493.5 i/s - 1.20x  (± 0.00) slower
```

## MicroBenchmark `to_a` (Called by Ripper.lex for every element)

```ruby
require 'benchmark/ips'
require 'ripper'

pos = [1, 2]
event = :on_nl
tok = "\n".freeze
state = Ripper::EXPR_BEG

struct =  Elem.new(pos, event, tok, state)
from_class = ElemClass.new(pos, event, tok, state)

Benchmark.ips do |x|
  x.report("struct") { struct.to_a }
  x.report("class ") { from_class.to_a }
  x.compare!
end; nil
```

Gives 1.46x faster `to_a`:

```
Warming up --------------------------------------
              struct   612.094k i/100ms
              class    893.233k i/100ms
Calculating -------------------------------------
              struct      6.121M (± 5.4%) i/s -     30.605M in   5.015851s
              class       8.931M (± 7.9%) i/s -     44.662M in   5.039733s

Comparison:
              class :  8930619.0 i/s
              struct:  6121358.9 i/s - 1.46x  (± 0.00) slower
```

## MicroBenchmark data access

```ruby
require 'benchmark/ips'
require 'ripper'

pos = [1, 2]
event = :on_nl
tok = "\n".freeze
state = Ripper::EXPR_BEG

struct =  Elem.new(pos, event, tok, state)
from_class = ElemClass.new(pos, event, tok, state)

Benchmark.ips do |x|
  x.report("struct") { struct.pos[1] }
  x.report("class ") { from_class.pos[1] }
  x.compare!
end; nil
```

Gives ~1.17x faster data access:

```
Warming up --------------------------------------
              struct     1.694M i/100ms
              class      1.868M i/100ms
Calculating -------------------------------------
              struct     16.149M (± 6.8%) i/s -     81.318M in   5.060633s
              class      18.886M (± 2.9%) i/s -     95.262M in   5.048359s

Comparison:
              class : 18885669.6 i/s
              struct: 16149255.8 i/s - 1.17x  (± 0.00) slower
```

## Full benchmark integration of this inside of Ripper.lex

Inside of this repo with this commit

```
$ cd ext/ripper
$ make
$ cat test.rb
file = File.join(__dir__, "../../array.rb")
source = File.read(file)

bench = Benchmark.measure do
  10_000.times.each do
    Ripper.lex(source)
  end
end

puts bench
```

Then execute with and without this change 50 times:

```
rm new.txt
rm old.txt
for i in {0..50}
do
  `ruby -Ilib -rripper -rbenchmark ./test.rb >> new.txt`
  `ruby -rripper -rbenchmark ./test.rb >> old.txt`
done
```

I used derailed benchmarks internals to compare the results:

```
dir = Pathname(".")
branch_info = {}
branch_info["old"]  = { desc: "Struct lex", time: Time.now, file: dir.join("old.txt"), name: "old" }
branch_info["new"]  = { desc: "Class lex", time: Time.now, file: dir.join("new.txt"), name: "new" }
stats = DerailedBenchmarks::StatsFromDir.new(branch_info)
stats.call.banner
```

Which gave us:

```
❤️ ❤️ ❤️  (Statistically Significant) ❤️ ❤️ ❤️

[new] (3.3139 seconds) "Class lex" ref: "new"
  FASTER 🚀🚀🚀 by:
    1.1046x [older/newer]
    9.4700% [(older - newer) / older * 100]
[old] (3.6606 seconds) "Struct lex" ref: "old"

Iterations per sample:
Samples: 51

Test type: Kolmogorov Smirnov
Confidence level: 99.0 %
Is significant? (max > critical): true
D critical: 0.30049534876137013
D max: 0.9607843137254902

Histograms (time ranges are in seconds):

   [new] description:                                        [old] description:
     "Class lex"                                               "Struct lex"
              ┌                                        ┐                ┌                                        ┐
   [3.0, 3.3) ┤▇ 1                                           [3.0, 3.3) ┤ 0
   [3.3, 3.6) ┤▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 47       [3.3, 3.6) ┤ 0
   [3.5, 3.8) ┤▇▇ 2                                          [3.5, 3.8) ┤▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 46
   [3.8, 4.1) ┤▇ 1                                           [3.8, 4.1) ┤▇▇▇ 4
   [4.0, 4.3) ┤ 0                                            [4.0, 4.3) ┤ 0
   [4.3, 4.6) ┤ 0                                            [4.3, 4.6) ┤▇ 1
              └                                        ┘                └                                        ┘
                         # of runs in range                                        # of runs in range
```

To sum this up, the "new" version of this code (using real classes instead of structs) is 10% faster across 50 runs with a statistical significance confidence level of 99%. Histograms are for visual checksum.
2021-12-02 15:55:42 +09:00
Nobuyoshi Nakada ae95939784
[ruby/win32ole] Fix typos [ci skip]
https://github.com/ruby/win32ole/commit/8d46bd0c93
2021-11-25 23:53:15 +09:00
Hiroshi SHIBATA 24f8f20cc7
[ruby/win32ole] LICENSE
https://github.com/ruby/win32ole/commit/62fd78078b
2021-11-25 23:53:14 +09:00
Nobuyoshi Nakada d896746d69
Keep the generated source files when clean [Bug #18363] 2021-11-25 19:16:39 +09:00
Peter Zhu c51b92c18d [ruby/zlib] [Bug #18358] Fix crash in zlib when in progress
When Zlib::Inflate#inflate or Zlib::Deflate#deflate is called
recursively inside the block, a crash can occur because of an
use-after-free bug.

https://github.com/ruby/zlib/commit/50fb8a0338
2021-11-24 23:01:41 +09:00
Nobuyoshi Nakada da34f31ad0 [ruby/cgi] Fix integer overflow
Make use of the check in rb_alloc_tmp_buffer2.

https://hackerone.com/reports/1328463

https://github.com/ruby/cgi/commit/c728632c1c
2021-11-24 19:58:59 +09:00
Alan Wu f5d2041138
Avoid assert failure when NULL EC is expected
After 5680c38c75, postponed job APIs now
expect to be called on native threads not managed by Ruby and handles
getting a NULL execution context. However, in debug builds the change
runs into an assertion failure with GET_EC() which asserts that EC is
non-NULL. Avoid the assertion failure by passing `false` for `expect_ec`
instead as the intention is to handle when there is no EC.

Add a test from John Crepezzi and John Hawthorn to exercise this
situation.

See GH-4108
See GH-5094

[Bug #17573]

Co-authored-by: John Hawthorn <john@hawthorn.email>
Co-authored-by: John Crepezzi <john.crepezzi@gmail.com>
2021-11-22 19:29:29 -05:00
Nobuyoshi Nakada ac152b3cac
Update dependencies 2021-11-21 16:21:18 +09:00
Hiroshi SHIBATA 39655aceb2 [ruby/date] Bump version to 3.2.2
https://github.com/ruby/date/commit/21d91c5f4f
2021-11-18 19:39:57 +09:00
Jean Boussier 3ce27552df [ruby/date] Expose Date::VERSION
An almost universal convention for gems is to expose `Namespace::VERSION`
which makes it mcuh easier when debugging etc.

Many gems extracted from ruby don't do this, even though it would be even more
useful because they ship with ruby, so it's less clear which version it is.

https://github.com/ruby/date/commit/fef7ec18d8
2021-11-18 19:39:55 +09:00
Yusuke Endoh d23b3d9b7d Prevent "already initialized constant Digest::VERSION"
http://rubyci.s3.amazonaws.com/ubuntu1804/ruby-master/log/20211117T033003Z.log.html.gz
```
installing default gems from ext:   /home/chkbuild/chkbuild/tmp/build/20211117T033003Z/lib/ruby/gems/3.1.0
/home/chkbuild/chkbuild/tmp/build/20211117T033003Z/ruby/ext/digest/lib/digest/version.rb:4: warning: already initialized constant Digest::VERSION
/home/chkbuild/chkbuild/tmp/build/20211117T033003Z/ruby/.ext/common/digest/version.rb:4: warning: previous definition of VERSION was here
```

This hack is copied from ext/psych/psych.gemspec
2021-11-17 15:08:46 +09:00
Yusuke Endoh cbb057e677 ext/io/wait/depend: make it work for Ruby 3.1.0-dev
Reverts 2eb3841e9c
because it fails on "update-deps" check in the ruby/ruby CI.

https://github.com/ruby/ruby/runs/4230891140?check_suite_focus=true
```
diff --git a/ext/io/wait/depend b/ext/io/wait/depend
index 7b314b9..449e9fe 100644
--- a/ext/io/wait/depend
+++ b/ext/io/wait/depend
...
```

Maybe now it does not work on Ruby 2.6. This file must be changed for
each Ruby version. I have no good idea to fix this issue.
2021-11-17 11:21:31 +09:00
Jean Boussier a87c56f820 [ruby/date] check_limit: also handle symbols
https://github.com/ruby/date/commit/376c65942b
2021-11-16 22:51:41 +09:00
Jean Boussier fa674cf723 [ruby/date] `Date._<format>(nil)` should return an empty Hash
Fix: https://github.com/ruby/date/issues/39

This is how versions previous to 3.2.1 behaved and Active Support
currently rely on this behavior.

90357af080/activesupport/lib/active_support/values/time_zone.rb (L383-L384)

Any Rails application upgrading to date `3.2.1` might run into unexpected errors.

https://github.com/ruby/date/commit/8f2d7a0c7e
2021-11-16 22:51:40 +09:00
Nobuyoshi Nakada 27168a1cf7 [ruby/nkf] Fix a typo [ci skip]
https://github.com/ruby/nkf/commit/18c118c83c
2021-11-16 21:07:19 +09:00
Yusuke Endoh 489c8cebf5 [ruby/date] Add length limit option for methods that parses date strings
`Date.parse` now raises an ArgumentError when a given date string is
longer than 128. You can configure the limit by giving `limit` keyword
arguments like `Date.parse(str, limit: 1000)`. If you pass `limit: nil`,
the limit is disabled.

Not only `Date.parse` but also the following methods are changed.

* Date._parse
* Date.parse
* DateTime.parse
* Date._iso8601
* Date.iso8601
* DateTime.iso8601
* Date._rfc3339
* Date.rfc3339
* DateTime.rfc3339
* Date._xmlschema
* Date.xmlschema
* DateTime.xmlschema
* Date._rfc2822
* Date.rfc2822
* DateTime.rfc2822
* Date._rfc822
* Date.rfc822
* DateTime.rfc822
* Date._jisx0301
* Date.jisx0301
* DateTime.jisx0301

https://github.com/ruby/date/commit/3959accef8
2021-11-16 20:56:56 +09:00
Nobuyoshi Nakada c910de3575 [ruby/io-wait] Fix dependency for ruby 2.6
https://github.com/ruby/io-wait/commit/2eb3841e9c
2021-11-16 20:25:47 +09:00
Nobuyoshi Nakada 96d9cfba08 [ruby/io-wait] Allow earlier versions
https://github.com/ruby/io-wait/commit/1060f9348c
2021-11-16 20:25:46 +09:00
Nobuyoshi Nakada db71a04c2e [ruby/io-wait] Fix backward compatibility with earlier versions
https://github.com/ruby/io-wait/commit/898248931f
2021-11-16 20:25:43 +09:00
Hiroshi SHIBATA 018266ca38
Merge digest-3.0.3.pre3 and efd76821b8 2021-11-16 19:42:20 +09:00
Akinori MUSHA 625cffc808 [ruby/digest] Abort loading if being loaded by gem/bundle pre Ruby 3.0.3
https://github.com/ruby/digest/commit/efd76821b8
2021-11-16 18:35:13 +09:00
xtkoba fed65e6a48 [ruby/digest] Avoid null pointer subtraction in digest/md5
Fixes warning on Clang 13.

Fixes [Bug #18076]

https://github.com/ruby/digest/commit/32135c7487
2021-11-16 18:35:07 +09:00
Peter Zhu aeae6e2842 [Feature #18290] Remove all usages of rb_gc_force_recycle
This commit removes usages of rb_gc_force_recycle since it is a burden
to maintain and makes changes to the GC difficult.
2021-11-08 14:05:54 -05:00
Nobuyoshi Nakada 2772f85648
Prefer ANSI-style prototypes over old K&R-style definitions 2021-11-08 17:08:01 +09:00
Nobuyoshi Nakada b47f7afbc3
Fix filename typo [Bug #18140] 2021-11-08 17:08:01 +09:00
Nobuyoshi Nakada 5b8d22ebe6 [ruby/openssl] Fix typos [ci skip]
https://github.com/ruby/openssl/commit/708ebf2f7a
2021-11-03 23:43:04 +09:00
Yusuke Endoh 8413749ec0 ext/socket/extconf.rb: Fix the chech if if_indextoname is available
The check had not work because "headers" were not passed.
2021-11-02 23:41:01 +09:00
Nobuyoshi Nakada a202408180
Fix typos 2021-11-02 19:17:37 +09:00
Kazuki Yamaguchi b474049c78 [ruby/openssl] x509name: improve docs for X509::Name
Add docs for X509::Name.parse_openssl and X509::Name.parse_rfc2253,
which are currently undocumented despite being widely used.

Small changes are also made to #to_s and the class description to
recommend using RFC 2253-based methods.

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

https://github.com/ruby/openssl/commit/74041a35d4
2021-11-01 17:48:03 +09:00
Kazuki Yamaguchi 1ac7f23bb8 [ruby/openssl] ssl: disallow reading/writing to unstarted SSL socket
OpenSSL::SSL::SSLSocket allowed #read and #write to be called before an
SSL/TLS handshake is completed. They passed unencrypted data to the
underlying socket.

This behavior is very odd to have in this library. A verbose mode
warning "SSL session is not started yet" was emitted whenever this
happened. It also didn't behave well with OpenSSL::Buffering. Let's
just get rid of it.

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

https://github.com/ruby/openssl/commit/bf780748b3
2021-11-01 17:48:02 +09:00
Peter Zhu a5b6598192 [Feature #18239] Implement VWA for strings
This commit adds support for embedded strings with variable capacity and
uses Variable Width Allocation to allocate strings.
2021-10-25 13:26:23 -04:00
Yusuke Endoh 86e3d77abb
Make Coverage suspendable (#4856)
* Make Coverage suspendable

Add `Coverage.suspend`, `Coverage.resume` and some methods.

[Feature #18176] [ruby-core:105321]
2021-10-25 20:00:51 +09:00
Kazuki Yamaguchi e10dfdf623 [ruby/openssl] bn: expand BIGNUM_RAND and BIGNUM_RAND_RANGE macros
Now that BN.pseudo_rand{,_range} are alias, those macros are only used
once. Let's expand the macros for better readability.

https://github.com/ruby/openssl/commit/7c2fc00dee
2021-10-25 00:40:48 +09:00
Kazuki Yamaguchi e19186707a [ruby/openssl] bn: make BN.pseudo_rand{,_range} an alias of BN.rand{,_range}
BN_pseudo_rand() and BN_pseudo_rand_range() are deprecated in
OpenSSL 3.0. Since they are identical to their non-'pseudo' version
anyway, let's make them alias.

https://github.com/ruby/openssl/commit/2d34e85ddf
2021-10-25 00:40:48 +09:00
Kazuki Yamaguchi 1b5ccc8a0c [ruby/openssl] pkey, ssl: use EVP_PKEY_eq() instead of EVP_PKEY_cmp()
OpenSSL 3.0 renamed EVP_PKEY_cmp() to EVP_PKEY_eq() because that was a
confusing name.

https://github.com/ruby/openssl/commit/d42bd7fcdb
2021-10-25 00:40:47 +09:00
Kazuki Yamaguchi ee7131614c [ruby/openssl] pkey/ec: use EC_GROUP_free() instead of EC_GROUP_clear_free()
EC_GROUP_clear_free() is deprecated in OpenSSL 3.0.

EC_GROUP does not include any sensitive data, so we can safely use
EC_GROUP_free() instead.

https://github.com/ruby/openssl/commit/e93a5fdffc
2021-10-25 00:40:47 +09:00
Kazuki Yamaguchi 555788b622 [ruby/openssl] pkey/ec: deprecate PKey::EC::Point#make_affine! and make it a no-op
It converts the internal representation of the point object to the
affine coordinate system. However, it had no real use case because the
difference in the internal representation has not been visible from
Ruby/OpenSSL at all.

EC_POINT_make_affine() is marked as deprecated in OpenSSL 3.0.

https://github.com/ruby/openssl/commit/e2cc81fef7
2021-10-25 00:40:46 +09:00
Kazuki Yamaguchi 16272d9ae9 [ruby/openssl] hmac: use EVP_MD_CTX_get_pkey_ctx() instead of EVP_MD_CTX_pkey_ctx()
OpenSSL 3.0 renamed EVP_MD_CTX_pkey_ctx() to include "get" in the
function name. Adjust compatibility macro so that we can use the new
function name for all OpenSSL 1.0.2-3.0.

https://github.com/ruby/openssl/commit/c106d888c6
2021-10-25 00:40:46 +09:00
Kazuki Yamaguchi 040387d265 [ruby/openssl] digest: use EVP_MD_CTX_get0_md() instead of EVP_MD_CTX_md() if exists
The function was renamed in OpenSSL 3.0 due to the change of the
lifetime of EVP_MD objects. They are no longer necessarily statically
allocated and can be reference-counted -- when an EVP_MD_CTX is free'd,
the associated EVP_MD can also become inaccessible.

Currently Ruby/OpenSSL only handles builtin algorithms, so no special
handling is needed except for adapting to the rename.

https://github.com/ruby/openssl/commit/0a253027e6
2021-10-25 00:40:45 +09:00
Kazuki Yamaguchi cfa4fa636e [ruby/openssl] bn: use BN_check_prime() in OpenSSL::BN#prime{,_fasttest}?
In OpenSSL 3.0, BN_is_prime_ex() and BN_is_prime_fasttest_ex() are
deprecated in favor of BN_check_prime().

https://github.com/ruby/openssl/commit/90d51ef510
2021-10-25 00:40:45 +09:00
Kazuki Yamaguchi fa24e7a57e [ruby/openssl] ssl: use SSL_get_rbio() to check if SSL is started or not
Use SSL_get_rbio() instead of SSL_get_fd(). SSL_get_fd() internally
calls SSL_get_rbio() and it's enough for our purpose.

In OpenSSL 3.0, SSL_get_fd() leaves an entry in the OpenSSL error queue
if BIO has not been set up yet, and we would have to clean it up.

https://github.com/ruby/openssl/commit/e95ee24867
2021-10-25 00:40:44 +09:00
Kazuki Yamaguchi d5aa3fcae6 [ruby/openssl] ssl: use SSL_CTX_load_verify_{file,dir}() if available
SSL_CTX_load_verify_locations() is deprecated in OpenSSL 3.0 and
replaced with those two separate functions. Use them if they exist.

https://github.com/ruby/openssl/commit/5375a55ffc
2021-10-25 00:40:44 +09:00
Kazuki Yamaguchi 19ef7082ba [ruby/openssl] ts: use TS_VERIFY_CTX_set_certs instead of TS_VERIFY_CTS_set_certs
OpenSSL 3.0 fixed the typo in the function name and replaced the
current 'CTS' version with a macro.

https://github.com/ruby/openssl/commit/2be6779b08
2021-10-25 00:40:43 +09:00
Kazuki Yamaguchi 3d16401508 [ruby/openssl] ossl.c: use ERR_get_error_all() if available
OpenSSL 3.0 deprecated ERR_get_error_line_data() in favor of
ERR_get_error_all(), as part of the error queue structure changes.

https://github.com/ruby/openssl/commit/8e98d2ecc8
2021-10-25 00:40:43 +09:00
Kazuki Yamaguchi 32d49e93cf [ruby/openssl] ext/openssl/ossl.h: add helper macros for OpenSSL/LibreSSL versions
Add following convenient macros:

 - OSSL_IS_LIBRESSL
 - OSSL_OPENSSL_PREREQ(maj, min, pat)
 - OSSL_LIBRESSL_PREREQ(maj, min, pat)

https://github.com/ruby/openssl/commit/00abee791d
2021-10-25 00:40:42 +09:00
Hiroshi SHIBATA 1be2875e1d
[flori/json] Bump version to v2.6.1
https://github.com/flori/json/commit/2db5894cfa
2021-10-24 09:25:20 +09:00
Josef Šimánek 4cbce79438
[flori/json] Bump JSON::VERSION to 2.6.0.
https://github.com/flori/json/commit/da94d9f059
2021-10-24 09:25:01 +09:00
David Rodríguez d04d6bbc6c [ruby/psych] Prefer `require_relative` for internal requires
https://github.com/ruby/psych/commit/a0f55ee85a
2021-10-24 08:49:14 +09:00
Josef Šimánek 48cd633094 [ruby/psych] Add stringio as a dependency.
https://github.com/ruby/psych/commit/86e3049579
2021-10-24 08:48:40 +09:00
Sutou Kouhei c0c43276a1 [ruby/strscan] Bump version
If we use the same version as the default strscan gem in Ruby, "gem
install" doesn't extract .gem. It fails "gem install" because "gem
install" can't find ext/strscan/ to be built.

https://github.com/ruby/strscan/commit/3ceafa6cdc
2021-10-24 05:57:48 +09:00
Aaron Patterson 35b9d8d393 [ruby/openssl] Raise an exception if the IO object passed to SSLSocket isn't a file
SSLSocket#connect eventually calls `GetOpenFile` in order to get the
underlying file descriptor for the IO object passed in on
initialization.  `GetOpenFile` assumes that the Ruby object passed in is
a T_FILE object and just casts it to a T_FILE without any checks.  If
you pass an object that *isn't* a T_FILE to that function, the program
will segv.

Since we assume the IO object is a file in the `connect` method, this
commit adds a `CheckType` in the initialize method to ensure that the IO
object is actually a T_FILE.  If the object *isn't* a T_FILE, this class
will segv on `connect`, so I think this is a backwards compatible
change.

https://github.com/ruby/openssl/commit/919fa44ec2
2021-10-23 13:38:40 +09:00
Hiroshi SHIBATA 93691d0752
Import bigdecimal-3.1.0.dev 2021-10-22 15:53:49 +09:00
Hiroshi SHIBATA c5345979e8
Bump up readline-ext version to 0.1.3 2021-10-21 21:17:45 +09:00
Hiroshi SHIBATA 7529fe82f0 [ruby/io-wait] Bump up io-wait version to 0.2.0
https://github.com/ruby/io-wait/commit/f6a1b10a59
2021-10-21 20:54:20 +09:00
Hiroshi SHIBATA 8eb8522f47 [ruby/stringio] Bump up stringio version to 3.0.1
https://github.com/ruby/stringio/commit/f7c40aa339
2021-10-21 20:53:53 +09:00
Hiroshi SHIBATA 5823168706 [ruby/psych] Bump up psych version to 4.0.2
https://github.com/ruby/psych/commit/69a713f860
2021-10-21 13:49:20 +09:00
Alan Wu c02517bacb Tie lifetime of uJIT blocks to iseqs
* Tie lifetime of uJIT blocks to iseqs

   Blocks weren't being freed when iseqs are collected.

* Add rb_dary. Use it for method dependency table

* Keep track of blocks per iseq

  Remove global version_tbl

* Block version bookkeeping fix

* dary -> darray

* free ujit_blocks

* comment about size of ujit_blocks
2021-10-20 18:19:29 -04:00
Hiroshi SHIBATA 847eeafd65 [ruby/etc] Bump up etc version to 1.3.0
https://github.com/ruby/etc/commit/85ca541d0b
2021-10-19 20:55:33 +09:00
Hiroshi SHIBATA b482a516d2 [ruby/zlib] Bump up zlib version to 2.1.1
https://github.com/ruby/zlib/commit/82e9a636a6
2021-10-19 20:28:57 +09:00
Nobuyoshi Nakada ae25313e80
[ruby/etc] Remove unnecessary declaration
Fix https://github.com/ruby/etc/pull/12

https://github.com/ruby/etc/commit/7cbf03d22d
2021-10-19 17:25:40 +09:00
Kazuki Yamaguchi cc8ff8b50d [ruby/openssl] require Ruby 2.6 or later
Drop support for Ruby 2.3, 2.4, and 2.5.

As of 2021-10, Ruby 2.6 is the oldest version that still receives
security fixes from the Ruby core team, so it doesn't make much sense
to keep code for those ancient versions.

https://github.com/ruby/openssl/commit/3436bd040d
2021-10-16 19:39:13 +09:00
Kazuki Yamaguchi 4991dabdd0 [ruby/openssl] bump version number to 3.0.0.pre
https://github.com/ruby/openssl/commit/baa83a8a57
2021-10-16 18:57:57 +09:00
Kazuki Yamaguchi cea3c55d58 [ruby/openssl] Ruby/OpenSSL 2.2.1
https://github.com/ruby/openssl/commit/65e7207a07
2021-10-16 18:34:35 +09:00
Kazuki Yamaguchi 75e72baba1 [ruby/openssl] Ruby/OpenSSL 2.1.3
https://github.com/ruby/openssl/commit/e8ee01b22c
2021-10-16 18:34:35 +09:00
Kazuki Yamaguchi c1147f7f71 [ruby/openssl] ssl: avoid directly storing String object in NPN callback
On the server side, the serialized list of protocols is stored in
SSL_CTX as a String object reference. We utilize a hidden instance
variable to prevent it from being GC'ed, but this is not enough because
it can also be relocated by GC.compact.

https://github.com/ruby/openssl/commit/5eb68ba778
2021-10-16 18:34:35 +09:00
Kazuki Yamaguchi f6612203fa [ruby/openssl] x509store: explicitly call rb_gc_mark() against Store/StoreContext
We store the reverse reference to the Ruby object in the OpenSSL
struct for use from OpenSSL callback functions. To prevent the Ruby
object from being relocated by GC.compact, we must "pin" it by calling
rb_gc_mark().

https://github.com/ruby/openssl/commit/a6ba9f894f
2021-10-16 18:34:35 +09:00
Kazuki Yamaguchi ca28545b51 [ruby/openssl] ssl: explicitly call rb_gc_mark() against SSLContext/SSLSocket objects
We store the reverse reference to the Ruby object in the OpenSSL
struct for use from OpenSSL callback functions. To prevent the Ruby
object from being relocated by GC.compact, we must "pin" it by calling
rb_gc_mark().

https://github.com/ruby/openssl/commit/022b7ceada
2021-10-16 18:34:35 +09:00
Kazuki Yamaguchi c6c2190c4c [ruby/openssl] digest: load digest library using Kernel#require
The digest library is a default gem now, too. Therefore we can't simply
use rb_require() to load it, but we should use Kernel#require instead.

This change is based on the suggestion by David Rodríguez in
16172612d5 (commitcomment-57778397)

https://github.com/ruby/openssl/commit/157f80794b
2021-10-16 18:34:35 +09:00
Nobuhiro IMAI f88401f38e [ruby/openssl] fix segv in Timestamp::{Request,Response,TokenInfo}.new
prevent `ossl_ts_*_free()` from calling when `d2i_TS_*_bio()` failed.

https://github.com/ruby/openssl/commit/b29e215786
2021-10-16 18:34:35 +09:00
David Carlier 6dcc74155f [ruby/openssl] ts: libressl build fix warning
TS_time_cb on libressl expects an long long/time_t 64 bits long instead.

https://github.com/ruby/openssl/commit/4c99f577b2
2021-10-16 18:34:35 +09:00
Kazuki Yamaguchi daeb914a52 [ruby/openssl] ssl: temporary lock string buffer while reading
Similarly to SSLSocket#syswrite, the blocking SSLSocket#sysread allows
context switches. We must prevent other threads from modifying the
string buffer.

We can use rb_str_locktmp() and rb_str_unlocktmp() to temporarily
prohibit modification of the string.

https://github.com/ruby/openssl/commit/d38274949f
2021-10-16 18:34:35 +09:00
Kazuki Yamaguchi 5828807626 [ruby/openssl] ssl: create a temporary frozen string buffer when writing
Since a blocking SSLSocket#syswrite call allows context switches while
waiting for the underlying socket to be ready, we must freeze the string
buffer to prevent other threads from modifying it.

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

https://github.com/ruby/openssl/commit/aea874bc6e
2021-10-16 18:25:28 +09:00
Kazuki Yamaguchi 6105ef7629 [ruby/openssl] ssl: add SSLContext#tmp_dh=
Provide a wrapper of SSL_set0_tmp_dh_pkey()/SSL_CTX_set_tmp_dh(), which
sets the DH parameters used for ephemeral DH key exchange.

SSLContext#tmp_dh_callback= already exists for this purpose, as a
wrapper around SSL_CTX_set_tmp_dh_callback(), but it is considered
obsolete and the OpenSSL API is deprecated for future removal. There is
no practical use case where an application needs to use different DH
parameters nowadays. This was originally introduced to support export
grade ciphers.

RDoc for #tmp_dh_callback= is updated to recommend the new #tmp_dh=.

Note that current versions of OpenSSL support automatic ECDHE curve
selection which is enabled by default. SSLContext#tmp_dh= should only be
necessary if you must allow ancient clients which don't support ECDHE.

https://github.com/ruby/openssl/commit/aa43da4f04
2021-10-16 18:19:52 +09:00
Kazuki Yamaguchi 49217086ad [ruby/openssl] ssl: remove private method SSLSocket#tmp_ecdh_callback
Commit ee037e146037 ("ssl: remove SSL::SSLContext#tmp_ecdh_callback",
2020-08-12) forgot to remove the method.

https://github.com/ruby/openssl/commit/bef9ea84e4
2021-10-16 18:19:51 +09:00
Sutou Kouhei 027a3379d6 [ruby/zlib] Fix a bug that GZipReader#gets may return incomplete line
See also: https://github.com/ruby/csv/issues/117#issuecomment-933289373

How to reproduce with x.csv.gz in the issue comment:

    Zlib::GzipReader.open("x.csv.gz") do |rio|
      rio.gets(nil, 1024)
      while line = rio.gets(nil, 8192)
        raise line unless line.valid_encoding?
      end
    end

Reported by Dimitrij Denissenko. Thanks!!!

https://github.com/ruby/zlib/commit/b1f182e98f
2021-10-15 15:31:15 +09:00
Nobuyoshi Nakada e057b9eea9
Prefer the reentrant versions of gmtime and localtime 2021-10-14 23:44:15 +09:00
Hiroshi SHIBATA 2fa0d51ac9 [ruby/date] Bump up date version to 3.2.0
https://github.com/ruby/date/commit/e0a4cbc8f6
2021-10-14 21:15:57 +09:00
Hiroshi SHIBATA b7f557178d [ruby/pathname] Bump up pathname version to 0.2.0
https://github.com/ruby/pathname/commit/e6b3b3ed25
2021-10-14 21:08:03 +09:00
Hiroshi SHIBATA f88628014a [ruby/nkf] Bump up nkf version to 0.1.1
https://github.com/ruby/nkf/commit/9aa7c6b841
2021-10-14 20:29:27 +09:00
Nobuyoshi Nakada d210950196
[ruby/etc] Get rid of alloca in the loop
https://github.com/ruby/etc/commit/c989bacc4c
2021-10-14 18:44:27 +09:00
Hiroshi SHIBATA 1220556f33
[ruby/fcntl] Bump up fcntl version to 1.0.1
https://github.com/ruby/fcntl/commit/0bcc0c4518
2021-10-14 17:18:21 +09:00
Hiroshi SHIBATA 91c2069dcf [flori/json] Bump up json version to 2.6.0
https://github.com/flori/json/commit/1942689b67
2021-10-14 17:04:37 +09:00
Hiroshi SHIBATA 6b13448040 [ruby/zlib] Bump up zlib version to 2.1.0
https://github.com/ruby/zlib/commit/dd593acaee
2021-10-14 16:18:41 +09:00
Hiroshi SHIBATA db500f05c2 [ruby/zlib] Bump version to v2.0.0
https://github.com/ruby/zlib/commit/434eba55ae
2021-10-14 16:18:36 +09:00
Hiroshi SHIBATA 9e86a60306
Removed redundant digest namespace 2021-10-14 14:07:50 +09:00
Hiroshi SHIBATA 3265af2f9e
separate pure ruby location under the digest/* extensions 2021-10-14 13:31:45 +09:00
Hiroshi SHIBATA 13772caee2
Move pure ruby files under the ext/gemname/lib directory. 2021-10-14 13:23:45 +09:00
Nobuyoshi Nakada 013bac15b0
Fix libraries under digest 2021-10-12 22:32:42 +09:00
Akinori MUSHA 01dc55ffad
[ruby/digest] Bump version to 3.1.0.pre2
https://github.com/ruby/digest/commit/5184207611
2021-10-12 20:53:18 +09:00
Akinori MUSHA ab787c493b
[ruby/digest] Bump version to 3.1.0.pre1
https://github.com/ruby/digest/commit/56679008cf
2021-10-12 20:53:18 +09:00
Pavel Rosický 10a0fac7e4
[ruby/digest] include jars
https://github.com/ruby/digest/commit/c15cbcd978
2021-10-12 20:53:17 +09:00
Akinori MUSHA e94bcda025
[ruby/digest] Bump version to 3.1.0.pre0
https://github.com/ruby/digest/commit/594cc4d548
2021-10-12 20:53:17 +09:00
Akinori MUSHA b245b67d9e
[ruby/digest] Place common parts in lib and engine specific parts under ext/**/lib
https://github.com/ruby/digest/commit/8d7496c3be
2021-10-12 20:53:16 +09:00
Pavel Rosický 5e1d2c5c97
[ruby/digest] relicence under the Ruby license and the BSD 2-clause
https://github.com/ruby/digest/commit/154d461e91
2021-10-12 20:46:16 +09:00
Pavel Rosický 94882df3a2
[ruby/digest] jruby support
https://github.com/ruby/digest/commit/2e9dc14693
2021-10-12 20:46:13 +09:00
Nobuyoshi Nakada ff1f696d30
[ruby/digest] Move digest.rb back under ext as the extension bundled library
https://github.com/ruby/digest/commit/026ba7f361
2021-10-12 20:44:14 +09:00
Kazuhiro NISHIYAMA 8dd6d58543 Add more socket constants
from http://manpages.ubuntu.com/manpages/focal/en/man2/socket.2.html
2021-10-12 16:45:22 +09:00
卜部昌平 5c167a9778 ruby tool/update-deps --fix 2021-10-05 14:18:23 +09:00
Rei Odaira ceeae31901 Avoid using the altzone variable in AIX
In AIX, altzone exists in the standard library but is not declared
in time.h.  By 524513be39, have_var
and try_var in mkmf recognizes a variable that exists in a library
even when it is not declared.  As a result, in AIX, HAVE_ALTZONE
is defined, but compile fails due to the lack of the declaration.
2021-10-02 21:23:34 -05:00
Jeremy Evans f9f7f3a75e [ruby/date] Make %v strftime flag use uppercase month
%v is supposed to be the VMS date, and VMS date format uses an
uppercase month.

Ruby 1.8 used an uppercase month for %v, but the behavior was
changed without explanation in r31672.

Time#strftime still uses an uppercase month for %v, so this change
makes Date#strftime consistent with Time#strftime.

Fixes [Bug #13810]

https://github.com/ruby/date/commit/56c489fd7e
2021-09-28 17:34:26 +09:00
Kazuhiro NISHIYAMA e0c6e8c64a
[DOC] Use `unpack1` instead of `unpack(template)[0]` [ci skip] 2021-09-23 09:20:00 +09:00
Nobuyoshi Nakada 289f3a79b5 [ruby/openssl] Add fallthrough comments
https://github.com/ruby/openssl/commit/258e30b640
2021-09-12 22:49:07 +09:00
Nobuyoshi Nakada 6920f3dc96 [ruby/openssl] Suppress cast-function-type warnings
https://github.com/ruby/openssl/commit/0f91e2a6ee
2021-09-12 22:49:05 +09:00
Nobuyoshi Nakada 598d66f6b2 [ruby/openssl] Separate formatting from ossl_make_error
Just append OpenSSL error reason to the given message string
object, which would be alreadly formatted.
Suppress -Wformat-security warning in `ossl_tsfac_create_ts`.

https://github.com/ruby/openssl/commit/11b1d8a6b8
2021-09-12 22:49:03 +09:00
Nobuyoshi Nakada c7dce12eb9 [ruby/openssl] Suppress printf format warnings
* Add `printf` format attribute to `ossl_raise`.
* Fix a format specifier in `config_load_bio`.
* Use `ASSUME` for the unreachable condition.

https://github.com/ruby/openssl/commit/41da2955db
2021-09-12 22:49:01 +09:00
Nobuyoshi Nakada 2bd6c5dc16 [ruby/date] Ignore warned variables
To suppress warnings at the compilation time.

https://github.com/ruby/date/commit/ff21132203
2021-09-09 13:56:13 +09:00
Hiroshi SHIBATA 8f752c95d2
[ruby/fiddle] Use test-unit gem (https://github.com/ruby/fiddle/pull/69)
https://github.com/ruby/fiddle/commit/e08c4c635e

Co-authored-by: Sutou Kouhei <kou@clear-code.com>
2021-09-05 17:43:48 +09:00
Nobuyoshi Nakada afa33da72b [ruby/fiddle] Create extconf header for MSVC
Not to include parenthesized argument.

https://github.com/ruby/fiddle/commit/c2c921e16a
2021-09-05 17:31:46 +09:00
Nobuyoshi Nakada ab63f6d854
Refined test [Bug #18140] 2021-09-02 09:11:41 +09:00
Aaron Patterson 8db269edb3
Guard array when appending
This prevents early collection of the array.  The GC doesn't see the
array on the stack when Ruby is compiled with optimizations enabled

Thanks @jhaberman for the test case

[ruby-core:105099] [Bug #18140]
2021-09-01 10:58:20 -07:00
Nobuyoshi Nakada d3155e3632 [ruby/zlib] Don't print out warnings when finalizing
https://github.com/ruby/zlib/commit/44a56d36e7
2021-08-31 23:20:42 +09:00
Nobuyoshi Nakada 31c427511c [ruby/zlib] Revert "Don't print out warnings when freeing."
https://github.com/ruby/zlib/commit/931aa7a272
2021-08-31 23:20:40 +09:00
jory-graham db154b20cc [ruby/psych] Replace A-Za-z with [:alpha:]
https://github.com/ruby/psych/commit/8ec36494fb
2021-08-31 19:34:54 +09:00
Aaron Patterson 9ed2cb26de [ruby/psych] Add quotes to the strings "y" and "n"
'y' and 'n' are kind of ambiguous.  Syck treated y and n literals in
YAML documents as strings.  But this is not what the YAML 1.1 spec says.
YAML 1.1 says they should be treated as booleans.  When we're dumping
documents, we know it's a string, so adding quotes will eliminate the
"ambiguity" in the emitted document

Fixes #443

https://github.com/ruby/psych/commit/6a1c30634e
2021-08-31 19:34:46 +09:00
opak 0925fddc80 [ruby/psych] Update lib/psych/scalar_scanner.rb
https://github.com/ruby/psych/commit/64cc239557

Co-authored-by: Olle Jonsson <olle.jonsson@gmail.com>
2021-08-31 19:34:36 +09:00
Alexandr Opak 44353d0dee [ruby/psych] add more tests
https://github.com/ruby/psych/commit/8f71222bf3
2021-08-31 19:34:28 +09:00
Alexandr Opak 48b50cb4fe [ruby/psych] fix parsing integer values with '_' at the end
https://github.com/ruby/psych/commit/e0bb853014
2021-08-31 19:34:13 +09:00
Tomer Brisker 31ba0921f8 [ruby/psych] Improve float scalar scanner
Previously, `+.inf` was not handled correctly. Additionally, the regexp
was checking for inf and NaN, even though these cases are handled earlier
in the condition. Added a few tests to ensure handling some missing
cases.

https://github.com/ruby/psych/commit/6e0e7a1e9f
2021-08-31 19:34:06 +09:00
Samuel Williams d19af1675c [ruby/zlib] Don't print out warnings when freeing.
https://github.com/ruby/zlib/commit/098c50255d
2021-08-31 19:33:38 +09:00
Nobuyoshi Nakada 2dd26bed86
[Feature #16972] Add mode: option to Pathname#mkpath 2021-08-31 11:53:41 +09:00
schneems 51070ee5c4 Faster Pathname FileUtils methods
Currently when calling any of the "FileUtils" methods on pathname `require` is called every time even though that library might already be loaded. This is slow:

We can speed it up by either checking first if the constant is already defined, or by using autoload.

Using defined speeds up the action by about 300x and using autoload is about twice as fast as that (600x faster than current require method).

I'm proposing we use autoload:

```ruby
require 'benchmark/ips'

Benchmark.ips do |x|
  autoload(:FileUtils, "fileutils")
  x.report("require") { require 'fileutils' }
  x.report("defined") { require 'fileutils' unless defined?(FileUtils) }
  x.report("autoload") { FileUtils }

  x.compare!
end

# Warming up --------------------------------------
#              require     3.624k i/100ms
#              defined     1.465M i/100ms
#             autoload     2.320M i/100ms
# Calculating -------------------------------------
#              require     36.282k (± 2.4%) i/s -    184.824k in   5.097153s
#              defined     14.539M (± 2.0%) i/s -     73.260M in   5.041161s
#             autoload     23.100M (± 1.9%) i/s -    115.993M in   5.023271s

# Comparison:
#             autoload: 23099779.2 i/s
#              defined: 14538544.9 i/s - 1.59x  (± 0.00) slower
#              require:    36282.3 i/s - 636.67x  (± 0.00) slower
```

Because this autoload is scoped to Pathname it will not change the behavior of existing programs that are not expecting FileUtils to be loaded yet:

```
ruby -rpathname -e "class Pathname; autoload(:FileUtils, 'fileutils'); end; puts FileUtils.exist?"
Traceback (most recent call last):
-e:1:in `<main>': uninitialized constant FileUtils (NameError)
```
2021-08-30 15:18:11 +09:00
Peter Zhu c08d4067be [Feature #18045] Remove T_PAYLOAD
This commit removes T_PAYLOAD since the new VWA implementation no longer
requires T_PAYLOAD types.

Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
2021-08-25 09:28:21 -04:00
Aaron Patterson 0f1e8f38c9 [ruby/fiddle] Improve "offsetof" calculations (https://github.com/ruby/fiddle/pull/90)
I need to get the offset of members inside sub structures.  This patch
adds sub-structure offset support for structs.

https://github.com/ruby/fiddle/commit/cf78eddbb6
2021-08-24 16:18:22 +09:00
Peter Zhu eddd369e73 Revert "[Feature #18045] Implement size classes for GC"
This reverts commits 48ff7a9f3e
and b2e2cf2ded because it is causing
crashes in SPARC solaris and i386 debian.
2021-08-23 10:54:53 -04:00
Peter Zhu 48ff7a9f3e [Feature #18045] Remove T_PAYLOAD
This commit removes T_PAYLOAD since the new VWA implementation no longer
requires T_PAYLOAD types.

Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
2021-08-23 09:15:42 -04:00
Nobuyoshi Nakada 0b9a3371ea [ruby/date] Add zontab.list dependency
https://github.com/ruby/date/commit/7e1ffbf568
2021-08-22 20:28:52 +09:00
Mike Dalessio c0f4e4ca6d undefine alloc functions for C extensions
per guidance in doc/extension.rdoc, these classes now undefine their
alloc functions:

- ObjectSpace::InternalObjectWrapper
- Socket::Ifaddr
2021-08-20 08:30:06 +09:00
Nobuyoshi Nakada 36ae44ce2c
[ruby/date] Update zonetab.h at 2021-08-11
https://github.com/ruby/date/commit/de7dca353f
2021-08-17 22:57:59 +09:00
Nobuyoshi Nakada b8f7e8ac6b
Include ruby.h before internal headers to suppress -Wundef warnings 2021-08-09 19:25:18 +09:00
Nobuyoshi Nakada ae275f67ce Show WorkingSetSize as RSS on Windows 2021-08-05 17:14:38 +09:00
Nobuyoshi Nakada 3b52230452
Define functions using rb_wait_for_single_fd [Bug #18046] 2021-08-01 06:49:07 +09:00
Nobuyoshi Nakada 7564e066ff
Renamed thraed_fd_close as thread_fd 2021-07-29 21:15:04 +09:00
Hiroshi SHIBATA a889ab486e
Update the latest version of json.gemspec from flori/json 2021-07-29 15:57:58 +09:00
Rhys Powell e99d2d066f [ruby/psych] fix: use git repository link for LibYAML in docs
LibYAML has moved from their previous Mercurial based hosting on BitBucket to a git repository on GitHub. This commit updates the `Psych` module's documentation to point to this new repository, instead of the old one which is now a 404.

https://github.com/ruby/psych/commit/947a84d0dd
2021-07-29 15:54:41 +09:00
Jeremy Evans b3d62a77d9 [ruby/zlib] Synchronize access to zstream to prevent segfault in multithreaded use
I'm not sure whether this handles all multithreaded use cases,
but this handles the example that crashes almost immediately
and does 10,000,000 total deflates using 100 separate threads.

To prevent the tests from taking forever, the committed test
for this uses only 10,000 deflates across 10 separate threads,
which still causes a segfault in the previous implementation
almost immediately.

Fixes [Bug #17803]

https://github.com/ruby/zlib/commit/4b1023b3f2
2021-07-28 13:40:03 +09:00
Hiroshi SHIBATA 30d0e5d1ae
[ruby/digest] Also drop to support Ruby 2.4
https://github.com/ruby/digest/commit/360a7de366
2021-07-28 11:48:36 +09:00
Hiroshi SHIBATA 260546ba26
[ruby/digest] Use Gemfile instead of Gem::Specification#add_development_dependency
https://github.com/ruby/digest/commit/460a6f807e
2021-07-28 11:48:36 +09:00