From owner-freebsd-ruby@freebsd.org Tue Jan 3 22:25:35 2017 Return-Path: Delivered-To: freebsd-ruby@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2C225C9DF22 for ; Tue, 3 Jan 2017 22:25:35 +0000 (UTC) (envelope-from swills@FreeBSD.org) Received: from mouf.net (mouf.net [IPv6:2607:fc50:0:4400:216:3eff:fe69:33b3]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mouf.net", Issuer "mouf.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id E6B59136A for ; Tue, 3 Jan 2017 22:25:34 +0000 (UTC) (envelope-from swills@FreeBSD.org) Received: from [10.0.1.70] (cpe-071-065-239-148.nc.res.rr.com [71.65.239.148] (may be forged)) (authenticated bits=0) by mouf.net (8.14.9/8.14.9) with ESMTP id v03MPQs2098869 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Tue, 3 Jan 2017 22:25:32 GMT (envelope-from swills@FreeBSD.org) Subject: Re: PREFIX enviroment variable pollutes gem search path To: "=?UTF-8?Q?Jos=c3=a9_G._Juanino?=" References: <20170103000758.pnoglvxtseec2xpn@abel.home.inet> <20170103142749.62nzduottim5wxpj@abel.home.inet> <5a2c04e1-81bb-41f6-e727-9b4a53682d9b@FreeBSD.org> <20170103192259.c6ebqxy3jwrsgo5o@abel.home.inet> <20170103213925.dwghtjmnp5k4qu6n@abel.home.inet> Cc: freebsd-ruby@freebsd.org From: Steve Wills Message-ID: Date: Tue, 3 Jan 2017 17:25:25 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20170103213925.dwghtjmnp5k4qu6n@abel.home.inet> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="44eGshhLBT6OrglNNb6cPmUrieWmhDP1M" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mouf.net [199.48.129.64]); Tue, 03 Jan 2017 22:25:32 +0000 (UTC) X-Spam-Status: No, score=-1.0 required=4.5 tests=ALL_TRUSTED autolearn=unavailable autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on mouf.net X-Virus-Scanned: clamav-milter 0.99.2 at mouf.net X-Virus-Status: Clean X-BeenThere: freebsd-ruby@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: FreeBSD-specific Ruby discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jan 2017 22:25:35 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --44eGshhLBT6OrglNNb6cPmUrieWmhDP1M Content-Type: multipart/mixed; boundary="ccCd2WEe8gF0C40E2AGCNA58iWhHwNfav"; protected-headers="v1" From: Steve Wills To: =?UTF-8?Q?Jos=c3=a9_G._Juanino?= Cc: freebsd-ruby@freebsd.org Message-ID: 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> <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 `
' > $ 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--