9097 Commits
Author SHA1 Message Date
Nobuyoshi Nakada 08d0d1d43d [ruby/io-console] Use gperf 3.1 to generate ANSI-C code
https://github.com/ruby/io-console/commit/3798aae42d
(cherry picked from commit 25c2aa0a1c)
2026-10-23 09:45:31 +09:00
Nobuyoshi Nakada 7692732061 [ruby/date] Use gperf 3.1 to generate ANSI-C code
https://github.com/ruby/date/commit/5d67437b1f
(cherry picked from commit 12e66f11e5)
2026-10-23 09:45:31 +09:00
Kazuki Yamaguchi 1fbf9abe85 Merge openssl-3.2.4
The changes can be found at:

    https://github.com/ruby/openssl/compare/v3.2.3...v3.2.4
2026-05-14 13:59:53 +09:00
Kazuki Yamaguchi 0c2dcf4815 Merge openssl-3.2.3
The changes can be found at:

    https://github.com/ruby/openssl/compare/v3.2.2...v3.2.3
2026-05-14 13:59:53 +09:00
Hiroshi SHIBATA 7cb33b6a88 merge revision(s) bc2a8a002a, c26057ebaf: [Backport #21779]
[Bug #21779] Uniquify `InitVM` functions as well as `Init`

	Avoid possible name conflict when `--with-static-linked-ext`.

	[Bug #21779] Do not export InitVM functions

	Fix ruby/io-console#105.
2026-03-24 14:49:12 +09:00
Hiroshi SHIBATA 513ee91b38 Merge zlib-3.1.2 2026-03-10 15:58:44 +09:00
nagachika 1974ccabbf merge revision(s) beb85e7eee: [Backport #21705]
[PATCH] [Bug #21705] Fix segfaults on Windows

	It should check the type of the argument and coercion before
	converting the encoding.
2025-11-30 10:36:56 +09:00
nagachika 30f661951b merge revision(s) 12350eb9e0: [Backport #21625]
[PATCH] [Bug #21625] Allow io/wait methods with `IO#ungetc` in text mode
2025-11-02 13:28:40 +09:00
Bo Anderson ce7aa23f97 Update openssl gem to 3.2.2 2025-10-11 16:53:43 +09:00
nagachika 5a8d764216 merge revision(s) 43dbb9a93f, 2bb6fe3854, 7c9dd0ecff: [Backport #21629]
[PATCH] [Bug #21629] Enable `nonstring` attribute on clang 21

	[PATCH] [Bug #21629] Initialize `struct RString`

	[PATCH] [Bug #21629] Initialize `struct RArray`
2025-10-08 22:56:02 +09:00
nagachika 83335453c2 Revert bump versions of default gems for extconf.rb changes.
This reverts commit 91263c7e52.
2025-07-24 16:44:37 +09:00
Nobuyoshi Nakada 9a269b15f5 [ruby/json] Run have_func with the header providing the declarations
https://github.com/ruby/json/commit/95fb084027
2025-07-20 18:32:03 +09:00
Nobuyoshi Nakada dd84f059cb [ruby/strscan] Run have_func with the header providing the declarations
https://github.com/ruby/strscan/commit/18c0a59b65
2025-07-20 18:32:03 +09:00
Nobuyoshi Nakada 2af51ec480 [ruby/strscan] Update extconf.rb
(https://github.com/ruby/strscan/pull/158)

- `have_func` includes "ruby.h" by default.
- include "ruby/re.h" where `rb_reg_onig_match` is declared.

https://github.com/ruby/strscan/commit/1ac96f47e9
2025-07-20 18:32:03 +09:00
Nobuyoshi Nakada bf08633e0f [ruby/openssl] Run have_func with the header providing the declarations
https://github.com/ruby/openssl/commit/b6f56c4540
2025-07-20 18:32:03 +09:00
nagachika 280cf2ad81 Bump io-nonblock to 0.3.0.1 2025-07-20 18:32:03 +09:00
Nobuyoshi Nakada 2493ec4f5e [ruby/io-nonblock] Run have_func with the header providing the declarations
https://github.com/ruby/io-nonblock/commit/70909f5362
2025-07-20 18:32:03 +09:00
nagachika e997c7f26e Bump io-wait to 0.3.1.1 2025-07-20 18:32:03 +09:00
Nobuyoshi Nakada 8fab4f20a8 [ruby/io-wait] Run have_func with the header providing the declarations
https://github.com/ruby/io-wait/commit/48309d7877
2025-07-20 18:32:03 +09:00
nagachika 1d275bfd39 Bump io-console to 0.7.1.1 2025-07-20 18:32:03 +09:00
Nobuyoshi Nakada fb42816c53 [ruby/io-console] Run have_func with the header providing the declarations
https://github.com/ruby/io-console/commit/dd013030dd
2025-07-20 18:32:03 +09:00
nagachika 91263c7e52 bump etc-1.4.3.1 2025-07-20 18:32:03 +09:00
Nobuyoshi Nakada fd6d582427 [ruby/etc] Run have_func with the header providing the declarations
https://github.com/ruby/etc/commit/6668bfd42a
2025-07-20 18:32:03 +09:00
nagachika 1e37f34eaa merge revision(s) d77e02bd85: [Backport #21497]
[Bug #21497] [ruby/socket]: add full prototype
	MIME-Version: 1.0
	Content-Type: text/plain; charset=UTF-8
	Content-Transfer-Encoding: 8bit

	otherwise, gcc 15 will complain:

	> init.c:573:19: error: too many arguments to function ‘Rconnect’; expected 0, have 3
	>   573 |     return (VALUE)Rconnect(arg->fd, arg->sockaddr, arg->len);
	>       |                   ^~~~~~~~ ~~~~~~~
	> In file included from init.c:11:
	> rubysocket.h:294:5: note: declared here
	>   294 | int Rconnect();
	>       |     ^~~~~~~~

	> sockssocket.c:33:9: error: too many arguments to function ‘SOCKSinit’; expected 0, have 1
	>    33 |         SOCKSinit("ruby");
	>       |         ^~~~~~~~~ ~~~~~~
	> In file included from sockssocket.c:11:
	> rubysocket.h:293:6: note: declared here
	>   293 | void SOCKSinit();
	>       |      ^~~~~~~~~

	Signed-off-by: Z. Liu <zhixu.liu@gmail.com>
2025-07-20 15:49:08 +09:00
nagachika 1fb5ab411f merge revision(s) c1877d431e: [Backport #21437]
[ruby/date] [Bug #21437] Date#hash for large years

	Addresses https://bugs.ruby-lang.org/issues/21437

	Signed-off-by: Dmitry Dygalo <dmitry.dygalo@workato.com>

	https://github.com/ruby/date/commit/31f07bc576
2025-06-29 12:31:38 +09:00
nagachika da86a9959b merge revision(s) 2b6fc9ea72: [Backport #21092]
[Bug #21092] Fallback variables after execonf has done

	When reading from a dummy makefile, the global variables initialized
	in `init_mkmf` may not be overridden.
2025-03-16 15:25:20 +09:00
Jean byroot BoussierandJean Boussier a24570a62a ObjectSpace.dump: handle Module#set_temporary_name (#12068)
ObjectSpace.dump: handle Module#set_temporary_name

[Bug #20892]

Until the introduction of that method, it was impossible for a
Module name not to be valid JSON, hence it wasn't going through
the slower escaping function.

This assumption no longer hold.

Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
2024-11-12 11:20:36 -08:00
Jonathan Calvert 7446f7cdd1 merge revision(s) 0d16c36d0a: [Backport #13831]
[win32/registry] Fallback to UTF-8 for unknown codepages

	There are some codepages like cp708 for which no ruby encoding exists:

	    $ ruby -e "Encoding.find('cp708')"
	    Traceback (most recent call last):
	    	1: from -e:1:in `<main>'
	    -e:1:in `find': unknown encoding name - cp708 (ArgumentError)

	win32/registry uses ENCODING to transcode error messages and expand environment
	variables from UTF-16LE, so using UTF-8 seems like the best choice and is better
	than a hard failure.

	This should resolve [Bug #13831]
2024-11-04 14:26:25 -08:00
Hiroshi SHIBATA 4eb51dfc9e Merge JSON 2.7.2 for Ruby 3.3 (#11541)
Merge JSON 2.7.2
2024-09-04 08:47:06 -07:00
Takashi Kokubun b210c86a02 merge revision(s) 97449338d6: [Backport #20649]
[Bug #20649] Allow `nil` as 2nd argument of `assign_error`

	Fallback to the last token element in that case, for the backward
	compatibilities.
2024-09-02 03:07:09 -07:00
Koichi Sasada 3427a1679a retry on cancelling of getaddrinfo (#11131)
When the registerred unblock function is called, it should retry
the cancelled blocking function if possible after checkints.

For example, `SIGCHLD` can cancel this method, but it should not
raise any exception if there is no trap handlers.

The following is repro-code:

```ruby
require 'socket'
PN = 10_000

1000000.times{
  p _1
  PN.times{
    fork{
      sleep rand(0.3)
    }
  }
  i = 0
  while i<PN
    cpid = Process.wait -1, Process::WNOHANG
    if cpid
      # p [i, cpid]
      i += 1
    end

    begin
      TCPServer.new(nil, 0).close
    rescue
      p $!
      exit!
    end
  end
}
```
2024-07-09 08:55:04 -07:00
Takashi Kokubun 9d583dd43a merge revision(s) fba8aff7, d8c6e91748: [Backport #20592]
[Bug #20592] Fix segfault when sending NULL to freeaddrinfo

	On alpine freeaddrinfo does not accept NULL pointer

	Fix dangling `else`
2024-07-08 15:58:13 -07:00
Takashi Kokubun 1df1538be4 merge revision(s) f54369830f, 338eb0065b, ac636f5709: [Backport #20516]
Revert "Rollback to released version numbers of stringio and strscan"

	This reverts commit 6a79e53823.

	[ruby/strscan] StringScanner#captures: Return nil not "" for unmached capture (https://github.com/ruby/strscan/pull/72)

	fix https://github.com/ruby/strscan/issues/70
	If there is no substring matching the group (s[3]), the behavior is
	different.

	If there is no substring matching the group, the corresponding element
	(s[3]) should be nil.

	```
	s = StringScanner.new('foobarbaz') #=> #<StringScanner 0/9 @ "fooba...">
	s.scan /(foo)(bar)(BAZ)?/  #=> "foobar"
	s[0]           #=> "foobar"
	s[1]           #=> "foo"
	s[2]           #=> "bar"
	s[3]           #=> nil
	s.captures #=> ["foo", "bar", ""]
	s.captures.compact #=> ["foo", "bar", ""]
	```

	```
	s = StringScanner.new('foobarbaz') #=> #<StringScanner 0/9 @ "fooba...">
	s.scan /(foo)(bar)(BAZ)?/  #=> "foobar"
	s[0]           #=> "foobar"
	s[1]           #=> "foo"
	s[2]           #=> "bar"
	s[3]           #=> nil
	s.captures #=> ["foo", "bar", nil]
	s.captures.compact #=> ["foo", "bar"]
	```

	https://docs.ruby-lang.org/ja/latest/method/MatchData/i/captures.html
	```
	/(foo)(bar)(BAZ)?/ =~ "foobarbaz" #=> 0
	$~.to_a        #=> ["foobar", "foo", "bar", nil]
	$~.captures #=> ["foo", "bar", nil]
	$~.captures.compact #=> ["foo", "bar"]
	```

	* StringScanner#captures is not yet documented.
	https://docs.ruby-lang.org/ja/latest/class/StringScanner.html

	https://github.com/ruby/strscan/commit/1fbfdd3c6f

	[ruby/strscan] Bump version

	https://github.com/ruby/strscan/commit/d6f97ec102
2024-06-04 13:14:09 -07:00
Takashi Kokubun 541fc816fc [ruby/zlib] Bump up 3.1.1 2024-05-29 11:35:46 -07:00
Takashi Kokubun 2ae6df6d03 merge revision(s) 9f8f32bf9f: [Backport #20289]
[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

	https://github.com/ruby/zlib/commit/437bea8003
2024-05-29 11:35:23 -07:00
Takashi Kokubun 548c7cb9f5 merge revision(s) 7e4b1f8e19: [Backport #20322]
[Bug #20322] Fix rb_enc_interned_str_cstr null encoding

	The documentation for `rb_enc_interned_str_cstr` notes that `enc` can be
	a null pointer, but this currently causes a segmentation fault when
	trying to autoload the encoding. This commit fixes the issue by checking
	for NULL before calling `rb_enc_autoload`.
2024-05-29 11:07:07 -07:00
Nobuyoshi Nakada bcf5cd3ba4 Initialize errno variables and fix maybe-uninitialized warnings 2024-05-29 10:48:19 -07:00
NARUSE, Yui a406c51668 merge revision(s) ae8990aef0: [Backport #20183] (#10310)
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-03-21 01:28:51 +00:00
KJ Tsanaktsidis 606dd03e9b [Bug #20208] Revert "Set AI_ADDRCONFIG when making getaddrinfo(3) calls for outgoi… (#9791)
Revert "Set AI_ADDRCONFIG when making getaddrinfo(3) calls for outgoing conns"

This reverts commit 673ed41c81.
2024-03-14 16:27:05 +00:00
NARUSE, Yui a889304fed merge revision(s) 6c0e58a54e: [Backport #20198] (#10252)
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]
	---
	 ext/socket/raddrinfo.c | 25 +++++++++++++++++++------
	 1 file changed, 19 insertions(+), 6 deletions(-)
2024-03-14 09:42:28 +00:00
NARUSE, Yui ade02f3c89 merge revision(s) 051a874325: [Backport #20096]
Fix memory overread in registry.rb

	The terminator is not actually getting filled in; we're simply passing
	(two) bytes of empty memory as the NUL terminator. This can lead to
	garbage characters getting written to registry values.

	Fix this by explicitly putting a WCHAR_NUL character into the string to
	be sent to the registry API, like we do in the MULTI_SZ case.

	[Bug #20096]
	---
	 ext/win32/lib/win32/registry.rb | 7 ++-----
	 1 file changed, 2 insertions(+), 5 deletions(-)
2024-03-04 11:57:04 +09:00
NARUSE, Yui 53d4e9c4bb merge revision(s) 1bd98c820d: [Backport #20172] (#9798)
Remove setaffinity of pthread for getaddrinfo

	It looks like `sched_getcpu(3)` returns a strange number on some
	(virtual?) environments.

	I decided to remove the setaffinity mechanism because the performance
	does not appear to degrade on a quick benchmark even if removed.

	[Bug #20172]
	---
	 ext/socket/extconf.rb  |  2 --
	 ext/socket/raddrinfo.c | 48 ++++--------------------------------------------
	 2 files changed, 4 insertions(+), 46 deletions(-)
2024-02-03 15:47:32 +00:00
NARUSE, Yui 2886564279 merge revision(s) 6aacbd690c: [Backport #20149]
Free pthread_attr after setting up the thread

	[bug #20149]
	---
	 ext/socket/raddrinfo.c | 12 +++++++++++-
	 1 file changed, 11 insertions(+), 1 deletion(-)
2024-02-01 10:39:54 +09:00
Hiroshi SHIBATA 5ea862f26e [ruby/psych] Bump up 5.1.2
https://github.com/ruby/psych/commit/a9ab74d132
2023-12-19 11:07:47 +09:00
Alexander Momchilov e6fa1d62fa [ruby/psych] Use compare_by_identity instead of object_id
Object IDs became more expensive in Ruby 2.7. Using `Hash#compare_by_identity` let's us get the same effect, without needing to force all these objects to have object_ids assigned to them.

https://github.com/ruby/psych/commit/df69e4a12e
2023-12-19 11:07:45 +09:00
Jean Boussier b2fc1b054e Update BasicSocket#recv documentation on return value
Ref: https://github.com/ruby/ruby/pull/6407

[Bug #19012]

`0` is now interpreted as closed connection an not an
empty packet, as these are very rare and pretty much
useless.
2023-12-18 12:58:08 +01:00
Nobuyoshi Nakada baf1403fba [DOC] Show PTY.getpty as an alias of PTY.spawn
`:nodoc:` directive does not work at method definition in C, and must
be at the implementation function.  That is, there is no way to make
one method visible and another method sharing the implementation
invisible at the same time.
2023-12-18 20:17:45 +09:00
Nobuyoshi Nakada 0601bce6fc [DOC] Add Socket::ResolutionError documentation 2023-12-18 08:49:06 +09:00
Nobuyoshi Nakada 71c4a9c38f [DOC] Correct the location of Addrinfo document
The document must be placed immediately before the class definition.
No other statements can be placed in between.
2023-12-18 08:47:59 +09:00
Nobuyoshi Nakada e316128e3d [DOC] Stop unintentional references to builtin or standard names 2023-12-18 08:38:59 +09:00