ruby-dev (Japanese) list archive (unofficial mirror)
 help / color / mirror / Atom feed
From: "joker1007 (Tomohiro Hashidate)" <noreply@ruby-lang.org>
To: ruby-dev@ruby-lang.org
Subject: [ruby-dev:51132] [Ruby master Bug#18472] rb_w32_map_errno does not found on Ruby-3.1.0
Date: Tue, 11 Jan 2022 14:11:08 +0000 (UTC)	[thread overview]
Message-ID: <redmine.issue-18472.20220111141107.8753@ruby-lang.org> (raw)
In-Reply-To: <redmine.issue-18472.20220111141107.8753@ruby-lang.org>

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/

       reply	other threads:[~2022-01-11 14:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-11 14:11 joker1007 (Tomohiro Hashidate) [this message]
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)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.issue-18472.20220111141107.8753@ruby-lang.org \
    --to=noreply@ruby-lang.org \
    --cc=ruby-dev@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).