From owner-freebsd-ruby@freebsd.org Tue Jan 3 21:39:32 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 E6039C9EDA7 for ; Tue, 3 Jan 2017 21:39:32 +0000 (UTC) (envelope-from jjuanino@gmail.com) Received: from mail-wm0-x234.google.com (mail-wm0-x234.google.com [IPv6:2a00:1450:400c:c09::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 653AE1B66; Tue, 3 Jan 2017 21:39:32 +0000 (UTC) (envelope-from jjuanino@gmail.com) Received: by mail-wm0-x234.google.com with SMTP id a197so394682731wmd.0; Tue, 03 Jan 2017 13:39:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Z5e9PmIVrDhH2+Cchu2UyOs98ZoqYEykd1GX0bphOMU=; b=mDNwtiZwWY4RfjoEhjUJ4AiuyMXU+kRgxjtmkT3l6XSsfR67T7wQb2zSGJdRMchPw0 5kehTSOlZ5TqQ7FSWVubW2tqbmaYA99+Z4HECMm+QBomFKeivaPgihvx4mO/s6INdExJ TQoagHKbiBdg66UnuOAGsgZU0FV9EdConHIsUcw651Gp2Thazhop2Ln9YDidOVhHriFO i+hw9dUjwpnYGJ3MyidWgxNhFKil+RWWT+1q4s1g20rf5SWYbAGI2yLsfiprScChhAOy hWX5qRYw6QnsF2ilomUi+lFJaYgGVU1q7mHZvRkYxOJBGCRGaJV9R9bMUWq3zSPY++dj /Riw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=Z5e9PmIVrDhH2+Cchu2UyOs98ZoqYEykd1GX0bphOMU=; b=A++vIUjVaN20IibZTlilZCyVLngHNEjso3n2dsoCVasa2kfXPVJmIbA1uIbjlWlKs2 N+rTtB1MvlIURf9RVFvrwBdhox8xCeWKd+5HBo/xYLechuhNHF+x16X+09PJhGfXpC7A T+Quy08ano3DTb5QhhFpQ2o9hXExReup2Vli2u505Ylre8xZW09knrMbVn9xyAeWT4F5 kpruYp6rAzj2Fe0SitkzXuP0iOpMbVnKsgKACXeknpgLgd4X1xNpYLK2HTe78bq35UPC QQ8j68NMaw1uDGihW1rfVgS68gpelO0RwoMLof7qXRZJaXe5VoY6AO3mzouxqn3bv5Ce CxAg== X-Gm-Message-State: AIkVDXJcWVvWh7qeCkaUttAyPeuxtX6BYiYsQvqCFAUau8RqphGkwS91JIdodWlRbl++3A== X-Received: by 10.28.215.6 with SMTP id o6mr54681695wmg.5.1483479570200; Tue, 03 Jan 2017 13:39:30 -0800 (PST) Received: from abel.home.inet (79.108.83.135.dyn.user.ono.com. [79.108.83.135]) by smtp.gmail.com with ESMTPSA id c187sm91505846wmd.13.2017.01.03.13.39.28 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 03 Jan 2017 13:39:28 -0800 (PST) Date: Tue, 3 Jan 2017 22:39:25 +0100 From: =?iso-8859-1?Q?Jos=E9_G=2E?= Juanino To: Steve Wills Cc: freebsd-ruby@freebsd.org Subject: Re: PREFIX enviroment variable pollutes gem search path Message-ID: <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> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="kli75avfofjsnwzp" Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD 11.0-RELEASE-p2 User-Agent: NeoMutt/20161126 (1.7.1) 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 21:39:33 -0000 --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 `
' $ 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--