* [ruby-dev:51132] [Ruby master Bug#18472] rb_w32_map_errno does not found on Ruby-3.1.0
@ 2022-01-11 14:11 joker1007 (Tomohiro Hashidate)
2022-01-12 9:57 ` [ruby-dev:51133] [Ruby master Bug#18472] rb_w32_map_errno is " kubo (Takehiro Kubo)
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: joker1007 (Tomohiro Hashidate) @ 2022-01-11 14:11 UTC (permalink / raw)
To: ruby-dev
Issue #18472 has been reported by joker1007 (Tomohiro Hashidate).
----------------------------------------
Bug #18472: rb_w32_map_errno does not found on Ruby-3.1.0
https://bugs.ruby-lang.org/issues/18472
* Author: joker1007 (Tomohiro Hashidate)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.1.0p0 (2021-12-25 revision fb4df44d16) [x64-mingw-ucrt]
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------
I faced Fiddle::DLError such following.
```
C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/3.1.0/fiddle/import.rb:297:in `import_function': cannot find the function: rb_w32_map_errno() (Fiddle::DLError)
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/3.1.0/fiddle/import.rb:170:in `extern'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/winsock.rb:112:in `<module:RbWinSock>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/winsock.rb:97:in `<module:ServerEngine>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/winsock.rb:18:in `<top (required)>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/socket_manager_win.rb:21:in `require_relative'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/socket_manager_win.rb:21:in `<top (required)>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/socket_manager.rb:222:in `require_relative'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/socket_manager.rb:222:in `<module:SocketManager>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/socket_manager.rb:26:in `<module:ServerEngine>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/socket_manager.rb:25:in `<top (required)>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/process_manager.rb:19:in `require'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/process_manager.rb:19:in `<top (required)>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/supervisor.rb:20:in `require'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/supervisor.rb:20:in `<top (required)>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/daemon.rb:21:in `require'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/daemon.rb:21:in `<top (required)>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine.rb:26:in `require'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine.rb:26:in `<module:ServerEngine>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine.rb:18:in `<top (required)>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/fluentd-1.14.4/lib/fluent/test/log.rb:17:in `require'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/fluentd-1.14.4/lib/fluent/test/log.rb:17:in `<top (required)>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/fluentd-1.14.4/lib/fluent/test.rb:19:in `require'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/fluentd-1.14.4/lib/fluent/test.rb:19:in `<top (required)>'
from D:/a/fluent-plugin-bigquery/fluent-plugin-bigquery/test/helper.rb:6:in `require'
from D:/a/fluent-plugin-bigquery/fluent-plugin-bigquery/test/helper.rb:6:in `<top (required)>'
from D:/a/fluent-plugin-bigquery/fluent-plugin-bigquery/test/plugin/test_out_bigquery_base.rb:1:in `require'
from D:/a/fluent-plugin-bigquery/fluent-plugin-bigquery/test/plugin/test_out_bigquery_base.rb:1:in `<top (required)>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/rake_test_loader.rb:21:in `require'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/rake_test_loader.rb:21:in `block in <main>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/rake_test_loader.rb:6:in `select'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/rake_test_loader.rb:6:in `<main>'
rake aborted!
```
The cause code is here. (https://github.com/treasure-data/serverengine/blob/4d6dbd3d1b4e1af88cc2593b5b19cf0f6da7d5dd/lib/serverengine/winsock.rb#L112)
```ruby
module RbWinSock
extend Fiddle::Importer
dlload "kernel32"
extern "int GetModuleFileNameA(int, char *, int)"
extern "int CloseHandle(int)"
ruby_bin_path_buf = Fiddle::Pointer.malloc(1000)
GetModuleFileNameA(0, ruby_bin_path_buf, ruby_bin_path_buf.size)
ruby_bin_path = ruby_bin_path_buf.to_s.gsub(/\\/, '/')
ruby_dll_paths = File.dirname(ruby_bin_path) + '/*msvcr*ruby*.dll'
ruby_dll_path = Dir.glob(ruby_dll_paths).first
dlload ruby_dll_path
extern "int rb_w32_map_errno(int)"
```
On 3.0.x, this test is passed.
Moreover, I don't find any changes about `rb_w32_map_errno` from 3.0.3 to 3.1.0.
It is strange behavior. It may be a bug in Ruby-3.1.0
## Environment
- Github Actions (windows-latest)
- use https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.1.0-1/rubyinstaller-3.1.0-1-x64.7z
- permalink to failed test (https://github.com/fluent-plugins-nursery/fluent-plugin-bigquery/runs/4775813193?check_suite_focus=true)
I apologize for the lack of research, as I do not have a Windows environment.
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* [ruby-dev:51133] [Ruby master Bug#18472] rb_w32_map_errno is not found on Ruby-3.1.0
2022-01-11 14:11 [ruby-dev:51132] [Ruby master Bug#18472] rb_w32_map_errno does not found on Ruby-3.1.0 joker1007 (Tomohiro Hashidate)
@ 2022-01-12 9:57 ` kubo (Takehiro Kubo)
2022-01-13 9:53 ` [ruby-dev:51134] " kubo (Takehiro Kubo)
2022-01-13 9:59 ` [ruby-dev:51135] " ashie (Takuro Ashie)
2 siblings, 0 replies; 4+ messages in thread
From: kubo (Takehiro Kubo) @ 2022-01-12 9:57 UTC (permalink / raw)
To: ruby-dev
Issue #18472 has been updated by kubo (Takehiro Kubo).
It is because of a change in rubyinstaller-3.1.0-x64.
In https://rubyinstaller.org/2021/12/31/rubyinstaller-3.1.0-1-released.html:
> RubyInstaller-3.1.0-x64 has a changed C-runtime called UCRT replacing the old MSVCRT.
I guess that `ruby_dll_path` is nil because `*msvcr*ruby*.dll` doesn't exist in the bin directory.
rubyinstaller-3.1.0-x64: x64-ucrt-ruby310.dll
rubyinstaller-3.0.0-x64: x64-msvcrt-ruby300.dll
rubyinstaller-3.1.0-x86: msvcrt-ruby310.dll
rubyinstaller-3.0.0-x86: msvcrt-ruby300.dll
How about the following code?
```ruby
module RbWinSock
extend Fiddle::Importer
dlload "kernel32"
extern "int CloseHandle(int)"
require 'rbconfig'
dlload RbConfig::CONFIG['LIBRUBY_SO']
extern "int rb_w32_map_errno(int)"
```
----------------------------------------
Bug #18472: rb_w32_map_errno is not found on Ruby-3.1.0
https://bugs.ruby-lang.org/issues/18472#change-95908
* Author: joker1007 (Tomohiro Hashidate)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.1.0p0 (2021-12-25 revision fb4df44d16) [x64-mingw-ucrt]
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------
I faced Fiddle::DLError such following.
```
C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/3.1.0/fiddle/import.rb:297:in `import_function': cannot find the function: rb_w32_map_errno() (Fiddle::DLError)
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/3.1.0/fiddle/import.rb:170:in `extern'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/winsock.rb:112:in `<module:RbWinSock>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/winsock.rb:97:in `<module:ServerEngine>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/winsock.rb:18:in `<top (required)>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/socket_manager_win.rb:21:in `require_relative'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/socket_manager_win.rb:21:in `<top (required)>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/socket_manager.rb:222:in `require_relative'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/socket_manager.rb:222:in `<module:SocketManager>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/socket_manager.rb:26:in `<module:ServerEngine>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/socket_manager.rb:25:in `<top (required)>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/process_manager.rb:19:in `require'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/process_manager.rb:19:in `<top (required)>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/supervisor.rb:20:in `require'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/supervisor.rb:20:in `<top (required)>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/daemon.rb:21:in `require'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/daemon.rb:21:in `<top (required)>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine.rb:26:in `require'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine.rb:26:in `<module:ServerEngine>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine.rb:18:in `<top (required)>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/fluentd-1.14.4/lib/fluent/test/log.rb:17:in `require'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/fluentd-1.14.4/lib/fluent/test/log.rb:17:in `<top (required)>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/fluentd-1.14.4/lib/fluent/test.rb:19:in `require'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/fluentd-1.14.4/lib/fluent/test.rb:19:in `<top (required)>'
from D:/a/fluent-plugin-bigquery/fluent-plugin-bigquery/test/helper.rb:6:in `require'
from D:/a/fluent-plugin-bigquery/fluent-plugin-bigquery/test/helper.rb:6:in `<top (required)>'
from D:/a/fluent-plugin-bigquery/fluent-plugin-bigquery/test/plugin/test_out_bigquery_base.rb:1:in `require'
from D:/a/fluent-plugin-bigquery/fluent-plugin-bigquery/test/plugin/test_out_bigquery_base.rb:1:in `<top (required)>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/rake_test_loader.rb:21:in `require'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/rake_test_loader.rb:21:in `block in <main>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/rake_test_loader.rb:6:in `select'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/rake_test_loader.rb:6:in `<main>'
rake aborted!
```
The cause code is here. (https://github.com/treasure-data/serverengine/blob/4d6dbd3d1b4e1af88cc2593b5b19cf0f6da7d5dd/lib/serverengine/winsock.rb#L112)
```ruby
module RbWinSock
extend Fiddle::Importer
dlload "kernel32"
extern "int GetModuleFileNameA(int, char *, int)"
extern "int CloseHandle(int)"
ruby_bin_path_buf = Fiddle::Pointer.malloc(1000)
GetModuleFileNameA(0, ruby_bin_path_buf, ruby_bin_path_buf.size)
ruby_bin_path = ruby_bin_path_buf.to_s.gsub(/\\/, '/')
ruby_dll_paths = File.dirname(ruby_bin_path) + '/*msvcr*ruby*.dll'
ruby_dll_path = Dir.glob(ruby_dll_paths).first
dlload ruby_dll_path
extern "int rb_w32_map_errno(int)"
```
On 3.0.x, this test is passed.
Moreover, I don't find any changes about `rb_w32_map_errno` from 3.0.3 to 3.1.0.
It is strange behavior. It may be a bug in Ruby-3.1.0
## Environment
- Github Actions (windows-latest)
- use https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.1.0-1/rubyinstaller-3.1.0-1-x64.7z
- permalink to failed test (https://github.com/fluent-plugins-nursery/fluent-plugin-bigquery/runs/4775813193?check_suite_focus=true)
I apologize for the lack of research, as I do not have a Windows environment.
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* [ruby-dev:51134] [Ruby master Bug#18472] rb_w32_map_errno is not found on Ruby-3.1.0
2022-01-11 14:11 [ruby-dev:51132] [Ruby master Bug#18472] rb_w32_map_errno does not found on Ruby-3.1.0 joker1007 (Tomohiro Hashidate)
2022-01-12 9:57 ` [ruby-dev:51133] [Ruby master Bug#18472] rb_w32_map_errno is " kubo (Takehiro Kubo)
@ 2022-01-13 9:53 ` kubo (Takehiro Kubo)
2022-01-13 9:59 ` [ruby-dev:51135] " ashie (Takuro Ashie)
2 siblings, 0 replies; 4+ messages in thread
From: kubo (Takehiro Kubo) @ 2022-01-13 9:53 UTC (permalink / raw)
To: ruby-dev
Issue #18472 has been updated by kubo (Takehiro Kubo).
The error itself was fixed by https://github.com/treasure-data/serverengine/pull/116#issuecomment-1011931598.
There is another error in serverengine using ruby 3.1 but it is unrelated to this issue.
----------------------------------------
Bug #18472: rb_w32_map_errno is not found on Ruby-3.1.0
https://bugs.ruby-lang.org/issues/18472#change-95944
* Author: joker1007 (Tomohiro Hashidate)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.1.0p0 (2021-12-25 revision fb4df44d16) [x64-mingw-ucrt]
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------
I faced Fiddle::DLError such following.
```
C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/3.1.0/fiddle/import.rb:297:in `import_function': cannot find the function: rb_w32_map_errno() (Fiddle::DLError)
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/3.1.0/fiddle/import.rb:170:in `extern'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/winsock.rb:112:in `<module:RbWinSock>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/winsock.rb:97:in `<module:ServerEngine>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/winsock.rb:18:in `<top (required)>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/socket_manager_win.rb:21:in `require_relative'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/socket_manager_win.rb:21:in `<top (required)>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/socket_manager.rb:222:in `require_relative'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/socket_manager.rb:222:in `<module:SocketManager>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/socket_manager.rb:26:in `<module:ServerEngine>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/socket_manager.rb:25:in `<top (required)>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/process_manager.rb:19:in `require'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/process_manager.rb:19:in `<top (required)>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/supervisor.rb:20:in `require'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/supervisor.rb:20:in `<top (required)>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/daemon.rb:21:in `require'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/daemon.rb:21:in `<top (required)>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine.rb:26:in `require'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine.rb:26:in `<module:ServerEngine>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine.rb:18:in `<top (required)>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/fluentd-1.14.4/lib/fluent/test/log.rb:17:in `require'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/fluentd-1.14.4/lib/fluent/test/log.rb:17:in `<top (required)>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/fluentd-1.14.4/lib/fluent/test.rb:19:in `require'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/fluentd-1.14.4/lib/fluent/test.rb:19:in `<top (required)>'
from D:/a/fluent-plugin-bigquery/fluent-plugin-bigquery/test/helper.rb:6:in `require'
from D:/a/fluent-plugin-bigquery/fluent-plugin-bigquery/test/helper.rb:6:in `<top (required)>'
from D:/a/fluent-plugin-bigquery/fluent-plugin-bigquery/test/plugin/test_out_bigquery_base.rb:1:in `require'
from D:/a/fluent-plugin-bigquery/fluent-plugin-bigquery/test/plugin/test_out_bigquery_base.rb:1:in `<top (required)>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/rake_test_loader.rb:21:in `require'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/rake_test_loader.rb:21:in `block in <main>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/rake_test_loader.rb:6:in `select'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/rake_test_loader.rb:6:in `<main>'
rake aborted!
```
The cause code is here. (https://github.com/treasure-data/serverengine/blob/4d6dbd3d1b4e1af88cc2593b5b19cf0f6da7d5dd/lib/serverengine/winsock.rb#L112)
```ruby
module RbWinSock
extend Fiddle::Importer
dlload "kernel32"
extern "int GetModuleFileNameA(int, char *, int)"
extern "int CloseHandle(int)"
ruby_bin_path_buf = Fiddle::Pointer.malloc(1000)
GetModuleFileNameA(0, ruby_bin_path_buf, ruby_bin_path_buf.size)
ruby_bin_path = ruby_bin_path_buf.to_s.gsub(/\\/, '/')
ruby_dll_paths = File.dirname(ruby_bin_path) + '/*msvcr*ruby*.dll'
ruby_dll_path = Dir.glob(ruby_dll_paths).first
dlload ruby_dll_path
extern "int rb_w32_map_errno(int)"
```
On 3.0.x, this test is passed.
Moreover, I don't find any changes about `rb_w32_map_errno` from 3.0.3 to 3.1.0.
It is strange behavior. It may be a bug in Ruby-3.1.0
## Environment
- Github Actions (windows-latest)
- use https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.1.0-1/rubyinstaller-3.1.0-1-x64.7z
- permalink to failed test (https://github.com/fluent-plugins-nursery/fluent-plugin-bigquery/runs/4775813193?check_suite_focus=true)
I apologize for the lack of research, as I do not have a Windows environment.
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* [ruby-dev:51135] [Ruby master Bug#18472] rb_w32_map_errno is not found on Ruby-3.1.0
2022-01-11 14:11 [ruby-dev:51132] [Ruby master Bug#18472] rb_w32_map_errno does not found on Ruby-3.1.0 joker1007 (Tomohiro Hashidate)
2022-01-12 9:57 ` [ruby-dev:51133] [Ruby master Bug#18472] rb_w32_map_errno is " kubo (Takehiro Kubo)
2022-01-13 9:53 ` [ruby-dev:51134] " kubo (Takehiro Kubo)
@ 2022-01-13 9:59 ` ashie (Takuro Ashie)
2 siblings, 0 replies; 4+ messages in thread
From: ashie (Takuro Ashie) @ 2022-01-13 9:59 UTC (permalink / raw)
To: ruby-dev
Issue #18472 has been updated by ashie (Takuro Ashie).
I've released a fixed version of serverengine: https://rubygems.org/gems/serverengine/versions/2.2.5
Thanks for your report!
----------------------------------------
Bug #18472: rb_w32_map_errno is not found on Ruby-3.1.0
https://bugs.ruby-lang.org/issues/18472#change-95945
* Author: joker1007 (Tomohiro Hashidate)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.1.0p0 (2021-12-25 revision fb4df44d16) [x64-mingw-ucrt]
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------
I faced Fiddle::DLError such following.
```
C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/3.1.0/fiddle/import.rb:297:in `import_function': cannot find the function: rb_w32_map_errno() (Fiddle::DLError)
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/3.1.0/fiddle/import.rb:170:in `extern'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/winsock.rb:112:in `<module:RbWinSock>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/winsock.rb:97:in `<module:ServerEngine>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/winsock.rb:18:in `<top (required)>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/socket_manager_win.rb:21:in `require_relative'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/socket_manager_win.rb:21:in `<top (required)>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/socket_manager.rb:222:in `require_relative'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/socket_manager.rb:222:in `<module:SocketManager>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/socket_manager.rb:26:in `<module:ServerEngine>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/socket_manager.rb:25:in `<top (required)>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/process_manager.rb:19:in `require'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/process_manager.rb:19:in `<top (required)>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/supervisor.rb:20:in `require'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/supervisor.rb:20:in `<top (required)>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/daemon.rb:21:in `require'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine/daemon.rb:21:in `<top (required)>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine.rb:26:in `require'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine.rb:26:in `<module:ServerEngine>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/serverengine-2.2.4/lib/serverengine.rb:18:in `<top (required)>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/fluentd-1.14.4/lib/fluent/test/log.rb:17:in `require'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/fluentd-1.14.4/lib/fluent/test/log.rb:17:in `<top (required)>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/fluentd-1.14.4/lib/fluent/test.rb:19:in `require'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/fluentd-1.14.4/lib/fluent/test.rb:19:in `<top (required)>'
from D:/a/fluent-plugin-bigquery/fluent-plugin-bigquery/test/helper.rb:6:in `require'
from D:/a/fluent-plugin-bigquery/fluent-plugin-bigquery/test/helper.rb:6:in `<top (required)>'
from D:/a/fluent-plugin-bigquery/fluent-plugin-bigquery/test/plugin/test_out_bigquery_base.rb:1:in `require'
from D:/a/fluent-plugin-bigquery/fluent-plugin-bigquery/test/plugin/test_out_bigquery_base.rb:1:in `<top (required)>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/rake_test_loader.rb:21:in `require'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/rake_test_loader.rb:21:in `block in <main>'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/rake_test_loader.rb:6:in `select'
from C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/rake_test_loader.rb:6:in `<main>'
rake aborted!
```
The cause code is here. (https://github.com/treasure-data/serverengine/blob/4d6dbd3d1b4e1af88cc2593b5b19cf0f6da7d5dd/lib/serverengine/winsock.rb#L112)
```ruby
module RbWinSock
extend Fiddle::Importer
dlload "kernel32"
extern "int GetModuleFileNameA(int, char *, int)"
extern "int CloseHandle(int)"
ruby_bin_path_buf = Fiddle::Pointer.malloc(1000)
GetModuleFileNameA(0, ruby_bin_path_buf, ruby_bin_path_buf.size)
ruby_bin_path = ruby_bin_path_buf.to_s.gsub(/\\/, '/')
ruby_dll_paths = File.dirname(ruby_bin_path) + '/*msvcr*ruby*.dll'
ruby_dll_path = Dir.glob(ruby_dll_paths).first
dlload ruby_dll_path
extern "int rb_w32_map_errno(int)"
```
On 3.0.x, this test is passed.
Moreover, I don't find any changes about `rb_w32_map_errno` from 3.0.3 to 3.1.0.
It is strange behavior. It may be a bug in Ruby-3.1.0
## Environment
- Github Actions (windows-latest)
- use https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.1.0-1/rubyinstaller-3.1.0-1-x64.7z
- permalink to failed test (https://github.com/fluent-plugins-nursery/fluent-plugin-bigquery/runs/4775813193?check_suite_focus=true)
I apologize for the lack of research, as I do not have a Windows environment.
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-01-13 10:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-11 14:11 [ruby-dev:51132] [Ruby master Bug#18472] rb_w32_map_errno does not found on Ruby-3.1.0 joker1007 (Tomohiro Hashidate)
2022-01-12 9:57 ` [ruby-dev:51133] [Ruby master Bug#18472] rb_w32_map_errno is " kubo (Takehiro Kubo)
2022-01-13 9:53 ` [ruby-dev:51134] " kubo (Takehiro Kubo)
2022-01-13 9:59 ` [ruby-dev:51135] " ashie (Takuro Ashie)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).