Commit graph

9854 commits

Author SHA1 Message Date
Yusuke Endoh
16d6a22757 Make rb_getnameinfo interruptible
Same as previous commit for rb_getnameinfo.
2023-10-24 12:22:53 +09:00
Yusuke Endoh
3dc311bdc8 Make rb_getaddrinfo interruptible
When pthread_create is available, rb_getaddrinfo creates a pthread and
executes getaddrinfo(3) in it. The caller thread waits for the pthread
to complete, but detaches it if interrupted. This allows name resolution
to be interuppted by Timeout.timeout, etc. even if it takes a long time
(for example, when the DNS server does not respond).  [Feature #19965]
2023-10-24 12:22:53 +09:00
Yusuke Endoh
efd58f19ea Expand macro branches to make them plain 2023-10-24 12:22:53 +09:00
Yusuke Endoh
25ef8d262a Refactor GETADDRINFO_IMPL instead of GETADDRINFO_EMU
This is a preparation for introducing cancellable
getaddrinfo/getnameinfo.
2023-10-24 12:22:53 +09:00
Yusuke Endoh
9ce607a8d4 refactor a call to getaddrinfo 2023-10-24 12:22:53 +09:00
Samuel Williams
30f5a2bbcd [ruby/io-nonblock] Don't define nonblock methods if they are defined by core.
5d3991859c
2023-10-23 22:53:00 +00:00
Nobuyoshi Nakada
7578bc35f9 [ruby/io-console] Intersperse Win32 and termios implementations
So that the both sources appear in RDoc generated HTMLs.

beec164a47
2023-10-22 03:18:34 +00:00
Nobuyoshi Nakada
8c0c7be65b [ruby/io-console] Start 0.6.1
06307a755d
2023-10-22 02:30:39 +00:00
Nobuyoshi Nakada
c7731b35eb
[ruby/io-console] [DOC] Split .document files to sync with ruby/ruby
13e0bcac9f
2023-10-22 11:09:06 +09:00
Nobuyoshi Nakada
cabf3dac36 [ruby/io-console] [DOC] Add .document
62a677b51a
2023-10-21 22:58:43 +00:00
yui-knk
9ea1ee66c9 Stop creating ripper.h because it's not used 2023-10-20 12:56:04 +09:00
Yusuke Endoh
7362c484c8 Use rb_getnameinfo instead of directly using getnameinfo 2023-10-17 18:21:40 +09:00
Hiroshi SHIBATA
d1f781b0d4 [ruby/psych] Bump up v5.1.1.1
51cc86ff3f
2023-10-16 11:55:01 +00:00
John Hawthorn
1c871c08d9 Switch mid dump to dump_append_string_value
I don't think it's possible to create a CI with a mid which would need
escaping to be in a JSON string, but I think we might as well not rely
on that assumption.
2023-10-12 10:22:32 +02:00
John Hawthorn
635b92099e Fix ObjectSpace.dump with super() callinfo
super() uses 0 as mid for its callinfo, so we need to check for that to
avoid a segfault when using dump_all.
2023-10-12 10:22:32 +02:00
Hiroshi SHIBATA
8f6a96e6ad [ruby/psych] Bump up v5.1.1
f306512d60
2023-10-11 06:13:53 +00:00
Nobuyoshi Nakada
ceec988f2e ripper: Support member references in the DSL 2023-10-10 00:09:52 +09:00
Nobuyoshi Nakada
a5cc6341c0
Remove NODE_VALUES
This node type was added for the multi-value experiment back in 2004.
The feature itself was removed after a few years, but this is its
remnant.
2023-10-06 03:39:58 +09:00
Jean byroot Boussier
f087f2c74c [ruby/stringio] StringIO#pread: handle 0 length like IO#pread
(https://github.com/ruby/stringio/pull/67)

Fix: https://github.com/ruby/stringio/issues/66

If length is 0, IO#pread don't even try to read the IO, it simply return
the buffer untouched if there is one or a new empty buffer otherwise.

It also doesn't validate the offset when length is 0.

cc @jdelStrother @kou

37e9279337

Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
2023-10-05 07:44:08 +00:00
Nobuyoshi Nakada
70e1635950 Move internal NODE_DEF_TEMP to parse.y 2023-10-05 14:23:42 +09:00
Nobuyoshi Nakada
e501613efa [ruby/bigdecimal] Bump up to 3.1.5
c47802e813
2023-10-04 02:50:15 +00:00
Peter Zhu
63e504d6e6 Dump name of method for imemo callinfo
This commit dumps the `mid` of the imemo callinfo when calling
`ObjectSpace.dump_all`.
2023-10-02 09:49:13 -04:00
Charles Oliver Nutter
35e0e440a2 [ruby/psych] Update SnakeYAML Engine to 2.7
094c811588
2023-10-02 11:47:36 +09:00
yui-knk
cecd1de2eb Use rb_node_opt_arg_t and rb_node_kw_arg_t instead of NODE 2023-10-01 09:19:42 +09:00
Nobuyoshi Nakada
d647709d1a Extract ripper_parser_params 2023-09-30 20:17:38 +09:00
yui-knk
68ae87546e Merge NODE_DEF_TEMP and NODE_DEF_TEMP2 2023-09-29 19:36:34 +09:00
yui-knk
74c6781153 Change RNode structure from union to struct
All kind of AST nodes use same struct RNode, which has u1, u2, u3 union members
for holding different kind of data.
This has two problems.

1. Low flexibility of data structure

Some nodes, for example NODE_TRUE, don’t use u1, u2, u3. On the other hand,
NODE_OP_ASGN2 needs more than three union members. However they use same
structure definition, need to allocate three union members for NODE_TRUE and
need to separate NODE_OP_ASGN2 into another node.
This change removes the restriction so make it possible to
change data structure by each node type.

2. No compile time check for union member access

It’s developer’s responsibility for using correct member for each node type when it’s union.
This change clarifies which node has which type of fields and enables compile time check.

This commit also changes node_buffer_elem_struct buf management to handle
different size data with alignment.
2023-09-28 11:58:10 +09:00
Nobuyoshi Nakada
6b66b5fded [Bug #19902] Update the coderange regarding the changed region 2023-09-26 15:35:40 +09:00
Nobuyoshi Nakada
fbe4db5182 ripper: Support named references in the DSL 2023-09-25 23:04:09 +09:00
Burdette Lamar
02022cef53 [ruby/stringio] [DOC] Fix link
(https://github.com/ruby/stringio/pull/65)

e3ea087d04
2023-09-22 14:17:07 +00:00
Kazuki Yamaguchi
2df00640ff [ruby/openssl] Ruby/OpenSSL 3.2.0
6b3dd6a372
2023-09-21 20:01:23 +00:00
Kazuki Yamaguchi
a2f1195beb [ruby/openssl] Update README and gemspec description
* Reword the description in README for more clarity.

 * Add a compatibility matrix of our stable branches and explain the
   maintenance policy.

 * Remove the obsolete paragraph for how to use the gem in Ruby 2.3,
   which is no longer supported.

7691034fcb
2023-09-21 20:01:23 +00:00
BurdetteLamar
7ffee5681f [ruby/date] [DOC] Fix link
2adb917487
2023-09-20 19:48:28 +00:00
Nobuyoshi Nakada
5c94f3fe9d [ruby/fiddle] Suppress -Wundef warnings on arm64 macOS and Windows
(https://github.com/ruby/fiddle/pull/134)

```
In file included from ../../../../ext/fiddle/fiddle.h:46:
/opt/local/include/ffi.h:477:5: warning: 'FFI_GO_CLOSURES' is not defined, evaluates to 0 [-Wundef]
    ^
```

c.f. https://github.com/libffi/libffi/pull/796

d4feb57098
2023-09-17 22:42:50 +09:00
Nobuyoshi Nakada
69d7871b02
ripper: Preprocess ripper-dispatchable types only
Keep the other types, which not having setter macros for ripper.
2023-09-17 16:22:01 +09:00
Nobuyoshi Nakada
f2102e4015
Set ripper_init.c.tmpl to C mode [ci skip] 2023-09-10 19:20:31 +09:00
Michael Richardson
91e5f51607 [ruby/openssl] x509ext: let X509::ExtensionFactory#create_ext take a dotted OID string
instead of looking of NIDs and then using X509V3_EXT_nconf_nid,
instead just pass strings to X509V3_EXT_nconf, which has all the logic for
processing dealing with generic extensions
also process the oid through ln2nid() to retain compatibility.

[rhe: tweaked commit message and added a test case]

9f15741331
2023-09-06 19:30:32 +09:00
Petrik
9b6128c541 [ruby/openssl] Fix OCSP documentation
`port` should be called on the `ocsp_uri` URI instead of `ocsp`, which
is just a string.

89a1c82dd0
2023-09-06 19:26:27 +09:00
Mau Magnaguagno
60a6de81a8 [ruby/openssl] Prefer String#unpack1
(https://github.com/ruby/openssl/pull/586)

String#unpack1 avoids the intermediate array created by String#unpack
for single elements, while also making a call to Array#first/[0]
unnecessary.

8eb0715a42
2023-09-06 19:24:53 +09:00
Kazuki Yamaguchi
b6d7cdc2ba [ruby/openssl] ssl: use ffdhe2048 from RFC 7919 as the default DH group parameters
In TLS 1.2 or before, if DH group parameters for DHE are not supplied
with SSLContext#tmp_dh= or #tmp_dh_callback=, we currently use the
self-generated parameters added in commit bb3399a61c ("support 2048
bit length DH-key", 2016-01-15) as the fallback.

While there is no known weakness in the current parameters, it would be
a good idea to switch to pre-defined, more well audited parameters.

This also allows the fallback to work in the FIPS mode.

The PEM encoding was derived with:

	# RFC 7919 Appendix A.1. ffdhe2048
	print OpenSSL::PKey.read(OpenSSL::ASN1::Sequence([OpenSSL::ASN1::Integer((<<-END).split.join.to_i(16)), OpenSSL::ASN1::Integer(2)]).to_der).to_pem
	    FFFFFFFF FFFFFFFF ADF85458 A2BB4A9A AFDC5620 273D3CF1
	    D8B9C583 CE2D3695 A9E13641 146433FB CC939DCE 249B3EF9
	    7D2FE363 630C75D8 F681B202 AEC4617A D3DF1ED5 D5FD6561
	    2433F51F 5F066ED0 85636555 3DED1AF3 B557135E 7F57C935
	    984F0C70 E0E68B77 E2A689DA F3EFE872 1DF158A1 36ADE735
	    30ACCA4F 483A797A BC0AB182 B324FB61 D108A94B B2C8E3FB
	    B96ADAB7 60D7F468 1D4F42A3 DE394DF4 AE56EDE7 6372BB19
	    0B07A7C8 EE0A6D70 9E02FCE1 CDF7E2EC C03404CD 28342F61
	    9172FE9C E98583FF 8E4F1232 EEF28183 C3FE3B1B 4C6FAD73
	    3BB5FCBC 2EC22005 C58EF183 7D1683B2 C6F34A26 C1B2EFFA
	    886B4238 61285C97 FFFFFFFF FFFFFFFF
	END

a5527cb4f4
2023-09-06 19:24:43 +09:00
Mau Magnaguagno
4a042b2255 [ruby/openssl] Refactor Buffering consume_rbuff and getbyte methods
Prefer ``slice!`` for ``Buffering#consume_rbuff`` and safe navigation with ``ord`` for ``Buffering#getbyte``, similar to ``each_byte``.

5f6abff178
2023-09-06 19:24:02 +09:00
Kazuki Yamaguchi
912f1cda0d [ruby/openssl] Remove OSSL_DEBUG compile-time option
Remove the OSSL_DEBUG flag and OpenSSL.mem_check_start which is only
compiled when the flag is given. They are meant purely for development
of Ruby/OpenSSL.

OpenSSL.mem_check_start helped us find memory leak bugs in past, but
it is no longer working with the recent OpenSSL versions. Let's just
remove it now.

8c7a6a17e2
2023-09-06 19:20:57 +09:00
Jean Boussier
bcc905100f BasicSocket#recv* return nil rather than an empty packet
[Bug #19012]

man recvmsg(2) states:

> Return Value
> These calls return the number of bytes received, or -1 if an error occurred.
> The return value will be 0 when the peer has performed an orderly shutdown.

Not too sure how one is supposed to make the difference between a packet of
size 0 and a closed connection.
2023-08-30 10:07:18 +02:00
Sutou Kouhei
5ed42c9800
Development of 3.0.9 started. 2023-08-29 18:15:05 +09:00
Jun Aruga
b0ec1db8a7 [ruby/openssl] ossl_pkey.c: Workaround: Decode with non-zero selections.
This is a workaround for the decoding issue in ossl_pkey_read_generic().
The issue happens in the case that a key management provider is different from
a decoding provider.

Try all the non-zero selections in order, instead of selection 0 for OpenSSL 3
to avoid the issue.

db688fa739
2023-08-28 12:05:33 +09:00
Jun Aruga
b5d0374635
[ruby/openssl] Fix LIBRESSL_VERSION_NUMBER document mistake.
* Fix the wrong man reference.
* According to the LIBRESSL_VERSION_NUMBER(3), the value always ends with 00f.

```
$ man -M /home/jaruga/.local/libressl-6650dce/share/man/ 3 LIBRESSL_VERSION_NUMBER
...
DESCRIPTION
     OPENSSL_VERSION_NUMBER and LIBRESSL_VERSION_NUMBER are numeric release version
     identifiers.  The first two digits contain the major release number, the third and
     fourth digits the minor release number, and the fifth and sixth digits the fix re‐
     lease number.  For OpenSSL, the seventh and eight digits contain the patch release
     number and the final digit is 0 for development, 1 to e for betas 1 to 14, or f
     for release.  For LibreSSL, OPENSSL_VERSION_NUMBER is always 0x020000000, and
     LIBRESSL_VERSION_NUMBER always ends with 00f.
```

296c859d18
2023-08-25 18:34:47 +09:00
卜部昌平
d9cba2fc74 include missing header 2023-08-25 17:27:53 +09:00
卜部昌平
12ec1fb2b1 use configure-detected sanity of _Alignof
This is actually already checked in (Ruby's) configure.
2023-08-25 17:27:53 +09:00
卜部昌平
eec85a6309 tool/update-deps --fix 2023-08-25 17:27:53 +09:00
Nobuyoshi Nakada
412defc7ad [ruby/io-console] Get rid of address of an rvalue on TruffleRuby
653c1cd33f
2023-08-18 03:55:05 +00:00