Ruby with `--with-sitedir=no` configuration
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 4k
- Forks
- 1.9k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 81
Description
I am trying to prepare minimal and self contained Ruby RPM package. Therefore I chose to configure Ruby using --with-sitedir=no --with-vendordir=no configuration options. And now I am facing test suite errors such as:
111) Error:
TestGemCommandsSetupCommand#test_execute_regenerate_binstubs:
Errno::ENOENT: No such file or directory @ dir_chdir0 - $(sitedir)/ruby3.3/rubygems
/builddir/build/BUILD/ruby-3.3.0/lib/rubygems/commands/setup_command.rb:465:in `chdir'
/builddir/build/BUILD/ruby-3.3.0/lib/rubygems/commands/setup_command.rb:465:in `files_in'
/builddir/build/BUILD/ruby-3.3.0/lib/rubygems/commands/setup_command.rb:509:in `block in remove_old_lib_files'
/builddir/build/BUILD/ruby-3.3.0/lib/rubygems/commands/setup_command.rb:506:in `each'
/builddir/build/BUILD/ruby-3.3.0/lib/rubygems/commands/setup_command.rb:506:in `remove_old_lib_files'
/builddir/build/BUILD/ruby-3.3.0/lib/rubygems/commands/setup_command.rb:170:in `execute'
/builddir/build/BUILD/ruby-3.3.0/test/rubygems/test_gem_commands_setup_command.rb:68:in `test_execute_regenerate_binstubs'
If I understand correctly, the $(sitedir) actually comes from here:
In normal situation, with the default site dir configuration, the RbConfig::CONFIG[site_or_vendor] would be expanded into proper path. However, with disabled site dir, the RbConfig does not have value for the sitedir, therefore the $(sitedir) is kept. It seems that the Ruby's rbinstall.rb script handles this scenario:
IOW, I don't think this is just test suite error. The test suite error correctly points out that there might be user scenario, which is not correctly handled (is it trying to update RubyGems via gem update?). If this is valid Ruby configuration, I believe that RubyGems should properly handle this situation (even if "properly" was just reporting that there is no location for updated RubyGems).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with lib/rubygems/commands/setup_command.rb around lines 449-462 and test/rubygems/test_gem_commands_setup_command.rb, then compare the handling in tool/rbinstall.rb around lines 354-361. Run the cited setup-command test with --with-sitedir=no and --with-vendordir=no; done means the configuration has defined, correct behavior without the ENOENT failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100