From a7f948c32c169ceabb5719f0328e594759c73cd8 Mon Sep 17 00:00:00 2001
From: Brandon Zylstra <9854+brandonzylstra@users.noreply.github.com>
Date: Sat, 22 Nov 2025 18:35:15 -0500
Subject: [PATCH 1/2] [DOC] Fix a typo in enum.c documentation
fix a minor misspelling in the documentation comments
---
enum.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/enum.c b/enum.c
index cbf74df484bbcd..ba0dc94744cc3b 100644
--- a/enum.c
+++ b/enum.c
@@ -3946,7 +3946,7 @@ chunk_i(RB_BLOCK_CALL_FUNC_ARGLIST(yielder, enumerator))
* ["F", 6860]
*
* You can use the special symbol :_alone to force an element
- * into its own separate chuck:
+ * into its own separate chunk:
*
* a = [0, 0, 1, 1]
* e = a.chunk{|i| i.even? ? :_alone : true }
From beb85e7eeee4163cd45b69645a60cdb942f72c05 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada
Date: Sun, 23 Nov 2025 13:55:15 +0900
Subject: [PATCH 2/2] [Bug #21705] Fix segfaults on Windows
It should check the type of the argument and coercion before
converting the encoding.
---
ext/socket/unixsocket.c | 3 ++-
test/socket/test_unix.rb | 20 ++++++++++++--------
2 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/ext/socket/unixsocket.c b/ext/socket/unixsocket.c
index 31e2acee04e896..2ec93760746c02 100644
--- a/ext/socket/unixsocket.c
+++ b/ext/socket/unixsocket.c
@@ -42,11 +42,12 @@ unixsock_path_value(VALUE path)
}
}
#endif
+ path = rb_get_path(path);
#ifdef _WIN32
/* UNIXSocket requires UTF-8 per spec. */
path = rb_str_export_to_enc(path, rb_utf8_encoding());
#endif
- return rb_get_path(path);
+ return path;
}
VALUE
diff --git a/test/socket/test_unix.rb b/test/socket/test_unix.rb
index 0d284b29264618..e239e3935b84d9 100644
--- a/test/socket/test_unix.rb
+++ b/test/socket/test_unix.rb
@@ -293,14 +293,18 @@ def bound_unix_socket(klass)
File.unlink path if path && File.socket?(path)
end
- def test_open_nul_byte
- tmpfile = Tempfile.new("s")
- path = tmpfile.path
- tmpfile.close(true)
- assert_raise(ArgumentError) {UNIXServer.open(path+"\0")}
- assert_raise(ArgumentError) {UNIXSocket.open(path+"\0")}
- ensure
- File.unlink path if path && File.socket?(path)
+ def test_open_argument
+ assert_raise(TypeError) {UNIXServer.new(nil)}
+ assert_raise(TypeError) {UNIXServer.new(1)}
+ Tempfile.create("s") do |s|
+ path = s.path
+ s.close
+ File.unlink(path)
+ assert_raise(ArgumentError) {UNIXServer.open(path+"\0")}
+ assert_raise(ArgumentError) {UNIXSocket.open(path+"\0")}
+ arg = Struct.new(:to_path).new(path)
+ assert_equal(path, UNIXServer.open(arg) { |server| server.path })
+ end
end
def test_addr