From owner-freebsd-ruby@freebsd.org Tue Jan 3 14:27:55 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 64532C9C1C3 for ; Tue, 3 Jan 2017 14:27:55 +0000 (UTC) (envelope-from jjuanino@gmail.com) Received: from mail-wj0-x243.google.com (mail-wj0-x243.google.com [IPv6:2a00:1450:400c:c01::243]) (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 0A2E8191B for ; Tue, 3 Jan 2017 14:27:55 +0000 (UTC) (envelope-from jjuanino@gmail.com) Received: by mail-wj0-x243.google.com with SMTP id j10so72176113wjb.3 for ; Tue, 03 Jan 2017 06:27:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=rMx8xKeA5VNNs5Tv9pHEQEOrYhMFDw4p6HbeiUWkgH8=; b=FI5uqaZqFlqGMGLbnoGsAOXmkGUuyc98aUCKvxj23vXoNWOIBnCX9H7gMwsuF+yWO9 tnvkRRDyjzmB62my4ePFd9xpMyBEAlQxuSwIA/fHPkryjQ//OjoXX/DYQXmfz2kOK6lK N7UgFgYIwr4NykudR9z2fS4njQN2/h2AyQ8JwsGczknqYOC0sbVEgNWkGQymQjA/nWED TxTt0m+SBHRNIzM4e9VrqQE/iK+bDgue4lBdSHAvl/W1OiYJ/Qnmw8MMgwDyUEsCerVt rpvVlFkX3/G6ZQ5aIV7JEXZWd0OMABlFukkvbtG8fCZacXsdeDcDTKLnz+mx3TtkdrrI W1cg== 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:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=rMx8xKeA5VNNs5Tv9pHEQEOrYhMFDw4p6HbeiUWkgH8=; b=uXUrlAWd5Cs6MD+GpMUk483pos10m6AhzUutleNB3dk+04PnxSf0W7T5p4CsUbFrpI 2xf6Io4hwk9GbsOnTblsDyGjvOUSyE15zhIddZCzpu+KmIX1d/Be6JOBDgUDnxm94HI5 qQOohrUv48jPk0mqem60s4OnQOfnkl0dThJF2Z9kV/zx7Cpo8pkCGSLfmG6uHbC5Oj93 iNsgL3UmzfWj1+CkRUqIMgJMweO61ANjorI971GlBA+yNUxNgAzekIVnIbwpnh/VXewv cdHtFureCmWzp+OD4CovasbPPwH+gxdyJI8aBRW/lywxKIucaijobEp/LADUabEvFpQ2 zYWQ== X-Gm-Message-State: AIkVDXKaQxmxf0rksms9J4RUa0NpROdYp6kHuyX63lctiTWoyZCltp1qDHl3gklFIeSMjg== X-Received: by 10.195.11.229 with SMTP id el5mr65787931wjd.64.1483453672846; Tue, 03 Jan 2017 06:27:52 -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 v202sm89297075wmv.8.2017.01.03.06.27.51 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 03 Jan 2017 06:27:52 -0800 (PST) Date: Tue, 3 Jan 2017 15:27:49 +0100 From: =?iso-8859-1?Q?Jos=E9_G=2E?= Juanino To: freebsd-ruby@freebsd.org Subject: Re: PREFIX enviroment variable pollutes gem search path Message-ID: <20170103142749.62nzduottim5wxpj@abel.home.inet> References: <20170103000758.pnoglvxtseec2xpn@abel.home.inet> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20170103000758.pnoglvxtseec2xpn@abel.home.inet> 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 14:27:55 -0000 El martes 03 de enero a las 01:07:58 CET, José G. Juanino escribió: >Hi, > >I am suffering an annoying issue loading gem libraries; I am not sure >if it is FreeBSD specific. > >Install some gem, for example rubygem-test-unit-3.1.9, and take a look >at the following code: > > >$ ruby22 -r test/unit -e 'puts' >$ PREFIX=1 ruby22 -r test/unit -ne 'puts' >/usr/local/lib/ruby/site_ruby/2.2/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- test/unit (LoadError) > from /usr/local/lib/ruby/site_ruby/2.2/rubygems/core_ext/kernel_require.rb:55:in `require' > >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). Regards -- José G. Juanino