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

8217 Коммитов

Автор SHA1 Сообщение Дата
Kazuki Yamaguchi 1706302be5 [ruby/openssl] pkey: fix potential memory leak in PKey#sign
Fix potential leak of EVP_MD_CTX object in an error path. This path is
normally unreachable, since the size of a signature generated by any
supported algorithms would not be larger than LONG_MAX.

https://github.com/ruby/openssl/commit/99e8630518
2021-07-18 17:44:44 +09:00
Kazuki Yamaguchi b7a908af34 [ruby/openssl] ossl.c: do not set locking callbacks on LibreSSL
Similarly to OpenSSL >= 1.1.0, LibreSSL 2.9.0 ensures thread safety
without requiring applications to set locking callbacks and made
related functions no-op.

https://github.com/ruby/openssl/commit/7276233e1a
2021-07-18 17:44:43 +09:00
Kazuki Yamaguchi 88d64418dd [ruby/openssl] ssl: use TLS_method() instead of SSLv23_method() for LibreSSL
LibreSSL 2.2.2 introduced TLS_method(), but with different semantics
from OpenSSL: TLS_method() enabled TLS >= 1.0 while SSLv23_method()
enabled all available versions, which included SSL 3.0 in addition.

However, LibreSSL 2.3.0 removed SSL 3.0 support completely and now
TLS_method() and SSLv23_method() are equivalent.

https://github.com/ruby/openssl/commit/3b7d7045b8
2021-07-18 17:44:43 +09:00
Kazuki Yamaguchi 50332c4071 [ruby/openssl] ssl: call SSL_CTX_set_ecdh_auto() on OpenSSL 1.0.2 only
SSL_CTX_set_ecdh_auto() exists in OpenSSL 1.1.0 and LibreSSL 2.6.1, but
it is made no-op and the automatic curve selection cannot be disabled.
Wrap it with ifdef to make it clear that it is safe to remove it
completely when we drop support for OpenSSL 1.0.2.

https://github.com/ruby/openssl/commit/2ae8f21234
2021-07-18 17:44:42 +09:00
Kazuki Yamaguchi cd002305f0 [ruby/openssl] require OpenSSL >= 1.0.2 and LibreSSL >= 3.1
Clean up old version guards in preparation for the upcoming OpenSSL 3.0
support.

OpenSSL 1.0.1 reached its EOL on 2016-12-31. At that time, we decided
to keep 1.0.1 support because many major Linux distributions were still
shipped with 1.0.1. Now, nearly 4 years later, most Linux distributions
are reaching their EOL and it should be safe to assume nobody uses them
anymore. Major ones that were using 1.0.1:

 - Ubuntu 14.04 is EOL since 2019-04-30
 - RHEL 6 will reach EOL on 2020-11-30

LibreSSL 3.0 and older versions are no longer supported by the LibreSSL
team as of October 2020.

Note that OpenSSL 1.0.2 also reached EOL on 2019-12-31 and 1.1.0 also
did on 2018-08-31.

https://github.com/ruby/openssl/commit/c055938f4b
2021-07-18 17:44:41 +09:00
Kazuki Yamaguchi decce40da7 [ruby/openssl] bn: update documentation of OpenSSL::BN#initialize and #to_s
Clarify that BN.new(str, 2) and bn.to_s(2) handles binary string in
big-endian, and the sign of the bignum is ignored.

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

https://github.com/ruby/openssl/commit/6fae2bd612
2021-07-18 17:44:40 +09:00
Rick Mark 01fcb8f45b [ruby/openssl] BN.abs and BN uplus
Adds standard math abs fuction and revises uplus to return a duplicated object due to BN mutability

