Bug #20867
closedbundle and Gem.user_dir with spaces or require_relative dir with spaces
Description
Trying to run bundle exec rspec or bundle exec hanami. My username on my work computer has space in it "Dominic E Sisneros" (not by choice). When trying to run I get the following output
C:\windows_home\ruby\ruby-3.3.4-1\bin\ruby.exe: unknown encoding name - Sisneros/.gem/ruby/3.3.0/gems/bundler-2.5.17/lib/bundler/setup (RuntimeError)
I thing this is because in ruby/lib/bundler/cli/exec.rb when it runs kernel_load
it require_relative("../setup")
. Not sure why because require_relative usually works fine when loading from a directory with spaces.
C:\windows_home\repos\github.com\dsisnero\hanami_mastery>gem env
RubyGems Environment:
- RUBYGEMS VERSION: 3.5.22
- RUBY VERSION: 3.3.4 (2024-07-09 patchlevel 94) [x64-mingw-ucrt]
- INSTALLATION DIRECTORY: c:/windows_home/.local/share/gem
- USER INSTALLATION DIRECTORY: C:/Users/Dominic E Sisneros/.gem/ruby/3.3.0
- RUBY EXECUTABLE: C:/windows_home/ruby/ruby-3.3.4-1/bin/ruby.exe
- GIT EXECUTABLE: C:\windows_home\.local\share\Git\cmd/git.EXE
- EXECUTABLE DIRECTORY: c:/windows_home/.local/share/gem/bin
- SPEC CACHE DIRECTORY: c:\windows_home\.cache\gem
- SYSTEM CONFIGURATION DIRECTORY: C:/ProgramData
- RUBYGEMS PLATFORMS:
- ruby
- x64-mingw-ucrt
- GEM PATHS:
- c:/windows_home/.local/share/gem
- C:/Users/Dominic E Sisneros/.gem/ruby/3.3.0
- C:/windows_home/ruby/ruby-3.3.4-1/lib/ruby/gems/3.3.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => true
- :bulk_threshold => 1000
- :sources => ["https://rubygems.org/", "https://dsisnero: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@rubygems.pkg.github.com/dsisnero/"]
- :concurrent_downloads => 8
- "gem" => "--document=yri"
- "install" => "--no-user-install"
- REMOTE SOURCES:
- https://rubygems.org/
- https://dsisnero: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@rubygems.pkg.github.com/dsisnero/
- SHELL PATH:
- c:\windows_home\.local\state\fnm_multishells\30280_1730819448963
- c:\Oracle\product\19.0.0\client_1\bin
- C:\WINDOWS\system32
- C:\WINDOWS
- C:\WINDOWS\System32\Wbem
- C:\WINDOWS\System32\WindowsPowerShell\v1.0\
- C:\WINDOWS\System32\OpenSSH\
- C:\Program Files (x86)\HID Global\ActivClient\
- C:\Program Files\HID Global\ActivClient\
- C:\Program Files\Tumbleweed\Desktop Validator\
- C:\Program Files\Tumbleweed\Desktop Validator\x86
- C:\Program Files\dotnet\
- C:\Program Files (x86)\dotnet\
- C:\Program Files (x86)\Common Files\Pulse Secure\VC142.CRT\X64\
- C:\Program Files (x86)\Common Files\Pulse Secure\VC142.CRT\X86\
- C:\Program Files (x86)\Pulse Secure\VC142.CRT\X64\
- C:\Program Files (x86)\Pulse Secure\VC142.CRT\X86\
- C:\Program Files (x86)\Common Files\Pulse Secure\TNC Client Plugin\
- C:\Program Files\Microsoft SQL Server\150\Tools\Binn\
- C:\Program Files\RedHat\java-1.8.0-openjdk-1.8.0.372-1\jre\bin
- E:\windows\tools\dotnet_uninstall\
- C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\
- E:\Windows Kits\10\Windows Performance Toolkit\
- C:\Program Files (x86)\dotnet-core-uninstall\
- C:\Windows Kits\10\Windows Performance Toolkit\
- C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common
- C:\windows_home\tools\gh_cli\
- c:\windows_home\tools\rust\.cargo\bin
- D:\windows_home\tools\ruby\Ruby33-x64\bin
- C:\windows_home\.local\share\scoop\apps\nvm\current
- C:\windows_home\tools\python\python3.1.2\Scripts\
- C:\windows_home\tools\python\python3.1.2\
- C:\Users\Dominic E Sisneros\.dotnet\tools
- C:\windows_home\.local\share\Git\cmd
- c:\windows_home\vcpkg
- D:\windows_home\llvm\bin
- D:\windows_home\tools\ltex\ltex-ls-16.0.0\bin
- C:\windows_home\.local\share\visual_studio\ide\2022\professional\DIA SDK\bin\amd64
- C:\Users\Dominic E Sisneros\AppData\Local\Programs\Ollama
- C:\Users\Dominic E Sisneros\.dotnet\tools
- C:\Users\Dominic E Sisneros\AppData\Local\Microsoft\WindowsApps
- C:\Users\Dominic E Sisneros\AppData\Local\Programs\oh-my-posh\bin
- C:\Users\Dominic E Sisneros\AppData\Local\Microsoft\WinGet\Links
- C:\windows_home\tools\nvim-win64\bin
- C:\windows_home\tools\bin
- C:\windows_home\tools\crystal
- C:\windows_home\tools\KeePassXC-2.7.9-Win64
- C:\windows_home\ruby\ruby-3.3.4-1\bin
- C:\windows_home\tools\gnuwin32\bin
- C:\windows_home\.local\bin
- C:\msys64\ucrt64\bin
- C:\windows_home\tools\go\bin
C:\windows_home\repos\github.com\dsisnero\hanami_mastery>
Updated by nobu (Nobuyoshi Nakada) about 1 month ago
- Description updated (diff)
dsisnero (Dominic Sisneros) wrote:
Trying to run bundle exec rspec or bundle exec hanami. My username on my work computer has space in it "Dominic E Sisneros" (not by choice). When trying to run I get the following output
C:\windows_home\ruby\ruby-3.3.4-1\bin\ruby.exe: unknown encoding name - Sisneros/.gem/ruby/3.3.0/gems/bundler-2.5.17/lib/bundler/setup (RuntimeError)
It seems like RUBYOPT
environment variable contains your username, probably defined in Bundler::SharedHelpers#set_rubyopt
.
$ RUBYOPT="-rC:/Users/Dominic E Sisneros/.gem/ruby/3.3.0/gems/bundler-2.5.17/lib/bundler/setup" ruby -ep
ruby: unknown encoding name - Sisneros/.gem/ruby/3.3.0/gems/bundler-2.5.17/lib/bundler/setup (RuntimeError)
Updated by dsisnero (Dominic Sisneros) about 1 month ago
I don't have RUBYOPT set in my environment -Is bundler setting it?
Updated by nobu (Nobuyoshi Nakada) about 1 month ago
probably defined in
Bundler::SharedHelpers#set_rubyopt
.
Updated by nobu (Nobuyoshi Nakada) about 1 month ago
Bundler::SharedHelpers#set_rubylib
sets RUBYLIB
to include bundler_ruby_lib
.
So it may work by just setting RUBYOPT
to -rbundler/setup
in Bundler::SharedHelpers#set_rubyopt
.
I don't know why it sets the absolute path, please ask the bundler upstream.
Updated by hsbt (Hiroshi SHIBATA) about 1 month ago
- Status changed from Open to Third Party's Issue