Date: Tue, 3 Jan 2017 22:39:25 +0100 From: =?iso-8859-1?Q?Jos=E9_G=2E?= Juanino <jjuanino@gmail.com> To: Steve Wills <swills@FreeBSD.org> Cc: freebsd-ruby@freebsd.org Subject: Re: PREFIX enviroment variable pollutes gem search path Message-ID: <20170103213925.dwghtjmnp5k4qu6n@abel.home.inet> In-Reply-To: <e337a1dc-b541-ae80-e74e-8f34437e830d@FreeBSD.org> References: <20170103000758.pnoglvxtseec2xpn@abel.home.inet> <20170103142749.62nzduottim5wxpj@abel.home.inet> <5a2c04e1-81bb-41f6-e727-9b4a53682d9b@FreeBSD.org> <20170103192259.c6ebqxy3jwrsgo5o@abel.home.inet> <e337a1dc-b541-ae80-e74e-8f34437e830d@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--kli75avfofjsnwzp Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Disposition: inline Content-Transfer-Encoding: quoted-printable El martes 03 de enero a las 20:53:18 CET, Steve Wills escribi=F3: > >> But if you run >> *any* ruby dependent port polluted with PREFIX environment variable, and >> that port requires some other gem, it will fails at the moment it >> 'requires' the gem, sure. > >Describing it as "polluted" with a PREFIX environment variable seems a >bit inaccurate to me. PREFIX is a commonly used variable on FreeBSD and >in this case it's mean to indicate to gem where it might find some >things. I'm guessing your custom code checks for this variable as well >and also is meant to use it for something else? Perhaps it could be >change to use a different variable name? Hello Steve, thanks for time and patience. The problem is that if your custom ruby program uses the PREFIX=20 environment variable to achieve some other purpose, you must be aware=20 that your code will use the assigned value to load the required gems,=20 and this is unexpected and will cause a lot of trouble (this reason lead=20 to me to say that PREFIX environment variable polluted the search gem=20 path). A contrived example could be, assuming you have installed=20 devel/rubygem-test-unit: $ echo "require 'test/unit'" > prefix_test.rb $ /usr/local/bin/ruby22 prefix_test.rb $ echo $? 0 $ PREFIX=3D"some_prefix" /usr/local/bin/ruby22 prefix_test.rb /usr/local/lib/ruby/site_ruby/2.2/rubygems/core_ext/kernel_require.rb:55:in= =20 `require': cannot load such file -- test/unit (LoadError) from /usr/local/lib/ruby/site_ruby/2.2/rubygems/core_ext/kernel_req= uire.rb:55:in `require' from prefix_test.rb:1:in `<main>' $ echo $? 1 The error raises because ruby try to find the gem specifications=20 directory in the following nonexistent path:=20 some_prefix/lib/ruby/gems/2.2/specifications instead of: /usr/local/lib/ruby/gems/2.2/gems/specifications You can check this assertion by running a truss in the failed code, and=20 comparing it with the right one. Excuse my poor english, sorry for the misunderstoods. --=20 Jos=E9 G. Juanino --kli75avfofjsnwzp Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEYEARECAAYFAlhsGgoACgkQFOo0zaS9RnLiGQCgqfqlJD/yH8A9AGMyxDknnyhH MHUAn1MCACrmZmTqNCLSIQn9zhPBthwV =x9np -----END PGP SIGNATURE----- --kli75avfofjsnwzp--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20170103213925.dwghtjmnp5k4qu6n>