https://github.com/ruby/openssl/commit/0321b1e945
2021-07-18 17:44:39 +09:00
Kenta Murata 67897762cf
[ruby/fiddle] Add Fiddle::Handle#file_name (https://github.com/ruby/fiddle/pull/88)
https://github.com/ruby/fiddle/commit/4ee1c6fc4b
2021-07-14 18:56:00 +09:00
Nobuyoshi Nakada 169529a0c0
[ruby/fiddle] Check HAVE_RUBY_MEMORY_VIEW_H rather than API version (https://github.com/ruby/fiddle/pull/86)
https://github.com/ruby/fiddle/commit/c5abcc3a7e
2021-07-14 18:55:59 +09:00
Kenta Murata 818c74b7f4 [ruby/fiddle] Return the module handle value in Fiddle::Handle#to_i and add FIddle::Handle#to_ptr (https://github.com/ruby/fiddle/pull/87)
https://github.com/ruby/fiddle/commit/170111a0cb
2021-07-14 18:43:32 +09:00
Nobuyoshi Nakada cb955dc9ac
[ruby/fiddle] update dependencies 2021-07-13 21:34:28 +09:00
Nobuyoshi Nakada 40d45ab093
[ruby/fiddle] Check HAVE_RUBY_MEMORY_VIEW_H rather than API version
https://github.com/ruby/fiddle/commit/93f9564446
2021-07-13 20:36:45 +09:00
Nobuyoshi Nakada 472d8c5555
[ruby/fiddle] Update required_ruby_version (https://github.com/ruby/fiddle/pull/85)
Drop supports for old versions, keeping 2.5 as CI supports it for
now.

https://github.com/ruby/fiddle/commit/90634e7c55
2021-07-13 19:37:46 +09:00
Sutou Kouhei bb868f4814
[ruby/fiddle] Use have_header and have_type to detect memory view availability
Fix https://github.com/ruby/fiddle/pull/84

It may detect ruby/memory_view.h for system Ruby that is installed in
/usr.

We can use RUBY_API_VERSION_MAJOR to detect memory view availability
because memory view is available since Ruby 3.0.

Reported by Jun Aruga. Thanks!!!

https://github.com/ruby/fiddle/commit/3292929830
2021-07-13 19:37:46 +09:00
Aaron Patterson 5c0d8c6369
[ruby/fiddle] Add "offsetof" to Struct classes (https://github.com/ruby/fiddle/pull/83)
* Add "offsetof" to Struct classes

I need to get the offset of a member inside a struct without allocating
the struct.  This patch adds an "offsetof" class method to structs that
are generated.

The usage is like this:

```ruby
MyStruct = struct [
  "int64_t i",
  "char c",
]

MyStruct.offsetof("i") # => 0
MyStruct.offsetof("c") # => 8
```

* Update test/fiddle/test_c_struct_builder.rb

Co-authored-by: Sutou Kouhei <kou@cozmixng.org>

https://github.com/ruby/fiddle/commit/4e3b60c5b6

Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
2021-07-13 19:37:46 +09:00
Sutou Kouhei a2c9e1b58a
[ruby/fiddle] Bump version
https://github.com/ruby/fiddle/commit/049138b4b8
2021-07-13 19:37:46 +09:00
Sutou Kouhei 70b0318646
[ruby/fiddle] MemoryView: ensure reset rb_memory_view_t::obj on error
https://github.com/ruby/fiddle/commit/0ed39345fe
2021-07-13 19:37:46 +09:00
Sutou Kouhei 9f86e50e1e
[ruby/fiddle] StringValuePtr may change the val
https://github.com/ruby/fiddle/commit/bddca7c895
2021-07-13 19:37:45 +09:00
Sutou Kouhei 10e26cfa76
[ruby/fiddle] Add MemoryView.export and MemoryView#release (https://github.com/ruby/fiddle/pull/80)
fix https://github.com/ruby/fiddle/pull/79

Users can release memory views explicitly before process exit.

Reported by xtkoba. Thanks!!!

https://github.com/ruby/fiddle/commit/1de64b7e76
2021-07-13 19:37:45 +09:00
Sutou Kouhei 9988f6ac4e
[ruby/fiddle] Add Fiddle::MemoryView#to_s (https://github.com/ruby/fiddle/pull/78)
Fix https://github.com/ruby/fiddle/pull/74

Reported by dsisnero. Thanks!!!
2021-07-13 19:37:45 +09:00
Sutou Kouhei d1eeb9fec9
[ruby/fiddle] windows: use GetLastError() for win32_last_error
Ruby: [Bug #11579]

Patch by cremno phobia. Thanks!!!

https://github.com/ruby/fiddle/commit/760a8f9b14
2021-07-13 19:37:45 +09:00
Sutou Kouhei c0f9191ab6
[ruby/fiddle] Bump version
https://github.com/ruby/fiddle/commit/3784cfeec4
2021-07-13 19:37:44 +09:00
Samuel Williams 028441d22f Avoid calling `fstat` on things we already know are valid sockets. 2021-07-12 19:16:22 +12:00
Nobuyoshi Nakada c2ed5ab08b [ruby/date] Fixed markups for bold [ci skip]
https://github.com/ruby/date/commit/404f9d2096
2021-07-11 20:28:23 +09:00
Jeremy Evans 8065670cfb [ruby/date] Fix comparison with Float::INFINITY
Fixes [Bug #17945]

https://github.com/ruby/date/commit/953d907238
2021-07-11 20:28:21 +09:00
Nobuyoshi Nakada fbe9b691bd
Added missing declarations in readline.h bundled with macOS 10.13 2021-07-09 08:52:35 +09:00
Nobuyoshi Nakada 771f6dd75d
[ruby/stringio] Suppress a sign-compare warning
https://github.com/ruby/stringio/commit/a88c070e0b
2021-07-08 16:43:22 +09:00
Nobuyoshi Nakada eecc4570cd
Found library is not usable if the header is not found 2021-07-06 01:17:38 +09:00
Nobuyoshi Nakada 1dfe75b0be
Fixed 'maybe_unused' attribute
```
../../../src/ext/bigdecimal/bigdecimal.c:303:5: error: 'maybe_unused' attribute cannot be applied to types
    ENTER(1);
    ^
```
2021-07-06 01:13:54 +09:00
Nobuyoshi Nakada 6d8422659a
Fix linking bundled zlib
* Prefix "./" to the import library name to expanded when static
  linking exts.

* Copy zlib shared library to the top build directory.
2021-07-03 12:52:46 +09:00
Samuel Williams 5e75280c8e Add basic test for updated IO wait functions. 2021-06-29 23:54:41 +12:00
Nobuyoshi Nakada 391abc543c
Scan the coderange in the given encoding 2021-06-26 16:05:15 +09:00
Nobuyoshi Nakada fd7023a87e
Convert ssize_t properly 2021-06-23 10:09:25 +09:00
Samuel Williams 45e65f302b Deprecate and rework old (fd) centric functions. 2021-06-22 22:48:57 +12:00
Samuel Williams 3deb5d7113 Direct io for accept, send, sendmsg, recvfrom, and related methods. 2021-06-22 22:17:53 +12:00
aycabta 6a48f62c51 [ruby/readline-ext] Version 0.1.2
https://github.com/ruby/readline-ext/commit/8541aaccb5
2021-06-22 11:06:00 +09:00
Nobuyoshi Nakada 626427c2e0
Removed no longer used variables 2021-06-14 14:11:38 +09:00
Samuel Williams 2792acc8f2
Add scheduler hook `Addrinfo.getaddrinfo`. (#4375)
Co-authored-by: Bruno Sutic <code@brunosutic.com>
2021-06-14 16:21:08 +12:00
Nobuyoshi Nakada 32b18fe9d0
Suppress array-parameter warnings by gcc 11 2021-06-13 15:12:45 +09:00
Nobuyoshi Nakada 122ce52e8f
Check if alternative malloc header can work in C++
jemalloc (5.2.1 at least) cannot compile in C++ on macOS SDK, due
to conflicts on exception specification.
2021-06-13 15:12:45 +09:00
Hiroshi SHIBATA 85b94144f2
[ruby/psych] Bump version to 4.0.1
https://github.com/ruby/psych/commit/4049939006
2021-06-07 19:15:14 +09:00
Jean Boussier fd6225c7a9
[ruby/psych] Implement YAML.safe_dump to make safe_load more usable.
In case where Psych is used as a two way serializers,
e.g. to serialize some cache or config, it is preferable
to have the same restrictions on both load and dump.

Otherwise you might dump and persist some objects payloads
that you later won't be able to read.

https://github.com/ruby/psych/commit/441958396f
2021-06-07 19:15:14 +09:00
Yusuke Endoh 430883158f
[ruby/psych] Make YAML.load_file use YAML.load instead of safe_load
YAML.load and YAML.safe_load are different a little; the former allows
Symbol by default but the latter doesn't. So YAML.load_file and
YAML.safe_load_file should reflect the difference.

Fixes #490

https://github.com/ruby/psych/commit/f8a5e512a1
2021-06-07 19:15:14 +09:00
Daisuke Fujimura (fd0) e451f0f678 Fix `_MSC_VER` warnings 2021-06-03 00:07:25 +09:00
Hiroshi SHIBATA edcc29dcff Removed gdbm from ruby repo 2021-05-25 20:04:54 +09:00
Hiroshi SHIBATA 55cd3e4ebf Removed dbm from ruby repo 2021-05-25 15:18:31 +09:00
Nobuyoshi Nakada 1d170fdc6d
ext/json/parser/parser.h: Add fallback MAYBE_UNUSED
e2ad91fc20
2021-05-19 10:16:22 +09:00
Nobuyoshi Nakada 7c716b686c
ext/json/parser/prereq.mk: fix warnings for code generated by ragel
* type-limits when plain-char is unsigned
* unused-const-variable for NFA constants
2021-05-18 23:26:03 +09:00
Sutou Kouhei 79717f81f8 [ruby/fiddle] windows: link to ws2_32 for WSAGetLastError()
https://github.com/ruby/fiddle/commit/e9955d74ae
2021-05-18 12:48:40 +09:00
Sutou Kouhei 71d4a493b8 [ruby/fiddle] windows: add Fiddle.win32_last_socket_error{,=}
GitHub: fix GH-72

Users can't use WSAGetLastError() with Ruby 3.0 or later because
rb_funcall() resets the last socket error internally.

Users can get the last socket error by Fiddle.win32_last_socket_error.

Reported by Kentaro Hayashi. Thanks!!!

https://github.com/ruby/fiddle/commit/76158db00a
2021-05-18 12:48:40 +09:00
Sutou Kouhei ab5212b3c9 [ruby/fiddle] Add support for "const" in type
GitHub: fix #68

Reported by kojix2. Thanks!!!

https://github.com/ruby/fiddle/commit/d7322c234a
2021-05-18 12:48:40 +09:00
Sutou Kouhei 4d1bb460f6 [ruby/fiddle] Add --enable-debug-build option to extconf.rb
https://github.com/ruby/fiddle/commit/e0498e60ea
2021-05-18 12:48:40 +09:00
Sutou Kouhei 791e8eec66 [ruby/fiddle] win32types: sort
https://github.com/ruby/fiddle/commit/35dec6c5a5
2021-05-18 12:48:40 +09:00
Sutou Kouhei 8758b07b1e [ruby/fiddle] Fix more Win32Types definitions
https://docs.microsoft.com/en-us/windows/win32/winprog/windows-data-types

https://github.com/ruby/fiddle/commit/805c1a595a
2021-05-18 12:48:40 +09:00
Orgad Shaneh 25e56fe374 [ruby/fiddle] Fix Win32Types for Windows 64-bit (#63)
https://docs.microsoft.com/en-us/windows/win32/winprog/windows-data-types

https://github.com/ruby/fiddle/commit/28ee5b1608
2021-05-18 12:48:40 +09:00
Sutou Kouhei 8d63b1dc75 [ruby/fiddle] Bump version
https://github.com/ruby/fiddle/commit/0cbd370fd6
2021-05-18 12:48:40 +09:00
Sutou Kouhei 881b2dc898 [ruby/fiddle] closure: add support for const char *
GitHub: fix GH-62

Reported by Cody Krieger. Thanks!!!

https://github.com/ruby/fiddle/commit/284b820f2d
2021-05-18 12:48:40 +09:00
Sutou Kouhei b2de5999d8 [ruby/fiddle] closure: accept symbol as type
https://github.com/ruby/fiddle/commit/dc2da6633e
2021-05-18 12:48:40 +09:00
Sutou Kouhei 212d836cd7 [ruby/fiddle] Remove wrong comment
https://github.com/ruby/fiddle/commit/831522e768
2021-05-18 12:48:40 +09:00
Kenta Murata 7bd3d6d23e [ruby/fiddle] Bump version
https://github.com/ruby/fiddle/commit/63e5f98412
2021-05-18 12:48:40 +09:00
Hiroshi SHIBATA ee611341c9
Bump version of required_ruby_version to 2.3. Fixes #464 2021-05-17 19:51:51 +09:00
Jean Boussier 2de594ca98
[flori/json] Deduplicate strings inside json_string_unescape
[ci 2]

https://github.com/flori/json/commit/1982070cb8
2021-05-17 19:51:51 +09:00
Jean Boussier 1d2b4ccaf2
[flori/json] Refactor json_string_unescape
https://github.com/flori/json/commit/f398769332
2021-05-17 19:51:50 +09:00
Masafumi Koba 8a974dc83c [flori/json] Fix incorrect `#` position in API doc
This change fixes an incorrect `#` position in the API documentation of the `JSON` module.

https://github.com/flori/json/commit/dc4b62424f
2021-05-17 19:26:03 +09:00
Aaron Patterson 42b20bdbfe
[ruby/psych] remove deprecated interface
https://github.com/ruby/psych/commit/0767227051
2021-05-17 11:20:46 +09:00
Aaron Patterson b0e21197ce
[ruby/psych] Bump version
https://github.com/ruby/psych/commit/1df86a2e81
2021-05-17 11:20:46 +09:00
Aaron Patterson fbb4e3f96c
[ruby/psych] Use Psych.safe_load by default
Psych.load is not safe for use with untrusted data.  Too many
applications make the mistake of using `Psych.load` with untrusted data
and that ends up with some kind of security vulnerability.

This commit changes the default `Psych.load` to use `safe_load`.  Users
that want to parse trusted data can use Psych.unsafe_load.

https://github.com/ruby/psych/commit/176494297f
2021-05-17 11:20:45 +09:00
Aaron Patterson c7c2ad5749
[ruby/psych] Introduce `Psych.unsafe_load`
In future versions of Psych, the `load` method will be mostly the same
as the `safe_load` method.  In other words, the `load` method won't
allow arbitrary object deserialization (which can be used to escalate to
an RCE).  People that need to load *trusted* documents can use the
`unsafe_load` method.

This commit introduces the `unsafe_load` method so that people can
incrementally upgrade.  For example, if they try to upgrade to 4.0.0 and
something breaks, they can downgrade, audit callsites, change to
`safe_load` or `unsafe_load` as required, and then upgrade to 4.0.0
smoothly.

https://github.com/ruby/psych/commit/cb50aa8d3f
2021-05-17 11:20:45 +09:00
Jean Boussier a3ceed50b8
[ruby/psych] Fix symabolize_name with non-string keys
https://github.com/ruby/psych/commit/1c5c29e81f
2021-05-17 11:20:45 +09:00
Jeremy Ebler 830778db95
[ruby/psych] feat: allow scalars and sequences to be styled when dumped
https://github.com/ruby/psych/commit/546154ddb7
2021-05-17 11:20:45 +09:00
Yusuke Endoh f691c15792 ext/objspace/lib/objspace/trace.rb: Remove the original Kernel#p
... to disable a "method redefined" warning.

http://rubyci.s3.amazonaws.com/solaris11-gcc/ruby-master/log/20210514T050008Z.fail.html.gz
```
  1) Failure:
TestObjSpace#test_objspace_trace [/export/home/chkbuild/chkbuild-gcc/tmp/build/20210514T050008Z/ruby/test/objspace/test_objspace.rb:621]:
<["objspace/trace is enabled"]> expected but was
<["/export/home/chkbuild/chkbuild-gcc/tmp/build/20210514T050008Z/ruby/.ext/common/objspace/trace.rb:29: warning: method redefined; discarding old p",
 "objspace/trace is enabled"]>.
```
2021-05-14 15:39:57 +09:00
Yusuke Endoh cf1e1879f1 ext/objspace/lib/objspace/trace.rb: Added
This file, when require'ed, starts tracing the object allocations, and
redefines `Kernel#p` to show the allocation site.

This commit is experimental; the library name and APIs may change.

[Feature #17762]
2021-05-14 13:40:32 +09:00
Ryuta Kamizono 73136ebbde
[ruby/psych] Fix some typos [ci skip]
https://github.com/ruby/psych/commit/98617e55a1
2021-05-10 19:19:35 +09:00
Aaron Patterson b7250026dd
[ruby/psych] bump version
https://github.com/ruby/psych/commit/091cd46b1f
2021-05-10 19:19:35 +09:00
Tim Gates 954970162c
[ruby/psych] docs: fix simple typo, expessed -> expressed
There is a small typo in ext/psych/yaml/yaml.h.

Should read `expressed` rather than `expessed`.

https://github.com/ruby/psych/commit/1150d669cb
2021-05-10 19:19:35 +09:00
Charles Oliver Nutter 1563de5997
[ruby/psych] Update to latest SnakeYAML
Fixes jruby/jruby#6365

https://github.com/ruby/psych/commit/a88ff77f02
2021-05-10 19:19:35 +09:00
Jean Boussier c110ade0d2
[ruby/psych] Fix custom marshalization with symbolize_names: true
https://github.com/ruby/psych/commit/ee26f26ab5
2021-05-10 19:17:32 +09:00
Jean Boussier 155cd7fd2a
[ruby/psych] Cache dispatch cache in an instance variable
https://github.com/ruby/psych/commit/285c461cd2
2021-05-10 19:17:32 +09:00
Jean Boussier 3ab41acd36
[ruby/psych] Cache access to Psych.load_tags in Visitor::ToRuby
https://github.com/ruby/psych/commit/58223f0426
2021-05-10 19:17:32 +09:00
Matt Valentine-House 8bbd319806 Allow newobj_of0 and newobj_slowpath to allocate into multiple heap slots 2021-05-06 09:18:17 -04:00
Gannon McGibbon a42b7de436 [ruby/strscan] Replace "iff" with "if and only if" (#18)
iff means if and only if, but readers without that knowledge might
assume this to be a spelling mistake. To me, this seems like
exclusionary language that is unnecessary. Simply using "if and only if"
instead should suffice.

https://github.com/ruby/strscan/commit/066451c11e
2021-05-06 16:21:14 +09:00
Kenichi Kamiya 564ccd095a [ruby/strscan] Fix segmentation fault of `StringScanner#charpos` when `String#byteslice` returns non string value [Bug #17756] (#20)
https://github.com/ruby/strscan/commit/92961cde2b
2021-05-06 16:20:38 +09:00
Hiroshi SHIBATA 822eb94563
Import from https://github.com/ruby/strscan/pull/19
* Use Gemfile instead of Gem::Specification#add_development_dependency.

* Use pend instead of skip for test-unit.
2021-05-06 16:18:58 +09:00
Benoit Daloze 0764d323d8 Fix -Wundef warnings for patterns `#if HAVE`
* See [Feature #17752]
* Using this to detect them:
  git grep -P 'if\s+HAVE' | grep -Pv 'HAVE_LONG_LONG|/ChangeLog|HAVE_TYPEOF'
2021-05-04 14:56:55 +02:00
Benoit Daloze fa7a712d46 Fix -Wundef warnings for HAVE_RB_EXT_RACTOR_SAFE
* See [Feature #17752]
2021-05-04 14:56:55 +02:00
Benoit Daloze 59a92a84c8 Fix -Wundef warnings in core extensions
* See [Feature #17752]
2021-05-04 14:56:55 +02:00
Nobuyoshi Nakada 96fd1e1f22
Removed unused macro HAVE_CONFIG_H
It seems like a vestige of ext/md5.
2021-04-28 18:48:08 +09:00
Nobuyoshi Nakada 795fb51f80
NDEBUG is ignored since Ruby 3.0 2021-04-28 18:48:08 +09:00
Benoit Daloze 3a3b19b2bb Fix Monitor to lock per Fiber, like Mutex [Bug #17827] 2021-04-27 18:42:50 +02:00
Lars Kanis 22d36c463f [ruby/gdbm] Add dependency to gdbm package on mingw
RubyInstaller2 supports metadata tags for installation of dependent
MSYS2/MINGW libraries. The openssl gem requires the mingw-openssl
package to be installed on the system, which the gem installer takes
care about, when this tag is set.

The feature is documented here:
https://github.com/oneclick/rubyinstaller2/wiki/For-gem-developers#msys2-library-dependency

Fixes https://github.com/oneclick/rubyinstaller2/issues/163

https://github.com/ruby/gdbm/commit/d95eed3e86
2021-04-27 20:54:07 +09:00
Olle Jonsson ad3f4c07d9 [ruby/pathname] gemspec: Explicitly list 0 executables
This gem exposes no executables.

https://github.com/ruby/pathname/commit/c401d97d58
2021-04-27 20:52:48 +09:00
Peter Zhu 4f88acc833 Fix compiler warnings in objspace_dump.c when assertions are turned on
Example:

```
In file included from ../../../include/ruby/defines.h:72,
                 from ../../../include/ruby/ruby.h:23,
                 from ../../../gc.h:3,
                 from ../../../ext/objspace/objspace_dump.c:15:
../../../ext/objspace/objspace_dump.c: In function ‘dump_append_ld’:
../../../ext/objspace/objspace_dump.c:95:26: warning: comparison of integer expressions of different signedness: ‘long unsigned int’ and ‘int’ [-Wsign-compare]
   95 |     RUBY_ASSERT(required <= width);
      |                          ^~
```
2021-04-26 19:26:50 -04:00
Ryuta Kamizono 33f2ff3bab Fix some typos by spell checker 2021-04-26 10:07:41 +09:00
wonda-tea-coffee f9b62b5cc0 [Doc] Fix a typo s/algorthm/algorithm/ 2021-04-25 10:52:29 -04:00
wonda-tea-coffee ca5816e275 [ci skip] Fix a typo s/certificiate/certificate/ 2021-04-25 10:51:45 -04:00
wonda-tea-coffee 04e6383f40 [Doc] Fix a typo s/daguten/dakuten/ 2021-04-25 10:51:23 -04:00
wonda-tea-coffee 532c775e22 [Doc] Fix a typo s/arround/around/ 2021-04-25 10:50:12 -04:00
Charles Oliver Nutter 270b16e70c
[ruby/io-console] Move FFI console under lib
Having the separate dir makes testing difficult and doesn't
reflect the structure the gem will eventually have. We can filter
these files out if necessary when building the CRuby gem.

https://github.com/ruby/io-console/commit/881010447c
2021-04-22 11:53:13 +09:00
Duncan MacGregor 042860bd65
[ruby/io-console] Enable building the C extension on TruffleRuby.
https://github.com/ruby/io-console/commit/c17b8cf3a9
2021-04-22 11:51:37 +09:00
Olle Jonsson 4ac72d37d7 [ruby/io-wait] gemspec: Explicitly list 0 executables
This gem exposes no executables, and this clarifies this.

https://github.com/ruby/io-wait/commit/f491c6cc64
2021-04-21 20:38:00 +09:00
Olle Jonsson 59411b0b36
[ruby/zlib] gemspec: Remove unused files
Remove the list of executables.

https://github.com/ruby/zlib/commit/6a70725b8e
2021-04-20 21:19:41 +09:00
Olle Jonsson 749aad280f
[ruby/gdbm] gemspec: Set executables to the empty list
This gem exposes zero executables.

https://github.com/ruby/gdbm/commit/d51cf47f65
2021-04-20 21:19:41 +09:00
Olle Jonsson cc8d0e7cbf
[ruby/dbm] gemspec: add README & LICENSE
https://github.com/ruby/dbm/commit/c86b94b781
2021-04-20 21:19:41 +09:00
Hiroshi SHIBATA 3fdc58c08b
[ruby/date] Bump version to 3.1.1
https://github.com/ruby/date/commit/e574cc9048
2021-04-20 20:46:03 +09:00
卜部昌平 6413dc27dc dependency updates 2021-04-13 14:30:21 +09:00
Tom Stuart 8b2f2a707d [ruby/openssl] Use #ifdef consistently for HAVE_RB_EXT_RACTOR_SAFE
We previously used a mix of both `#if` and `#ifdef`, but the latter is
more reliable because it will still work if the macro is undefined.

https://github.com/ruby/openssl/commit/e4a622e67e
2021-03-31 18:05:08 +09:00
Tom Stuart 5ab2625243 [ruby/openssl] Fix OpenSSL::Engine build on Debian
On Debian 9 (“stretch”) the `OPENSSL_NO_STATIC_ENGINE` macro is not
defined, which causes all the `#if HAVE_ENGINE_LOAD_…` directives to
fail with `error: 'HAVE_ENGINE_LOAD_…' is not defined, evaluates to 0
[-Werror,-Wundef]` while building TruffleRuby.

We can accomplish the same thing with `#ifdef`, which (of course) works
fine when the `HAVE_ENGINE_LOAD…` macros are also undefined.

Upstreamed from oracle/truffleruby#2255, which fixed
oracle/truffleruby#2254.

https://github.com/ruby/openssl/commit/65e2adf1ac
2021-03-31 18:05:08 +09:00
Kazuki Yamaguchi e2bf3659e1 [ruby/openssl] pkcs7: keep private key when duplicating PKCS7_SIGNER_INFO
ASN1_dup() will not copy the 'pkey' field of a PKCS7_SIGNER_INFO object
by design; it is a temporary field kept until the PKCS7 structure is
finalized. Let's bump reference counter of the pkey in the original
object and use it in the new object, too.

This commit also removes PKCS7#add_signer's routine to add the
content-type attribute as a signed attribute automatically. This
behavior was not documented or tested. This change should not break any
working user code since the method was completely useless without the
change above.

https://github.com/ruby/openssl/commit/20ca7a27a8
2021-03-31 18:05:07 +09:00
aycabta 66d2fc7989 Enclose the code that was accidentally a link in "tt" 2021-03-31 15:18:52 +09:00
Nobuyoshi Nakada 94d564077c
Text files should end with a newline 2021-03-30 23:41:21 +09:00
Nobuyoshi Nakada 989e22f394
[ruby/io-console] bump up to 0.5.9
https://github.com/ruby/io-console/commit/302e86a28c
https://github.com/ruby/io-console/commit/0690862526
2021-03-28 23:42:38 +09:00
Kenichi Kamiya 9af57eeed6
[ruby/pathname] Fix segfault of Pathname#split
Fix segmentation fault of Pathname#split when File.split returns
non array value [Bug #17755]

https://github.com/ruby/pathname/commit/e29b49e3b1
https://github.com/ruby/pathname/commit/1db7479a74
2021-03-28 14:04:10 +09:00
Jean Boussier 7e8a9af9db rb_enc_interned_str: handle autoloaded encodings
If called with an autoloaded encoding that was not yet
initialized, `rb_enc_interned_str` would crash with
a NULL pointer exception.

See: https://github.com/ruby/ruby/pull/4119#issuecomment-800189841
2021-03-22 21:37:48 +09:00
Nobuyoshi Nakada 3260602fa3
Adjusted indents [ci skip] 2021-03-17 09:49:17 +09:00
Sorah Fukumori cf831f4918
zlib: fix Gzip{Writer,Reader}.new fails with a O_TMPFILE file 2021-03-17 02:16:27 +09:00
Kazuki Yamaguchi 1eb6d8aa63 [ruby/openssl] bn: check -1 return from BIGNUM functions
Although the manpage says that BIGNUM functions return 0 on error,
OpenSSL versions before 1.0.2n and current LibreSSL versions may return
-1 instead.

Note that the implementation of OpenSSL::BN#mod_inverse is extracted
from BIGNUM_2c() macro as it didn't really share the same function
signature with others.

https://github.com/ruby/openssl/commit/9b59f34345
2021-03-16 19:37:06 +09:00
Nobuyoshi Nakada 1ad2224773 [ruby/openssl] Fixed the results of OpenSSL::Timestamp::Response#failure_info
Made stored values `Symbol`s instead of `ID`s.

Fixes https://bugs.ruby-lang.org/issues/17625

Co-Authored-By: xtkoba (Tee KOBAYASHI) <xtkoba+ruby@gmail.com>

https://github.com/ruby/openssl/commit/f2d004679a
2021-03-16 19:37:06 +09:00
Jeremy Evans e2ce383044 [ruby/openssl] Enhance TLS 1.3 support on LibreSSL 3.2/3.3
This defines TLS1_3_VERSION when using LibreSSL 3.2+.  LibreSSL 3.2/3.3
doesn't advertise this by default, even though it will use TLS 1.3
in both client and server modes.

Changes between LibreSSL 3.1 and 3.2/3.3 broke a few tests, Defining
TLS1_3_VERSION by itself fixes 1 test failure.  A few tests now
fail on LibreSSL 3.2/3.3 unless TLS 1.2 is set as the maximum version,
and this adjusts those tests.  The client CA test doesn't work in
LibreSSL 3.2+, so I've marked that as pending.

For the hostname verification, LibreSSL 3.2.2+ has a new stricter
hostname verifier that doesn't like subjectAltName such as
c*.example.com and d.*.example.com, so adjust the related tests.

With these changes, the tests pass on LibreSSL 3.2/3.3.

https://github.com/ruby/openssl/commit/a0e98d48c9
2021-03-16 19:37:06 +09:00
Kazuki Yamaguchi 4756ac00b7 [ruby/openssl] pkey/ec: remove OpenSSL::PKey::EC::Group.new(ec_method) form
The form created an empty EC_GROUP object with the specified EC_METHOD.
However, the feature was unfinished and not useful in any way because
OpenSSL::PKey::EC::Group did not implement wrappers for necessary
functions to set actual parameters for the group, namely
EC_GROUP_set_curve() family.

EC_GROUP object creation with EC_METHOD explicitly specified is
deprecated in OpenSSL 3.0, as it was apparently not intended for use
outside OpenSSL.

It is still possible to create EC_GROUP, but without EC_METHOD
explicitly specified - OpenSSL chooses the appropriate EC_METHOD for
the curve type. The OpenSSL::PKey::EC::Group.new(<:GFp|:GF2m>, p, a, b)
form will continue to work.

https://github.com/ruby/openssl/commit/df4bec841f
2021-03-16 19:16:11 +09:00
Kazuki Yamaguchi d47210b113 [ruby/openssl] ssl: remove SSL::SSLContext#tmp_ecdh_callback
The underlying API SSL_CTX_set_tmp_ecdh_callback() was removed by
LibreSSL >= 2.6.1 and OpenSSL >= 1.1.0, in other words, it is not
supported by any non-EOL versions of OpenSSL.

The wrapper was initially implemented in Ruby 2.3 and has been
deprecated since Ruby/OpenSSL 2.0 (bundled with Ruby 2.4) with explicit
warning with rb_warn().

https://github.com/ruby/openssl/commit/ee037e1460
2021-03-16 19:16:11 +09:00
Kazuki Yamaguchi 945ed40862 [ruby/openssl] ssl: retry write on EPROTOTYPE on macOS
Errno::EPROTOTYPE is not supposed to be raised by SSLSocket#write.
However, on macOS, send(2) which is called via SSL_write() can
occasionally return EPROTOTYPE. Retry SSL_write() so that we get a
proper error, just as ext/socket does.

Reference: https://bugs.ruby-lang.org/issues/14713
Reference: https://github.com/ruby/openssl/issues/227

https://github.com/ruby/openssl/commit/2e700c80bf
2021-03-16 19:16:11 +09:00
Kazuki Yamaguchi c46b1f0bec [ruby/openssl] x509store: update rdoc for X509::Store and X509::StoreContext
Add more details about each method, and add reference to OpenSSL man
pages.

https://github.com/ruby/openssl/commit/02b6f82c73
2021-03-16 19:16:11 +09:00
Kazuki Yamaguchi 62d889c857 [ruby/openssl] x509store: fix memory leak in X509::StoreContext.new
The certificate passed as the second argument was not properly free'd
in the error paths.

https://github.com/ruby/openssl/commit/9561199b9f
2021-03-16 19:16:11 +09:00
Kazuki Yamaguchi 871c61d5d0 [ruby/openssl] x509store: avoid ossl_raise() calls with NULL message
Use the OpenSSL function name that caused the error to generate a better
error message.

https://github.com/ruby/openssl/commit/b31809ba3d
2021-03-16 19:16:11 +09:00
Kazuki Yamaguchi be3ba2ee4d [ruby/openssl] x509store: refactor X509::StoreContext#chain
Use ossl_x509_sk2ary() to create an array of OpenSSL::X509::Certificate
from STACK_OF(X509).

https://github.com/ruby/openssl/commit/fa1da69f92
2021-03-16 19:16:11 +09:00
Kazuki Yamaguchi 08c99a4208 [ruby/openssl] x509store: emit warning if arguments are given to X509::Store.new
Anything passed to OpenSSL::X509::Store.new was always ignored. Let's
emit an explicit warning to not confuse users.

https://github.com/ruby/openssl/commit/d173700eeb
2021-03-16 19:16:11 +09:00
Kazuki Yamaguchi 88b8b3ac15 [ruby/openssl] x509store: let X509::Store#add_file raise TypeError if nil is given
Undo special treatment of nil and simply pass the value to
StringValueCStr().

nil was never a valid argument for the method; OpenSSL::X509::StoreError
with an unhelpful error message "system lib" was raised in that case.

https://github.com/ruby/openssl/commit/fb2fcbb137
2021-03-16 19:16:11 +09:00
Nobuhiro IMAI 92f19f7bb0 [ruby/openssl] [DOC] Fix RDoc markup
https://github.com/ruby/openssl/commit/f36af95519
2021-03-16 19:16:11 +09:00
Claus Lensbøl be1e88a277 [ruby/openssl] Fix typo in documentation
The socket is called ssl_connection, not connection

https://github.com/ruby/openssl/commit/642783aeda
2021-03-16 19:16:11 +09:00
Kazuki Yamaguchi 81325db5f8 [ruby/openssl] ssl: initialize verify_mode and verify_hostname with default values
SSLContext's verify_mode expects an SSL_VERIFY_* constant (an integer)
and verify_hostname expects either true or false. However, they are set
to nil after calling OpenSSL::SSL::SSLContext.new, which is surprising.

Set a proper value to them by default: verify_mode is set to
OpenSSL::SSL::VERIFY_NONE and verify_hostname is set to false by
default.

Note that this does not change the default behavior. The certificate
verification was never performed unless verify_mode is set to
OpenSSL::SSL::VERIFY_PEER by a user. The same applies to
verify_hostname.

https://github.com/ruby/openssl/commit/87d869352c
2021-03-16 19:16:11 +09:00
Colton Jenkins c71afc9db7 [ruby/openssl] Add compare? method to OpenSSL::PKey that wraps EVP_PKEY_cmp.
Explicitly check for type given some conflicting statements within openssl's
documentation around EVP_PKEY_cmp and EVP_PKEY_ASN1_METHOD(3).
Add documentation with an example for compare?

https://github.com/ruby/openssl/commit/0bf51da6e2
2021-03-16 19:16:11 +09:00
Bart de Water da6341b709 [ruby/openssl] User lower case cipher names for maximum compatibility
We ran into some Linux-based systems not accepting the upper case variant

https://github.com/ruby/openssl/commit/7bc49121d5
2021-03-16 19:16:11 +09:00
Kazuki Yamaguchi 13198d4968 [ruby/openssl] hmac: implement base64digest methods
OpenSSL::HMAC implements the similar interface as ::Digest. Let's add
base64digest methods to OpenSSL::HMAC, too, for feature parity.

https://github.com/ruby/openssl/commit/098bcb68af
2021-03-16 19:16:11 +09:00
Kazuki Yamaguchi b91f62f384 [ruby/openssl] hmac: migrate from the low-level HMAC API to the EVP API
Use the EVP API instead of the low-level HMAC API. Use of the HMAC API
has been discouraged and is being marked as deprecated starting from
OpenSSL 3.0.0.

The two singleton methods OpenSSL::HMAC, HMAC.digest and HMAC.hexdigest
are now in lib/openssl/hmac.rb.

https://github.com/ruby/openssl/commit/0317e2fc02
2021-03-16 19:16:11 +09:00
Kazuki Yamaguchi fde9f806cb [ruby/openssl] pkey/ec: deprecate OpenSSL::PKey::EC::Point#mul(ary, ary [, bn])
Deprecate it for future removal. However, I do not expect any
application is affected by this.

The other form of calling it, PKey::EC::Point#mul(bn [, bn]) remains
untouched.

PKey::EC::Point#mul calls EC_POINTs_mul(3) when multiple BNs
are given as an array. LibreSSL 2.8.0 released on 2018-08 removed the
feature and OpenSSL 3.0 which is planned to be released in 2020 will
also deprecate the function as there is no real use-case.

https://github.com/ruby/openssl/commit/812de4253d
2021-03-16 19:16:11 +09:00
Kazuki Yamaguchi 15863069c9 [ruby/openssl] digest, hmac, ts, x509: use IO.binread in examples where appropriate
IO.read may mangle line separator, which will corrupt binary data
including DER-encoded X.509 certificates and such.

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

https://github.com/ruby/openssl/commit/93213b2730
2021-03-16 19:16:11 +09:00
Kazuki Yamaguchi 9d3ffe09c4 [ruby/openssl] pkey: reimplement PKey::DH#compute_key and PKey::EC#dh_compute_key
Use the new OpenSSL::PKey::PKey#derive instead of the raw
{EC,}DH_compute_key(), mainly to reduce amount of the C code.

https://github.com/ruby/openssl/commit/28edf6bafc
2021-03-16 19:16:11 +09:00
Kazuki Yamaguchi fbadb01d6e [ruby/openssl] pkey: add PKey::PKey#derive
Add OpenSSL::PKey::PKey#derive as the wrapper for EVP_PKEY_CTX_derive().
This is useful for pkey types that we don't have dedicated classes, such
as X25519.

https://github.com/ruby/openssl/commit/28f0059bea
2021-03-16 19:16:11 +09:00
Kazuki Yamaguchi b2dc4880f5 [ruby/openssl] pkey: support 'one-shot' signing and verification
OpenSSL 1.1.1 added EVP_DigestSign() and EVP_DigestVerify() functions
to the interface. Some EVP_PKEY methods such as PureEdDSA algorithms
do not support the streaming mechanism and require us to use them.

https://github.com/ruby/openssl/commit/ae19454592
2021-03-16 19:16:11 +09:00
Kazuki Yamaguchi 5cae289682 [ruby/openssl] pkey: port PKey::PKey#sign and #verify to the EVP_Digest* interface
Use EVP_DigestSign*() and EVP_DigestVerify*() interface instead of the
old EVP_Sign*() and EVP_Verify*() functions. They were added in OpenSSL
1.0.0.

Also, allow the digest to be specified as nil, as certain EVP_PKEY types
don't expect a digest algorithm.

https://github.com/ruby/openssl/commit/9ff6e5143b
2021-03-16 19:16:11 +09:00
Kazuki Yamaguchi 1e3590fe22 [ruby/openssl] pkey: add PKey.generate_parameters and .generate_key
Add two methods to create a PKey using the generic EVP interface. This
is useful for the PKey types we don't have a dedicated class.

https://github.com/ruby/openssl/commit/d8e8e57de9
2021-03-16 19:16:11 +09:00
Kazuki Yamaguchi 498c8e8f17 [ruby/openssl] pkey: assume generic PKeys contain private components
The EVP interface cannot tell whether if a pkey contains the private
components or not. Assume it does if it does not respond to #private?.
This fixes the NoMethodError on calling #sign on a generic PKey.

https://github.com/ruby/openssl/commit/f4c717bcb2
2021-03-16 19:16:11 +09:00
Kazuki Yamaguchi 1f44640677 [ruby/openssl] pkey: refactor #export/#to_pem and #to_der
Add ossl_pkey_export_traditional() and ossl_pkey_export_spki() helper
functions, and use them. This reduces code duplication.

https://github.com/ruby/openssl/commit/56f0d34d63
2021-03-16 19:16:10 +09:00
Kazuki Yamaguchi 707e3d49cb [ruby/openssl] pkey: refactor DER/PEM-encoded string parsing code
Export the flow used by OpenSSL::PKey.read and let the subclasses call
it before attempting other formats.

https://github.com/ruby/openssl/commit/d963d4e276
2021-03-16 19:16:10 +09:00
Kazuki Yamaguchi 10d360847b [ruby/openssl] pkey: prefer PKey.read over PKey::RSA.new in docs
https://github.com/ruby/openssl/commit/cf92a3ffba
2021-03-16 19:16:10 +09:00
Kazuki Yamaguchi efad0166c6 [ruby/openssl] pkey: have PKey.read parse PEM-encoded DHParameter
Try PEM_read_bio_Parameters(). Only PEM format is supported at the
moment since corresponding d2i_* functions are not provided by OpenSSL.

https://github.com/ruby/openssl/commit/867e5c021b
2021-03-16 19:16:10 +09:00
Kazuki Yamaguchi c157f6e787 [ruby/openssl] pkey: inline {rsa,dsa,dh,ec}_instance()
Merge the code into the callers so that the wrapping Ruby object is
allocated before the raw key object is allocated. This prevents possible
memory leak on Ruby object allocation failure, and also reduces the
lines of code.

https://github.com/ruby/openssl/commit/1eb1366615
2021-03-16 19:16:10 +09:00
Kazuki Yamaguchi 27859c09a6 [ruby/openssl] pkey: simplify ossl_pkey_new()
ossl_{rsa,dsa,dh,ec}_new() called from this function are not used
anywhere else. Inline them into pkey_new0() and reduce code
duplication.

https://github.com/ruby/openssl/commit/94aeab2f26
2021-03-16 19:16:10 +09:00
Kazuki Yamaguchi 10289e9f22 [ruby/openssl] config: replace DupConfigPtr() with GetConfig()
Now that OpenSSL::Config wraps a real CONF object, the caller can just
borrow it rather than creating a new temporary CONF object. CONF object
is usually treated as immutable.

DupConfigPtr() is now removed, and GetConfig() is exported instead.

https://github.com/ruby/openssl/commit/d9064190ca
2021-03-16 19:16:10 +09:00
Kazuki Yamaguchi 22aeb6373e [ruby/openssl] config: revert to C implementation of OpenSSL::Config
Revert OpenSSL::Config to using the OpenSSL API and remove our own
parser implementation for the config file syntax.

OpenSSL::Config now wraps a CONF object. Accessor methods deal with the
object directly rather than Ruby-level internal state.

This work is based on the old C code we used before 2010.

https://github.com/ruby/openssl/commit/c891e0ea89
2021-03-16 19:16:10 +09:00
Kazuki Yamaguchi 67f5847c61 [ruby/openssl] config: remove deprecated methods
Remove 4 deprecated methods.

The following two methods have been marked as deprecated since 2003,
by r4531 (ruby.git commit 78ff3833fb).

 - OpenSSL::Config#value
 - OpenSSL::Config#section

Other two methods are removed because the corresponding functions
disappeared in OpenSSL 1.1.0.

 - OpenSSL::Config#add_value
 - OpenSSL::Config#[]=

https://github.com/ruby/openssl/commit/9783d7f21c
2021-03-16 19:16:10 +09:00
Spencer McIntyre 4d8bce227c [ruby/openssl] Define Cipher #ccm_data_len= for CCM mode ciphers
Allow specifying just length to #update

CCM mode ciphers need to specify the total plaintext or ciphertext
length to EVP_CipherUpdate.

Update the link to the tests file

Define Cipher#ccm_data_len= for CCM mode ciphers

Add a unit test for CCM mode

Also check CCM is authenticated when testing

https://github.com/ruby/openssl/commit/bb3816953b
2021-03-16 19:16:10 +09:00
wanabe 0c5f8c6276 [ruby/zlib] Resume zstream if available [Bug #10961] 2021-03-09 13:19:03 +09:00
Nobuyoshi Nakada 32a13591e0
[ruby/stringio] Check if closed in loop
[Bug #17675] https://bugs.ruby-lang.org/issues/17675

https://github.com/ruby/stringio/commit/1ed61d0cbc
2021-03-08 10:13:29 +09:00
Hiroshi SHIBATA 99f54c0895
[ruby/stringio] Use Gemfile instead of Gem::Specification#add_development_dependency.
https://github.com/ruby/stringio/commit/157fe9f04d
2021-03-08 10:12:57 +09:00
Nobuyoshi Nakada f6d5de8f33 [ruby/io-wait] Declare as Ractor-safe
Fixes https://bugs.ruby-lang.org/issues/17659

https://github.com/ruby/io-wait/commit/ba338b4764
2021-03-07 09:54:35 +09:00
Nobuyoshi Nakada ea81fff564 [ruby/io-wait] bump up to 0.1.1
https://github.com/ruby/io-wait/commit/88db082d60
2021-03-07 09:54:35 +09:00
Nobuyoshi Nakada 05d118feea [ruby/io-wait] Fixed required_ruby_version
Before 3.0.0, io-wait has not been gemified.

https://github.com/ruby/io-wait/commit/6fed3da323
2021-03-07 09:54:35 +09:00
Nobuyoshi Nakada 3ba1580d80 [ruby/io-wait] Revise IO#wait arguments
https://github.com/ruby/io-wait/commit/0599f6d4d6
https://github.com/ruby/io-wait/commit/4e982aea1b
https://github.com/ruby/io-wait/commit/5b45685eb3
2021-03-07 09:54:35 +09:00
Aaron Patterson d45466dc5b
Oops! Add another test and fix to_proc implementation 2021-02-26 10:06:56 -08:00
Aaron Patterson 0590e9b677
Fiddle::Function responds to to_proc
This lets us cast a Fiddle::Function to a block, allowing is to write
things like:

```ruby
f = Fiddle::Function.new(@libc['strcpy'], [TYPE_VOIDP, TYPE_VOIDP], TYPE_VOIDP)
define_method :strcpy, &f
```
2021-02-26 09:57:13 -08:00
Shugo Maeda 5de38c41ae
ripper: fix a bug of Ripper::Lexer with syntax error and heredoc [Bug #17644] 2021-02-19 16:40:29 +09:00
Nobuyoshi Nakada 9a5da2dcff [ruby/readline-ext] Initialize libedit before managing the history
Fixes https://bugs.ruby-lang.org/issues/17629

https://github.com/ruby/readline-ext/commit/250d6787ed
2021-02-18 21:18:37 +09:00
Jeremy Evans c03b723f56 Update class documentation for StringScanner
The [] wasn't being displayed, and try to fix formatting for bol?
and << (even if they aren't linked).

Fixes [Bug #17620]
2021-02-10 08:17:07 -08:00
Hiroshi SHIBATA e72757a311 [ruby/zlib] Don't use gemspec for gem dependecy
https://github.com/ruby/zlib/commit/7d3d19710f
2021-02-10 12:49:33 +09:00
Nobuyoshi Nakada 6bb103f012
[ruby/console] Updated depend 2021-02-09 17:49:28 +09:00
Nobuyoshi Nakada 5bfca88f76
[ruby/io-console] Fixed typo 2021-02-09 17:39:00 +09:00
Nobuyoshi Nakada df4f8aa248
[ruby/io-console] Fixed regression against 3.0 2021-02-09 17:38:52 +09:00
Samuel Williams 5f69a7f604
Expose scheduler as public interface & bug fixes. (#3945)
* Rename `rb_scheduler` to `rb_fiber_scheduler`.

* Use public interface if available.

* Use `rb_check_funcall` where possible.

* Don't use `unblock` unless the fiber was non-blocking.
2021-02-09 19:39:56 +13:00
Nobuyoshi Nakada 4186cd6435
Revert a part of "[DOC] refined" [ci skip]
This reverts commit 478716f49a
partially -- "Removed unnecessary parentheses" part -- because of
a lambda, see 9e25eb308d.
2021-02-08 21:46:07 +09:00
Nobuyoshi Nakada 478716f49a
[DOC] refined
* Adjusted indentation in license section, and used "(c)"
* Commented out invalid syntax to enable highlighting
* Removed unnecessary parentheses
2021-02-07 21:24:44 +09:00
Jean Boussier 3a888398a6 objspace_dump.c: tag singleton classes and reference the superclass 2021-02-04 09:53:31 -08:00
Dimitris Zorbas 46b5b51cc6 [DOC] Fix typo in ext/socket/socket.c [ci skip] 2021-02-04 13:29:58 +09:00
Kenta Murata 4e2e1d6093
[ruby/bigdecimal] Fix uint64 conversion
Stop using logarithm to compute the number of components.
Instead, use the theoretical maximum number of components for buffer,
and count up the actual number of components during conversion.

https://github.com/ruby/bigdecimal/commit/9067b353ac
2021-02-04 13:18:58 +09:00
Kenta Murata 868d66e0b5
[ruby/bigdecimal] Stop using rmpd and RMPD prefixes and DBLE_FIG
https://github.com/ruby/bigdecimal/commit/7479923fdb
2021-02-04 13:18:52 +09:00
Kenta Murata 8df1881c8f [ruby/bigdecimal] Fix the maximum length of float number
This change is for preventing the false-positive alert by CoverityScan.
See CID-1471770 for the detail.

https://github.com/ruby/bigdecimal/commit/4d5b97125b
2021-02-03 18:25:03 +09:00
Aaron Patterson 8ef30bcc04
Fix GC compatibility: Don't stash encodings in global constants
This value should either be pinned, or looked up when needed at runtime.
Without pinning, the GC may move the encoding object, and that could
cause a crash.

In this case it is easier to find the value at runtime, and there is no
performance penalty (as Ruby caches encoding indexes).  We can shorten
the code, be compaction friendly, and incur no performance penalty.
2021-02-01 12:20:34 -08:00
Nobuyoshi Nakada 9241211538 Forward keyword arguments for Pathname#each_line [Bug #17589] 2021-01-29 14:27:53 +09:00
Kenta Murata a1bb110b56 [ruby/bigdecimal] [Doc] Fix the comment of BigDecimal_div2 [ci skip]
https://github.com/ruby/bigdecimal/commit/a109d0984f
2021-01-22 14:07:32 +09:00
Kenta Murata 887a1bfbbc [ruby/bigdecimal] Stop using GetVpValue in rb_big_convert_to_BigDecimal
https://github.com/ruby/bigdecimal/commit/034fd2b25e
2021-01-22 13:59:04 +09:00
Jean Boussier 6ca3d1af33 objspace_dump.c: Handle allocation path and line missing 2021-01-20 10:48:13 -08:00
manga_osyo b84b253a69 Fix Ripper with heredoc. 2021-01-17 12:58:13 +09:00
Nobuyoshi Nakada 35a047301b
[ruby/io-console] Rubygems 3.2 supports `--platform` option
https://github.com/ruby/io-console/commit/c8046fde84
2021-01-16 19:42:53 +09:00
Nobuyoshi Nakada 6ab5504fe5
[ruby/io-console] Moved JRuby version files into particular path
https://github.com/ruby/io-console/commit/b0691d2c20
2021-01-16 19:42:52 +09:00
Nobuyoshi Nakada 92da224d22
[ruby/io-console] Delegate to JRuby version
Add `--platform` option tentatively.

https://github.com/ruby/io-console/commit/3bf1a7b753
2021-01-16 19:42:52 +09:00
Nobuyoshi Nakada c143a2f947
[ruby/io-console] bump up to 0.5.7
https://github.com/ruby/io-console/commit/f55d7ebff6
2021-01-16 19:42:52 +09:00
Kenta Murata b130644584 [ruby/bigdecimal] Fix for the coerce cases in divide and DoDivmod
https://github.com/ruby/bigdecimal/commit/1cb92487f7
2021-01-16 00:09:26 +09:00
Kenta Murata 9d0c5e2754 [ruby/bigdecimal] Use pre-allocated special values in BigDecimal_DoDivmod
https://github.com/ruby/bigdecimal/commit/d2746121cf
2021-01-16 00:08:09 +09:00
Kenta Murata f95f85b215 [ruby/bigdecimal] Use new conversion functions in BigDecimal_DoDivmod
https://github.com/ruby/bigdecimal/commit/68c20200d5
2021-01-16 00:07:48 +09:00
Kenta Murata 0a039c5fbb [ruby/bigdecimal] Use new conversion functions in BigDecimal_divide
https://github.com/ruby/bigdecimal/commit/3b55ad1c42
2021-01-15 06:42:48 +09:00
Kenta Murata 500fc63cd0 [ruby/bigdecimal] Reorder the arguments of BigDecimal_divide
https://github.com/ruby/bigdecimal/commit/1e03da7076
2021-01-15 06:42:38 +09:00
Kenta Murata 4d13f3e9da [ruby/bigdecimal] Explicitly cast size_t to int
https://github.com/ruby/bigdecimal/commit/b1f1ed26c9
2021-01-14 10:21:10 +09:00
Kenta Murata b4ade73974
[ruby/bigdecimal] Explicitly cast uint64_t to double
https://github.com/ruby/bigdecimal/commit/f0d94e6843
2021-01-14 10:20:47 +09:00
Kenta Murata e129be7592 [ruby/bigdecimal] Suppress warning at NO_SANITIZE on gcc
https://github.com/ruby/bigdecimal/commit/f6765b8071
2021-01-14 10:20:30 +09:00
Nobuyoshi Nakada 521ad9a13a Moved Fiber methods into core [Feature #17407] 2021-01-13 23:20:02 +09:00
Kenta Murata a5b4b806de
[ruby/bigdecimal] Allow digits=0 in BigDecimal(flt) and Float#to_d
Using dtoa of mode=0, we can determine the number of digits in decimal that is
necessary to represent the given Float number without errors.

This change permits digits=0 in BigDecimal(flt) and Float#to_d, and these
methods use dtoa of mode=0 when the given digits is 0.

Internal implicit conversion from Float also uses digits=0.

[Fix GH-70]

https://github.com/ruby/bigdecimal/commit/2dbe170e35
2021-01-13 11:49:18 +09:00
Kenta Murata 0a4f719a06
Update ext/bigdecimal/depend 2021-01-13 09:36:17 +09:00
Kenta Murata 28321e400e
Update ext/bigdecimal/depend 2021-01-13 09:08:48 +09:00
Kenta Murata 4ba3a4491e
[ruby/bigdecimal] Optimize rb_float_convert_to_BigDecimal by using dtoa
This improve the conversion speed several times faster than before.

```
RUBYLIB= BUNDLER_ORIG_RUBYLIB= /home/mrkn/.rbenv/versions/3.0.0/bin/ruby -v -S benchmark-driver /home/mrkn/src/github.com/ruby/bigdecimal/benchmark/from_float.yml
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux]
Calculating -------------------------------------
                     bigdecimal 3.0.0      master
              flt_e0         156.400k    783.356k i/s -    100.000k times in 0.639388s 0.127656s
            flt_ep10         158.640k    777.978k i/s -    100.000k times in 0.630359s 0.128538s
           flt_ep100         101.676k    504.259k i/s -    100.000k times in 0.983512s 0.198311s
            flt_em10         103.439k    726.339k i/s -    100.000k times in 0.966751s 0.137677s
           flt_em100          79.675k    651.446k i/s -    100.000k times in 1.255095s 0.153505s

Comparison:
                           flt_e0
              master:    783355.6 i/s
    bigdecimal 3.0.0:    156399.5 i/s - 5.01x  slower

                         flt_ep10
              master:    777977.6 i/s
    bigdecimal 3.0.0:    158639.7 i/s - 4.90x  slower

                        flt_ep100
              master:    504259.4 i/s
    bigdecimal 3.0.0:    101676.5 i/s - 4.96x  slower

                         flt_em10
              master:    726338.6 i/s
    bigdecimal 3.0.0:    103439.2 i/s - 7.02x  slower

                        flt_em100
              master:    651446.3 i/s
    bigdecimal 3.0.0:     79675.3 i/s - 8.18x  slower

```

https://github.com/ruby/bigdecimal/commit/5bdaedd530
https://github.com/ruby/bigdecimal/commit/9bfff57f90
https://github.com/ruby/bigdecimal/commit/d071a0abbb
2021-01-13 02:11:18 +09:00
Kenta Murata 2175c2c957 [ruby/bigdecimal] Use pre-allocated objects for special values
https://github.com/ruby/bigdecimal/commit/95c201f2d3
2021-01-13 01:58:23 +09:00