Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ridk install fails on Ruby <= 3.0.x when there is a special character in path #380

Open
magynhard opened this issue May 11, 2024 · 2 comments

Comments

@magynhard
Copy link
Contributor

magynhard commented May 11, 2024

What problems are you experiencing?

When running ridk with Ruby <= 3.0.x from a path, including special characters (e.g. Umlauts), the ridk script crashes instantly.

Steps to reproduce

Install any ruby version <= 3.0.x from Rubyinstaller inside a path with special character, ensure PATH variable to its bin directory is set or open the bin directory in the command line. In my case they were installed in the user directory with a username containing a special character.

Running latest Windows 11, German locale.

Then run:

ridk install 1 2 3

The output will be:

Traceback (most recent call last):
        9: from <internal:gem_prelude>:1:in `<internal:gem_prelude>'
        8: from <internal:gem_prelude>:1:in `require'
        7: from C:/Users/Matthäus/.rvm/envs/ruby-2.7.8/lib/ruby/2.7.0/rubygems.rb:1427:in `<top (required)>'
        6: from C:/Users/Matthäus/.rvm/envs/ruby-2.7.8/lib/ruby/2.7.0/rubygems.rb:1427:in `require'
        5: from C:/Users/Matthäus/.rvm/envs/ruby-2.7.8/lib/ruby/2.7.0/rubygems/defaults/operating_system.rb:24:in `<top (required)>'
        4: from C:/Users/Matthäus/.rvm/envs/ruby-2.7.8/lib/ruby/site_ruby/2.7.0/ruby_installer/runtime/singleton.rb:27:in `enable_dll_search_paths'
        3: from C:/Users/Matthäus/.rvm/envs/ruby-2.7.8/lib/ruby/site_ruby/2.7.0/ruby_installer/runtime/msys2_installation.rb:126:in `enable_dll_search_paths'
        2: from C:/Users/Matthäus/.rvm/envs/ruby-2.7.8/lib/ruby/site_ruby/2.7.0/ruby_installer/runtime/msys2_installation.rb:126:in `new'
        1: from C:/Users/Matthäus/.rvm/envs/ruby-2.7.8/lib/ruby/site_ruby/2.7.0/ruby_installer/runtime/dll_directory.rb:64:in `initialize'
C:/Users/Matthäus/.rvm/envs/ruby-2.7.8/lib/ruby/site_ruby/2.7.0/ruby_installer/runtime/dll_directory.rb:104:in `add_dll_directory_winapi': AddDllDirectory failed for C:/Users/Matthäus/.rvm/envs/ruby-2.7.8/msys64/mingw64/bin (RubyInstaller::Runtime::DllDirectory::WinApiError)

What's the output from ridk version?

Does not run as well, the output in this case is excactly the same as mentioned above. No ridk command is working at all. I tried the latest Ruby 2.7.8 and 3.0.7 from RubyInstaller without any modification.

Additional info

From Ruby >= 3.1.x it works without any problems, if there is a special character in the path of the ruby installation.

On Ruby 2.4.10 / 2.5.9 / 2.6.10 the error is different, here the path itself is encoded the wrong way when running ridk:

<internal:gem_prelude>:4:in `require': No such file or directory -- C:/Users/Matthäus/.rvm/envs/ruby-2.4.10/lib/ruby/2.4.0/rubygems.rb (LoadError)
        from <internal:gem_prelude>:4:in `<internal:gem_prelude>'
@MSP-Greg
Copy link
Contributor

Messy issue.

All the affected Rubies are EOL. Also, they report ASCII-8BIT to the following, but Ruby 3.0 and later report UTF-8:

ruby -e "puts ENV['PATH'].encoding"

See ruby/ruby#3818

ridk could be patched to work around these issues, but that still leaves issues with Ruby itself...

@magynhard
Copy link
Contributor Author

@MSP-Greg thank you very much for your response!

I noticed this problem because I am currently developing a version manager for the classic Windows Command Line that is compatible with RVM.io.

Since special characters in the path are probably a special Edge case as long as you do not install in the user directory, I will check to generally switch to C:\ProgramData by default, making it even more easier to reuse it for multi user environments.

So i guess, it is not worth to make a patch for this, but to mention this problem in the docs benath the problem with empty spaces in paths, to avoid using paths with special characters:
PullRequest: #381

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants