Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Check for the existence of Rubinius::LIB_PATH and actually tell the user in case of error #1671

merged 3 commits into from

3 participants


Current code in kernel/loader.rb ignores the check for existence of Rubinius::LIB_PATH, and the logic also disables the message about main library not existing, since it depends on Rubinius::LIB_PATH being nil, which is never the case.

Here's a fix for that, in which we first test the path specified in environment variable RBX_LIB (if any) and then the configured Rubinius::LIB_PATH, checking for existence and sending a message to the user in case the path does not exist.

Feel free to ignore the other two commits, they're small cleanups with typo fixes and a microoptimization.


This pull request passes (merged ade22cb into ae1fad4).

@abyx abyx merged commit 3867bfb into rubinius:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 18, 2012
  1. @unleashed

    small typo fixes in kernel

    unleashed authored
  2. @unleashed
  3. @unleashed

    use array literal instead of empty array creation plus Array#<<

    unleashed authored
    This is a microoptimization, but still results in ~12% faster code
    compared to several calls to Array#<<.
This page is out of date. Refresh to see the latest.
Showing with 20 additions and 21 deletions.
  1. +2 −2 kernel/alpha.rb
  2. +18 −19 kernel/loader.rb
4 kernel/alpha.rb
@@ -171,7 +171,7 @@ def kind_of?(cls)
# This method may be overridden, and is often used to provide dynamic
# behaviour. An overriding version should call super if it fails to
# resolve the message. This practice ensures that the default version
- # will called if all else fails.
+ # will be called if all else fails.
def method_missing(meth, *args)
raise NoMethodError, "Unable to send '#{meth}' on '#{self}' (#{self.class})"
@@ -453,7 +453,7 @@ def const_missing(name)
# Set Module's direct superclass.
- # The corresponding 'getter' #superclass method defined
+ # The corresponding 'getter' #superclass method is defined
# in class.rb, because it is more complex than a mere
# accessor
37 kernel/loader.rb
@@ -74,17 +74,14 @@ def preamble
def system_load_path
@stage = "setting up system load path"
- @main_lib = nil
- if env_lib = ENV['RBX_LIB']
- @main_lib = File.expand_path(env_lib) if File.exists?(env_lib)
- end
- # Use the env version if it's set.
- @main_lib = Rubinius::LIB_PATH unless @main_lib
+ if env_lib = ENV['RBX_LIB'] and File.exists?(env_lib)
+ @main_lib = File.expand_path(env_lib)
+ else
+ # use configured library path and check its existence
+ @main_lib = Rubinius::LIB_PATH
- unless @main_lib
- STDERR.puts <<-EOM
+ unless File.exists?(@main_lib)
+ STDERR.puts <<-EOM
Rubinius was configured to find standard library files at:
@@ -93,7 +90,8 @@ def system_load_path
Set the environment variable RBX_LIB to the directory
containing the Rubinius standard library files.
+ end
@main_lib_bin = File.join @main_lib, "bin"
@@ -101,13 +99,14 @@ def system_load_path
# This conforms more closely to MRI. It is necessary to support
# paths that mkmf adds when compiling and installing native exts.
- additions = []
- additions << Rubinius::SITE_PATH
- additions << "#{Rubinius::SITE_PATH}/#{Rubinius::CPU}-#{Rubinius::OS}"
- additions << Rubinius::VENDOR_PATH
- additions << "#{Rubinius::VENDOR_PATH}/#{Rubinius::CPU}-#{Rubinius::OS}"
- additions << "#{@main_lib}/#{Rubinius::RUBY_LIB_VERSION}"
- additions << @main_lib
+ additions = [
+ Rubinius::SITE_PATH,
+ "#{Rubinius::SITE_PATH}/#{Rubinius::CPU}-#{Rubinius::OS}",
+ Rubinius::VENDOR_PATH,
+ "#{Rubinius::VENDOR_PATH}/#{Rubinius::CPU}-#{Rubinius::OS}",
+ "#{@main_lib}/#{Rubinius::RUBY_LIB_VERSION}",
+ @main_lib,
+ ]
@@ -160,7 +159,7 @@ def show_syntax_errors(syns)
- # Checks if a subcammand with basename +base+ exists. Returns the full
+ # Checks if a subcommand with basename +base+ exists. Returns the full
# path to the subcommand if it does; otherwise, returns nil.
def find_subcommand(base)
command = File.join @main_lib_bin, "#{base}.rb"
Something went wrong with that request. Please try again.