When I try to load rubygems, it crashes with following error.
To reproduce this, the following conditions must be satisfied:
Make sure MSYS2 isn't installed
If you install it already, please rename the folder of MSYS2 installed.
Run ruby with -Eascii-8bit:ascii-8bit
Add a registry key with non-ASCII charater to HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\
I'm not sure but it seems that such poorly mannered software rarely exists.
I tried with a key HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\あいうえお
C:\Users\aho\Downloads\rubyinstaller-3.3.0-1-x64\bin>echo "require 'rubygems'" | ruby -Eascii-8bit:ascii-8bit
C:/Users/aho/Downloads/rubyinstaller-3.3.0-1-x64/lib/ruby/3.3.0/rubygems.rb:1336:in `rescue in <top (required)>': U+3042 to ASCII-8BIT in conversion from UTF-16LE to UTF-8 to ASCII-8BIT (Encoding::UndefinedConversionError)
Loading the C:/Users/aho/Downloads/rubyinstaller-3.3.0-1-x64/lib/ruby/3.3.0/rubygems/defaults/operating_system.rb file caused an error. This file is owned by your OS, not by rubygems upstream. Please find out which OS package this file belongs to and follow the guidelines from your OS to report the problem and ask for help.
from C:/Users/aho/Downloads/rubyinstaller-3.3.0-1-x64/lib/ruby/3.3.0/rubygems.rb:1322:in `<top (required)>'
from <internal:gem_prelude>:2:in `require'
from <internal:gem_prelude>:2:in `<internal:gem_prelude>'
C:/Users/aho/Downloads/rubyinstaller-3.3.0-1-x64/lib/ruby/3.3.0/win32/registry.rb:910:in `encode': U+3042 to ASCII-8BIT in conversion from UTF-16LE to UTF-8 to ASCII-8BIT (Encoding::UndefinedConversionError)
from C:/Users/aho/Downloads/rubyinstaller-3.3.0-1-x64/lib/ruby/3.3.0/win32/registry.rb:910:in `export_string'
from C:/Users/aho/Downloads/rubyinstaller-3.3.0-1-x64/lib/ruby/3.3.0/win32/registry.rb:611:in `each_key'
from C:/Users/aho/Downloads/rubyinstaller-3.3.0-1-x64/lib/ruby/site_ruby/3.3.0/ruby_installer/runtime/msys2_installation.rb:71:in `block (2 levels) in iterate_msys_paths'
from C:/Users/aho/Downloads/rubyinstaller-3.3.0-1-x64/lib/ruby/3.3.0/win32/registry.rb:435:in `open'
from C:/Users/aho/Downloads/rubyinstaller-3.3.0-1-x64/lib/ruby/3.3.0/win32/registry.rb:542:in `open'
from C:/Users/aho/Downloads/rubyinstaller-3.3.0-1-x64/lib/ruby/site_ruby/3.3.0/ruby_installer/runtime/msys2_installation.rb:70:in `block in iterate_msys_paths'
from C:/Users/aho/Downloads/rubyinstaller-3.3.0-1-x64/lib/ruby/site_ruby/3.3.0/ruby_installer/runtime/msys2_installation.rb:68:in `each'
from C:/Users/aho/Downloads/rubyinstaller-3.3.0-1-x64/lib/ruby/site_ruby/3.3.0/ruby_installer/runtime/msys2_installation.rb:68:in `iterate_msys_paths'
from C:/Users/aho/Downloads/rubyinstaller-3.3.0-1-x64/lib/ruby/site_ruby/3.3.0/ruby_installer/runtime/msys2_installation.rb:102:in `msys_path'
from C:/Users/aho/Downloads/rubyinstaller-3.3.0-1-x64/lib/ruby/site_ruby/3.3.0/ruby_installer/runtime/msys2_installation.rb:115:in `mingw_bin_path'
from C:/Users/aho/Downloads/rubyinstaller-3.3.0-1-x64/lib/ruby/site_ruby/3.3.0/ruby_installer/runtime/msys2_installation.rb:125:in `enable_dll_search_paths'
from C:/Users/aho/Downloads/rubyinstaller-3.3.0-1-x64/lib/ruby/site_ruby/3.3.0/ruby_installer/runtime/singleton.rb:27:in `enable_dll_search_paths'
from C:/Users/aho/Downloads/rubyinstaller-3.3.0-1-x64/lib/ruby/3.3.0/rubygems/defaults/operating_system.rb:24:in `<top (required)>'
from C:/Users/aho/Downloads/rubyinstaller-3.3.0-1-x64/lib/ruby/3.3.0/rubygems.rb:1326:in `require'
from C:/Users/aho/Downloads/rubyinstaller-3.3.0-1-x64/lib/ruby/3.3.0/rubygems.rb:1326:in `<top (required)>'
from <internal:gem_prelude>:2:in `require'
from <internal:gem_prelude>:2:in `<internal:gem_prelude>'
C:\Users\aho\Downloads\rubyinstaller-3.3.0-1-x64\bin>ridk version
---
ruby:
path: C:/Users/aho/Downloads/rubyinstaller-3.3.0-1-x64
version: 3.3.0
platform: x64-mingw-ucrt
cc: gcc.exe (Rev3, Built by MSYS2 project) 13.2.0
ruby_installer:
package_version: 3.3.0-1
git_commit: d808ebc
sh: GNU bash, version 5.2.21(1)-release (x86_64-pc-msys)
os: Microsoft Windows [Version 10.0.19045.3930]
Additional comment
Although using with -Eascii-8bit:ascii-8bit might not recommended for RubyInstaller, we are using it in our product (Fluentd).
In this situation, this issue is hard to avoid in our product since it's occurred on very earlier stage in gem executables.
So it would be happy if RubyInstaller provides a way to suppress this issue.
What problems are you experiencing?
When I try to load
rubygems
, it crashes with following error. To reproduce this, the following conditions must be satisfied:-Eascii-8bit:ascii-8bit
HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\
HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\あいうえお
We met this bug with Fluentd. Please see also https://github.com/fluent/fluent-package-builder/issues/616
Steps to reproduce
Please see above
What's the output from
ridk version
?Additional comment
Although using with
-Eascii-8bit:ascii-8bit
might not recommended for RubyInstaller, we are using it in our product (Fluentd). In this situation, this issue is hard to avoid in our product since it's occurred on very earlier stage in gem executables. So it would be happy if RubyInstaller provides a way to suppress this issue.refs: