Commit graph

9140 commits

Author SHA1 Message Date
Peter Zhu
ce8531fed4 Stop using rb_str_locktmp_ensure publicly
rb_str_locktmp_ensure is a private API.
2024-02-23 14:08:29 -05:00
Peter Zhu
510404f2de Stop using rb_fstring publicly
rb_fstring is a private API, so we should use rb_str_to_interned_str
instead, which is a public API.
2024-02-23 13:33:46 -05:00
Marek Küthe
8b2c421a17 Add option for mtu discovery flag
Signed-off-by: Marek Küthe <m.k@mk16.de>
2024-02-23 09:47:09 -08:00
Marek Küthe
4bb4327228 Fixes [Bug #20258]
Signed-off-by: Marek Küthe <m.k@mk16.de>
2024-02-23 09:47:09 -08:00
Peter Zhu
386a006630 Use rb_hash_foreach in objspace.c
Using RHASH_TBL_RAW is a private API, so we should use rb_hash_foreach
rather than RHASH_TBL_RAW with st_foreach.
2024-02-23 10:24:21 -05:00
Peter Zhu
6bd3e8fbb2 Use rb_hash_foreach in coverage
Using RHASH_TBL_RAW is a private API, so we should use rb_hash_foreach
rather than RHASH_TBL_RAW with st_foreach.
2024-02-23 10:24:21 -05:00
Martin Emde
9f8f32bf9f [ruby/zlib] In Zlib::GzipReader#eof? check if we're actually at eof
Only consider it eof if we read ahead and something fills the buf.
If not, we may only have empty blocks and the footer.

Fixes https://github.com/ruby/zlib/pull/56

437bea8003
2024-02-22 06:42:06 +00:00
Nobuyoshi Nakada
2e6f8554f8 [ruby/date] Remove the unintentional ability to parse Symbol
It's been 2 years since ruby/date#49, so it's okay.

435dfec6c8
2024-02-21 16:04:52 +00:00
Koichi Sasada
d578684989 rb_thread_lock_native_thread()
Introduce `rb_thread_lock_native_thread()` to allocate dedicated
native thread to the current Ruby thread for M:N threads.
This C API is similar to Go's `runtime.LockOSThread()`.

Accepted at https://github.com/ruby/dev-meeting-log/blob/master/2023/DevMeeting-2023-08-24.md
(and missed to implement on Ruby 3.3.0)
2024-02-21 15:38:29 +09:00
yui-knk
7cb8fd7800 Move ripper_validate_object to ripper_init.c.tmpl 2024-02-20 19:19:31 +09:00
yui-knk
89cfc15207 [Feature #20257] Rearchitect Ripper
Introduce another semantic value stack for Ripper so that
Ripper can manage both Node and Ruby Object separately.
This rearchitectutre of Ripper solves these issues.
Therefore adding test cases for them.

* [Bug 10436] https://bugs.ruby-lang.org/issues/10436
* [Bug 18988] https://bugs.ruby-lang.org/issues/18988
* [Bug 20055] https://bugs.ruby-lang.org/issues/20055

Checked the differences of `Ripper.sexp` for files under `/test/ruby`
are only on test_pattern_matching.rb.
The differences comes from the differences between
`new_hash_pattern_tail` functions between parser and Ripper.
Ripper `new_hash_pattern_tail` didn’t call `assignable` then
`kw_rest_arg` wasn’t marked as local variable.
This is also fixed by this commit.

```
--- a/./tmp/before/test_pattern_matching.rb
+++ b/./tmp/after/test_pattern_matching.rb
@@ -3607,7 +3607,7 @@
                  [:in,
                   [:hshptn, nil, [], [:var_field, [:@ident, “a”, [984, 13]]]],
                   [[:binary,
-                    [:vcall, [:@ident, “a”, [985, 10]]],
+                    [:var_ref, [:@ident, “a”, [985, 10]]],
                     :==,
                     [:hash, nil]]],
                   nil]]],
@@ -3662,7 +3662,7 @@
                  [:in,
                   [:hshptn, nil, [], [:var_field, [:@ident, “a”, [993, 13]]]],
                   [[:binary,
-                    [:vcall, [:@ident, “a”, [994, 10]]],
+                    [:var_ref, [:@ident, “a”, [994, 10]]],
                     :==,
                     [:hash,
                      [:assoclist_from_args,
@@ -3813,7 +3813,7 @@
                    [:command,
                     [:@ident, “raise”, [1022, 10]],
                     [:args_add_block,
-                     [[:vcall, [:@ident, “b”, [1022, 16]]]],
+                     [[:var_ref, [:@ident, “b”, [1022, 16]]]],
                      false]]],
                   [:else, [[:var_ref, [:@kw, “true”, [1024, 10]]]]]]]],
                nil,
@@ -3876,7 +3876,7 @@
                      [:@int, “0”, [1033, 15]]],
                     :“&&“,
                     [:binary,
-                     [:vcall, [:@ident, “b”, [1033, 20]]],
+                     [:var_ref, [:@ident, “b”, [1033, 20]]],
                      :==,
                      [:hash, nil]]]],
                   nil]]],
@@ -3946,7 +3946,7 @@
                      [:@int, “0”, [1042, 15]]],
                     :“&&“,
                     [:binary,
-                     [:vcall, [:@ident, “b”, [1042, 20]]],
+                     [:var_ref, [:@ident, “b”, [1042, 20]]],
                      :==,
                      [:hash,
                       [:assoclist_from_args,
@@ -5206,7 +5206,7 @@
                      [[:assoc_new,
                        [:@label, “c:“, [1352, 22]],
                        [:@int, “0”, [1352, 25]]]]]],
-                   [:vcall, [:@ident, “r”, [1352, 29]]]],
+                   [:var_ref, [:@ident, “r”, [1352, 29]]]],
                   false]]],
                [:binary,
                 [:call,
@@ -5299,7 +5299,7 @@
                       [:assoc_new,
                        [:@label, “c:“, [1367, 34]],
                        [:@int, “0”, [1367, 37]]]]]],
-                   [:vcall, [:@ident, “r”, [1367, 41]]]],
+                   [:var_ref, [:@ident, “r”, [1367, 41]]]],
                   false]]],
                [:binary,
                 [:call,
@@ -5931,7 +5931,7 @@
              [:in,
               [:hshptn, nil, [], [:var_field, [:@ident, “r”, [1533, 11]]]],
               [[:binary,
-                [:vcall, [:@ident, “r”, [1534, 8]]],
+                [:var_ref, [:@ident, “r”, [1534, 8]]],
                 :==,
                 [:hash,
                  [:assoclist_from_args,
```
2024-02-20 17:33:58 +09:00
Yusuke Endoh
25d74b9527 Do not include a backtick in error messages and backtraces
[Feature #16495]
2024-02-15 18:42:31 +09:00
Sutou Kouhei
ce2618c628
[ruby/strscan] Bump version
ba338b882c
2024-02-08 14:43:56 +09:00
Sutou Kouhei
5afae77ce9
[ruby/strscan] Bump version
842845af1f
2024-02-08 14:43:56 +09:00
Masato Nakamura
e1834cdfe0
[ruby/fiddle] Set changelog_uri gem metadata
(https://github.com/ruby/fiddle/pull/138)

See https://guides.rubygems.org/specification-reference/#metadata for changelog_uri metadata.

0bd8e96adc
2024-02-08 14:43:56 +09:00
Nobuyoshi Nakada
ae8990aef0
Alias init functions
The extension library has each initialization function named "Init_" +
basename. If multiple extensions have the same base name (such as
cgi/escape and erb/escape), the same function will be registered for
both names.

To fix this conflict, rename the initialization functions under sub
directories using using parent names, when statically linking.
2024-02-04 16:43:09 +09:00
Nobuyoshi Nakada
143a1be128
Allow glob patterns in ext/Setup 2024-02-04 16:40:41 +09:00
Nobuyoshi Nakada
c40b0d52be
Glob with base option
When ripping the base directory off the result names.
2024-02-04 16:35:44 +09:00
KJ Tsanaktsidis
da33c5ac9f Revert "Set AI_ADDRCONFIG when making getaddrinfo(3) calls for outgoing conns"
This reverts commit 673ed41c81.
2024-02-01 11:09:54 +11:00
Hiroshi SHIBATA
7c8f9603b1 [flori/json] Make OpenStruct support as optional
202ffe2335
2024-01-31 14:56:00 +09:00
yui-knk
928f388415 [DOC] Fix Ripper DSL input example
'!' suffix is needed for event dispatch.
2024-01-30 22:49:22 +09:00
Nobuyoshi Nakada
5ac9c8f01b [ruby/win32ole] [DOC] Remove spaces inside parentheses
57e4a38465
2024-01-28 15:27:19 +00:00
Nobuyoshi Nakada
8074525b2b [ruby/win32ole] Move toplevel constant for olegen under WIN32OLE
78ff137c0f
2024-01-28 15:25:36 +00:00
Nobuyoshi Nakada
3ad54239b5 [ruby/win32ole] [DOC] Move sample to toplevel
70ea60c4d2
2024-01-28 15:25:36 +00:00
Nobuyoshi Nakada
703ad99bf8 [ruby/win32ole] Use end_with? and fix indent
7648ee7e56
2024-01-28 15:25:35 +00:00
Nobuyoshi Nakada
8af4ef30e5 [ruby/win32ole] Move WIN32OLE prefixed error classes under WIN32OLE
1c95816168
2024-01-28 15:25:35 +00:00
Nobuyoshi Nakada
1e2d088dd3 [ruby/win32ole] Use the scoped names in inspect and error messages
2f51493bd1
2024-01-28 15:25:34 +00:00
Nobuyoshi Nakada
baef72da36 [ruby/win32ole] [DOC] Update class names using the scoped names
2c5d193da7
2024-01-28 15:25:34 +00:00
Nobuyoshi Nakada
1bc48684cd [ruby/win32ole] Rename WIN32OLE::Typelib as WIN32OLE::TypeLib
5feede2cc5
2024-01-28 15:25:33 +00:00
Nobuyoshi Nakada
853bcf65c7 [ruby/win32ole] Rename WIN32OLE::VARIANT as WIN32OLE::VariantType
Prevent name clash with `WIN32OLE::Variant`, of generated document
files on case-insensitive filesystems, such as Windows.

049e5f0a6e
2024-01-28 15:25:33 +00:00
Nobuyoshi Nakada
d3e6bcd37f [ruby/digest] [DOC] Expand Digest::SHA2 definitions for RDoc
Since RDoc searches `var = rb_define_class_under(...)` statements
literally, they cannot be built by macros.

d39b684f91
2024-01-28 06:49:28 +00:00
Nobuyoshi Nakada
81702b4b87 [ruby/digest] Prefer rb_const_get over rb_path2class for direct constants
e5d30394b3
2024-01-28 06:49:28 +00:00
Nobuyoshi Nakada
f475dc1cd2 [ruby/digest] [DOC] Add .document
6db96aa99a
2024-01-28 06:49:26 +00:00
Nobuyoshi Nakada
0f417d640d
Initialize errno variables and fix maybe-uninitialized warnings 2024-01-24 19:33:25 +09:00
yui-knk
ee7f63ebba Make lastline and nextline to be rb_parser_string
This commit changes `struct parser_params` lastline and nextline
from `VALUE` (String object) to `rb_parser_string_t *` so that
dependency on Ruby Object is reduced.
`parser_string_buffer_t string_buffer` is added to `struct parser_params`
to manage `rb_parser_string_t` pointers of each line. All allocated line
strings are freed in `rb_ruby_parser_free`.
2024-01-23 08:58:16 +09:00
Hiroshi SHIBATA
029b6d5b76 Extract syslog 2024-01-22 15:59:40 +09:00
Hiroshi SHIBATA
df70faa9c9 Extract nkf 2024-01-22 14:17:52 +09:00
KJ Tsanaktsidis
6c0e58a54e Make sure the correct error is raised for EAI_SYSTEM resolver fail
In case of EAI_SYSTEM, getaddrinfo is supposed to set more detail in
errno; however, because we call getaddrinfo on a thread now, and errno
is threadlocal, that information is being lost. Instead, we just raise
whatever errno happens to be on the calling thread (which can be
something very confusing, like `ECHILD`).

Fix it by explicitly propagating errno back to the calling thread
through the getaddrinfo_arg structure.

[Bug #20198]
2024-01-22 14:34:31 +11:00
Hiroshi SHIBATA
5b109ff14d [ruby/nkf] Bump up version to 0.2.0
65506fecfd
2024-01-22 03:30:12 +00:00
Charles Oliver Nutter
34c5e78760 [ruby/nkf] Drop GPL and add licenses to gemspec
19df7138f7
2024-01-22 00:12:49 +00:00
Charles Oliver Nutter
c6b548accb [ruby/nkf] Add JRuby extension to the gem
This pulls in the nkf extension implementation from JRuby. The
build and load logic has been updated along the same lines as
ruby/digest and the gem appears to build correctly for the -java
platform.

Fixes https://github.com/ruby/nkf/pull/13

18f57f36ed
2024-01-22 00:12:45 +00:00
Peter Zhu
d0b774cfb8 Remove null checks for xfree
xfree can handle null values, so we don't need to check it.
2024-01-19 10:25:02 -05:00
Sutou Kouhei
ac636f5709
[ruby/strscan] Bump version
d6f97ec102
2024-01-19 10:49:12 +09:00
KJ Tsanaktsidis
61da90c1b8 Mark asan fake stacks during machine stack marking
ASAN leaves a pointer to the fake frame on the stack; we can use the
__asan_addr_is_in_fake_stack API to work out the extent of the fake
stack and thus mark any VALUEs contained therein.

[Bug #20001]
2024-01-19 09:55:12 +11:00
Robert Schulze
d3b07b9845 [ruby/psych] Add :stringify_names option to convert symbol keys to string for dumping
3d051d89aa
2024-01-18 17:32:34 +00:00
tomoya ishida
fd1bafc11f [ruby/stringio] Fix ascii_only? flag in strio_write
(https://github.com/ruby/stringio/pull/77)

Followup of #79

`rb_str_resize()` was changed by b0b9f7201a  .

```c
rb_str_resize(string, shorter) // clear ENC_CODERANGE in some case
rb_str_resize(string, longer) // does not clear ENC_CODERANGE anymore
```

```c
// rb_str_resize in string.c
if (slen > len && ENC_CODERANGE(str) != ENC_CODERANGE_7BIT) {
  ENC_CODERANGE_CLEAR(str);
}
```

I think this change is based on an assumption that appending null bytes
will not change flag `ascii_only?`.

`strio_extend()` will make the string longer if needed, and update the
flags correctly for appending null bytes.
Before `memmove()`, we need to `rb_str_modify()` because updated flags are not
updated for `memmove()`.

b31a538576
2024-01-18 03:42:21 +00:00
Hiroshi SHIBATA
af60cdf674 [ruby/io-console] Bump up version to 0.7.2
1f2877a185
2024-01-18 01:36:52 +00:00
Hiroshi SHIBATA
2b0766113b Extract bigdecimal as bundled gems 2024-01-18 07:44:13 +09:00
Samuel Williams
4f634d3c85 [ruby/openssl] Add support for IO#timeout.
(https://github.com/ruby/openssl/pull/714)

* Add support for IO#timeout.

3bbf5178a9
2024-01-17 17:09:03 +00:00
Ewoud Kohl van Wijngaarden
6213ab1a51 [ruby/openssl] Only set min_version on OpenSSL < 1.1.0
Both Red Hat and Debian-like systems configure the minimum TLS version
to be 1.2 by default, but allow users to change this via configs.

On Red Hat and derivatives this happens via crypto-policies[1], which in
writes settings in /etc/crypto-policies/back-ends/opensslcnf.config.
Most notably, it sets TLS.MinProtocol there. For Debian there's
MinProtocol in /etc/ssl/openssl.cnf. Both default to TLSv1.2, which is
considered a secure default.

In constrast, the SSLContext has a hard coded OpenSSL::SSL::TLS1_VERSION
for min_version. TLS 1.0 and 1.1 are considered insecure. By always
setting this in the default parameters, the system wide default can't be
respected, even if a developer wants to.

This takes the approach that's also done for ciphers: it's only set for
OpenSSL < 1.1.0.

[1]: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/security_hardening/using-the-system-wide-cryptographic-policies_security-hardening

ae215a47ae
2024-01-17 16:41:47 +00:00