Show
added a comment - Daniel: Since it sounds like we're behaving like MRI here wrt spaces in RUBYOPT, can we mark this one "not a bug" and open a separate issue for "jruby -S irb" not honoring RUBYOPT properly? That will probably be simple to fix, but I want to resolve this issue to your satisfaction before it starts leaking into an unrelated behavioral problem.
FTR, here's JRuby and MRI. We're obviously not honoring RUBYOPT with -S correctly:
~/projects/jruby ➔ RUBYOPT=-rubygems jruby -S irb
>> p $"
["enumerator.jar", "irb.rb", "e2mmap.rb", "irb/init.rb", "irb/context.rb", "irb/workspace.rb", "irb/extend-command.rb", "irb/ruby-lex.rb", "irb/slex.rb", "irb/notifier.rb", "irb/output-method.rb", "irb/ruby-token.rb", "irb/input-method.rb", "readline.jar", "irb/locale.rb", "irb/completion.rb", "irb/ext/save-history.rb", "jsignal_internal.rb"]
=> nil
>> quit
~/projects/jruby ➔ RUBYOPT=-rubygems ruby -S irb
>> p $"
["enumerator.so", "rubygems/defaults.rb", "thread.bundle", "thread.rb", "etc.bundle", "rbconfig.rb", "rubygems/exceptions.rb", "rubygems/version.rb", "rubygems/requirement.rb", "rubygems/dependency.rb", "rubygems/gem_path_searcher.rb", "rubygems/user_interaction.rb", "rubygems/platform.rb", "rubygems/specification.rb", "rubygems/source_index.rb", "rubygems/builder.rb", "rubygems/config_file.rb", "rubygems/custom_require.rb", "stringio.bundle", "yaml/error.rb", "syck.bundle", "yaml/ypath.rb", "yaml/basenode.rb", "yaml/syck.rb", "yaml/tag.rb", "yaml/stream.rb", "yaml/constants.rb", "rational.rb", "date/format.rb", "date.rb", "yaml/rubytypes.rb", "yaml/types.rb", "yaml.rb", "timeout.rb", "optparse.rb", "rubygems/command.rb", "rubygems/command_manager.rb", "bundler08/commands/bundle_command.rb", "bundler08/commands/exec_command.rb", "rubygems.rb", "ubygems.rb", "e2mmap.rb", "irb/init.rb", "irb/workspace.rb", "irb/context.rb", "irb/extend-command.rb", "irb/output-method.rb", "irb/notifier.rb", "irb/slex.rb", "irb/ruby-token.rb", "irb/ruby-lex.rb", "readline.bundle", "irb/input-method.rb", "irb/locale.rb", "irb.rb", "irb/completion.rb", "irb/ext/save-history.rb"]
=> nil
This one appears to afflict MRI as well, so I'm not sure the proper path forward:
Like MRI, we take the RUBYOPT value and split it on spaces. So in this case, we simply cut the -I path in half. It might be possible to add logic for quoted strings, but we'd essentially be duplicating command-line argument processing ourselves.
Can you check whether C Ruby works properly in this case? If it does not, that doesn't mean we won't try to fix it, but it will mean we might need some help since we're covering new ground.