PREFIX enviroment variable pollutes gem search path

Steve Wills swills at FreeBSD.org
Tue Jan 3 15:20:17 UTC 2017


Hi,

On 01/03/2017 09:27, José G. Juanino wrote:
>> 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).
> 

This was added in r210636 (nearly 8 years ago) to "allow modules to be
installed into separate PREFIX and/or under user privilegies" (sic) and
so far I believe this is the first issue I've seen with it.

Can you explain in more detail what existing code this breaks and how
specifically it breaks? It may not be necessary and I actually
considered removing it when adding 2.4 recently but I need to understand
it in more detail first (which is why I didn't remove it already). While
this may break things for some, I can imagine others relying on it.

Thanks,
Steve


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 632 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-ruby/attachments/20170103/487f58b3/attachment.sig>


More information about the freebsd-ruby mailing list