From a69d12aa545a3e734344334629eb69626d0d6e73 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Fri, 24 Apr 2026 01:20:15 +0900 Subject: [PATCH] mruby-socket: add temporary getaddrinfo diagnostic for Windows CI Addrinfo.getaddrinfo("localhost", 53, AF_INET, SOCK_STREAM) crashes on GitHub Actions Windows runners with WSAHOST_NOT_FOUND, while the same call works on Linux and macOS. Earlier hypotheses (winsock link missing; hosts file not populated) have been ruled out on CI. Probe five variants in one run to isolate the failing condition: numeric literal 127.0.0.1, localhost with AF_UNSPEC, localhost with nil family, localhost with AF_INET6, and the original AF_INET path. Results go to stdout via puts so they are visible in CI logs. This commit is temporary and will be reverted once the real fix lands. Co-authored-by: Claude --- mrbgems/mruby-socket/test/addrinfo.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/mrbgems/mruby-socket/test/addrinfo.rb b/mrbgems/mruby-socket/test/addrinfo.rb index 491656179..ce70a984c 100644 --- a/mrbgems/mruby-socket/test/addrinfo.rb +++ b/mrbgems/mruby-socket/test/addrinfo.rb @@ -6,6 +6,27 @@ assert('super class of Addrinfo') do assert_equal(Object, Addrinfo.superclass) end +# TEMPORARY DIAGNOSTIC: observe which getaddrinfo pattern works on Windows CI. +# Remove once the root cause is identified and the real fix is in place. +assert('Addrinfo.getaddrinfo diagnostic') do + cases = [ + ['127.0.0.1 literal AF_INET', -> { Addrinfo.getaddrinfo('127.0.0.1', 53, Socket::AF_INET, Socket::SOCK_STREAM) }], + ['localhost AF_UNSPEC', -> { Addrinfo.getaddrinfo('localhost', 53, Socket::AF_UNSPEC, Socket::SOCK_STREAM) }], + ['localhost nil family', -> { Addrinfo.getaddrinfo('localhost', 53) }], + ['localhost AF_INET6', -> { Addrinfo.getaddrinfo('localhost', 53, Socket::AF_INET6, Socket::SOCK_STREAM) }], + ['localhost AF_INET (orig)', -> { Addrinfo.getaddrinfo('localhost', 53, Socket::AF_INET, Socket::SOCK_STREAM) }], + ] + cases.each do |label, probe| + begin + ary = probe.call + puts "DIAG #{label}: OK size=#{ary.size} first=#{ary.first&.ip_address.inspect}" + rescue => e + puts "DIAG #{label}: #{e.class} #{e.message}" + end + end + assert_true(true) +end + assert('Addrinfo.getaddrinfo') do ary = Addrinfo.getaddrinfo("localhost", 53, Socket::AF_INET, Socket::SOCK_STREAM) assert_true(ary.size >= 1)