Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Jan 2017 17:25:25 -0500
From:      Steve Wills <swills@FreeBSD.org>
To:        "=?UTF-8?Q?Jos=c3=a9_G._Juanino?=" <jjuanino@gmail.com>
Cc:        freebsd-ruby@freebsd.org
Subject:   Re: PREFIX enviroment variable pollutes gem search path
Message-ID:  <b0524889-07e6-0235-21a0-e541e8568afb@FreeBSD.org>
In-Reply-To: <20170103213925.dwghtjmnp5k4qu6n@abel.home.inet>
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> <20170103213925.dwghtjmnp5k4qu6n@abel.home.inet>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--44eGshhLBT6OrglNNb6cPmUrieWmhDP1M
Content-Type: multipart/mixed; boundary="ccCd2WEe8gF0C40E2AGCNA58iWhHwNfav";
 protected-headers="v1"
From: Steve Wills <swills@FreeBSD.org>
To: =?UTF-8?Q?Jos=c3=a9_G._Juanino?= <jjuanino@gmail.com>
Cc: freebsd-ruby@freebsd.org
Message-ID: <b0524889-07e6-0235-21a0-e541e8568afb@FreeBSD.org>
Subject: Re: PREFIX enviroment variable pollutes gem search path
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>
 <20170103213925.dwghtjmnp5k4qu6n@abel.home.inet>
In-Reply-To: <20170103213925.dwghtjmnp5k4qu6n@abel.home.inet>

--ccCd2WEe8gF0C40E2AGCNA58iWhHwNfav
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: quoted-printable

Hi,

On 01/03/2017 16:39, Jos=E9 G. Juanino wrote:
>=20
> Hello Steve, thanks for time and patience.

Likewise. :)

> The problem is that if your custom ruby program uses the PREFIX
> environment variable to achieve some other purpose, you must be aware
> that your code will use the assigned value to load the required gems,
> and this is unexpected and will cause a lot of trouble (this reason lea=
d
> to me to say that PREFIX environment variable polluted the search gem
> path).
>=20
> A contrived example could be, assuming you have installed
> devel/rubygem-test-unit:
>=20
> $ 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:5=
5:in
> `require': cannot load such file -- test/unit (LoadError)
>        from
> /usr/local/lib/ruby/site_ruby/2.2/rubygems/core_ext/kernel_require.rb:5=
5:in
> `require'
>        from prefix_test.rb:1:in `<main>'
> $ echo $?
> 1
>=20
> The error raises because ruby try to find the gem specifications
> directory in the following nonexistent path:
> some_prefix/lib/ruby/gems/2.2/specifications
>=20
> instead of:
>=20
> /usr/local/lib/ruby/gems/2.2/gems/specifications
>=20
> You can check this assertion by running a truss in the failed code, and=

> comparing it with the right one.

Right, this is all as I would expect. It's looking in the directory you
specified, which happens to not exist.

> Excuse my poor english, sorry for the misunderstoods.

I think your English is fine, my understanding maybe is not so great.

Steve


--ccCd2WEe8gF0C40E2AGCNA58iWhHwNfav--

--44eGshhLBT6OrglNNb6cPmUrieWmhDP1M
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQGQBAEBCgB6BQJYbCTVXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQ5OEZBNDE0QTVDMkEwRUY5Q0ZEMEFEMERG
NUNGNjJCMzIwN0IxQkExExxzd2lsbHNAZnJlZWJzZC5vcmcACgkQ9c9isyB7G6H1
kAf+OeExg7FRwhGR4XUfboTbjsWBEIK9gkTWzrAejv40qK2H20VbI6a88PhxmKKe
2eN8c3LviEUAqvON0r4aqDrxFLHGlLo3oo9h9TV2YkeKqeUSrdsx37uR20L6OX1E
RxAUvb5WXd4A8nl8DT0/BbUNOMp4JkCNyNnQAX7ppTDuRtypVLvkuK/0/KgjGaMj
/WeHhfPforllV0n7pcXuHNxFgWkGFvaGHHJQIDyUC8bfB0rSe69dq5DosGdoRoin
vV/w/7kjqhPOMTlKyFvXfdVUQBYkIM99zFzWKgld8lRkP+G4McK3/7sBD5opqBr5
mTPl0mu4uWhKYX11NyPD5OwEVg==
=zyIU
-----END PGP SIGNATURE-----

--44eGshhLBT6OrglNNb6cPmUrieWmhDP1M--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?b0524889-07e6-0235-21a0-e541e8568afb>