PREFIX enviroment variable pollutes gem search path

José G. Juanino jjuanino at gmail.com
Tue Jan 3 00:08:06 UTC 2017


Hi,

I am suffering an annoying issue loading gem libraries; I am not sure if 
it is FreeBSD specific.

Install some gem, for example rubygem-test-unit-3.1.9, and take a look 
at the following code:


$ ruby22 -r test/unit -e 'puts'
$ PREFIX=1 ruby22 -r test/unit -ne 'puts'
/usr/local/lib/ruby/site_ruby/2.2/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- test/unit (LoadError)
        from /usr/local/lib/ruby/site_ruby/2.2/rubygems/core_ext/kernel_require.rb:55:in `require'

In short: you cannot load any gem if your environment contains the 
PREFIX variable. When this happens, ruby uses the assigned value instead 
of /usr/local to search the proper files. This breaks a lot of existent 
code.

The relevant ports are, installed via pkg:

ruby-2.2.5_1,1
ruby22-gems-2.6.4
ruby23-2.3.1_1,1

The FreeBSD version is 11.0-RELEASE.

This issue did not happen in ruby20, I think.



Regards


-- 
José G. Juanino


More information about the freebsd-ruby mailing list