Date: Tue, 3 Jan 2017 15:27:49 +0100 From: =?iso-8859-1?Q?Jos=E9_G=2E?= Juanino <jjuanino@gmail.com> To: freebsd-ruby@freebsd.org Subject: Re: PREFIX enviroment variable pollutes gem search path Message-ID: <20170103142749.62nzduottim5wxpj@abel.home.inet> In-Reply-To: <20170103000758.pnoglvxtseec2xpn@abel.home.inet> References: <20170103000758.pnoglvxtseec2xpn@abel.home.inet>
next in thread | previous in thread | raw e-mail | index | archive | help
El martes 03 de enero a las 01:07:58 CET, José G. Juanino escribió: >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. I think that the root issue is this sentence in lang/ruby22 Makefile: @${RB_SET_CONF_VAR} "prefix" "ENV['PREFIX'] || \3" It set the following in /usr/local/lib/ruby/2.2/amd64-freebsd11/rbconfig.rb: CONFIG["prefix"] = (ENV['PREFIX'] || TOPDIR || DESTDIR + "/usr/local") That is wrong, as rbconfig.rb is sourced by gem infraestructure, and therefore the result is dependent of your specific environment at *runtime*. (Please keep me in Cc:, as I am not subscribed to the list). Regards -- José G. Juanino
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20170103142749.62nzduottim5wxpj>