ruby-dev (Japanese) list archive (unofficial mirror)
 help / color / mirror / Atom feed
* [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

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).