From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id mOdvAWK3n2D8AAAAgWs5BA (envelope-from ) for ; Sat, 15 May 2021 13:58:26 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id kOKkOGG3n2DCDQAAB5/wlQ (envelope-from ) for ; Sat, 15 May 2021 11:58:25 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id B31BC2511A for ; Sat, 15 May 2021 13:58:25 +0200 (CEST) Received: from localhost ([::1]:33940 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lhsw4-0006Jv-Sb for larch@yhetil.org; Sat, 15 May 2021 07:58:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60872) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhqyk-0004Xk-9k for guix-patches@gnu.org; Sat, 15 May 2021 05:53:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:36097) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lhqyk-0007ox-1q for guix-patches@gnu.org; Sat, 15 May 2021 05:53:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lhqyj-000780-Vy for guix-patches@gnu.org; Sat, 15 May 2021 05:53:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#48434] [PATCH] guile: allow pre-inst-env inject local paths Resent-From: Sergei Trofimovich Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 15 May 2021 09:53:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 48434 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 48434@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= , Sergei Trofimovich X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.162107237527384 (code B ref -1); Sat, 15 May 2021 09:53:01 +0000 Received: (at submit) by debbugs.gnu.org; 15 May 2021 09:52:55 +0000 Received: from localhost ([127.0.0.1]:47643 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lhqyd-00077c-3V for submit@debbugs.gnu.org; Sat, 15 May 2021 05:52:55 -0400 Received: from lists.gnu.org ([209.51.188.17]:48078) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lhqya-00077T-Eq for submit@debbugs.gnu.org; Sat, 15 May 2021 05:52:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60846) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhqya-0004SU-3J for guix-patches@gnu.org; Sat, 15 May 2021 05:52:52 -0400 Received: from mail.gentoo.org ([2001:470:ea4a:1:5054:ff:fec7:86e4]:45135 helo=smtp.gentoo.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lhqyR-0007gh-FS; Sat, 15 May 2021 05:52:51 -0400 Received: by sf.home (Postfix, from userid 1000) id D6FCC5A22061; Sat, 15 May 2021 10:52:34 +0100 (BST) From: Sergei Trofimovich Date: Sat, 15 May 2021 10:52:27 +0100 Message-Id: <20210515095227.3245343-1-slyfox@gentoo.org> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2001:470:ea4a:1:5054:ff:fec7:86e4; envelope-from=slyfox@gentoo.org; helo=smtp.gentoo.org X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Mailman-Approved-At: Sat, 15 May 2021 07:58:20 -0400 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1621079905; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Sm7jNMvK64M5U8Q5nAsb5oCbXzQl+YU9JrtsAENwJJI=; b=K2lU8UP+zhWyChIz5QqsLsl05fHHuEfjfazOUO/pjH3/x9UUa+OICiFG3iSP1GMJjHc/U9 z46dzWICN5ZoxHpihN0aDZtF+RuPKhCQWzLUeOGxP4KopnACozM77arCTnbAu+uZmf6b4B Y462uH0d3MUeRYfH0efL0aWcRRd2dNfFeAhhl31KhbxP1GjewezBOya2ZftDXhOKvush/p zmNrYR4bohVuyyEpvjVlMvTNE+Sj+CxNl9ZDcEdTcvK5bOahNRGX3a8YvRgbOW+tcVCHTl WDkgiVnm6rjuu9LYAeiO4ZuyR8jETqkwmijI/Gf+riPIUIPXbHpqPrWl8ldnlw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1621079905; a=rsa-sha256; cv=none; b=ti8eU/y+IJCobN9rLsE9J5X0i4yvsy4r3lBqbx40M3yywyASbe97GbsJIBYYv6Us9Q9/af 9G7AZsh66Zft2s8IBumIbAxi4Yr23U4A+EQYf4cEV6HvLLZ2p4RpD1aEbCDz/K1g86CVmv iOQtpPEwmkV7gagC4D342xjj/z10WE7IfXYvS+1N7K+mKUEleNO+hCYWiHgq6eqRERMXc5 zrMuTL1Ld15fn7l/Zb51EhCTnRESHCRpS07oeAttmhG0ANd9WgJxvUZxDebGvZOjy6R9B7 8RWqE/1yulRMILWle1R6A17dMRrQxkp3i8HXf8uxidMuMpvcSTNFMv8JOO0Bfg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gentoo.org (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: 2.65 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gentoo.org (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: B31BC2511A X-Spam-Score: 2.65 X-Migadu-Scanner: scn0.migadu.com X-TUID: KJGUqG8ZC+Pq I observed the problem when tried to run 'guix refresh' from local git checkout: $ strace -f ./pre-inst-env guix refresh -u re2c |& fgrep re2c.scm ... [pid 3014757] openat(AT_FDCWD, "/usr/share/guile/site/3.0/gnu/packages/re2c.scm.qilB0R", O_RDWR|O_CREAT|O_EXCL, 0600) = -1 EACCES (Permission denied) Attempt to /usr/share happens because local directory override is ignored: $ ./pre-inst-env guile -c '(display (search-path %load-path "gnu/packages/re2c.scm")) (newline) (display %load-path) (newline)' /usr/share/guile/site/3.0/gnu/packages/re2c.scm (/usr/share/guile/3.0 \ /usr/share/guile/site/3.0 \ /usr/share/guile/site \ /usr/share/guile \ /home/slyfox/dev/git/guix \ /home/slyfox/dev/git/guix) It happens because ./guile ignores GUILE_LOAD_PATH / GUILE_LOAD_COMPILED_PATH unconditionally. The change keeps GUILE_LOAD_PATH / GUILE_LOAD_COMPILED_PATH for ./pre-inst-env. * gnu/packages/aux-files/guile-launcher.c (main): don't ignore GUILE_LOAD_PATH / GUILE_LOAD_COMPILED_PATH in GUIX_UNINSTALLED=1 mode. Signed-off-by: Sergei Trofimovich --- gnu/packages/aux-files/guile-launcher.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/gnu/packages/aux-files/guile-launcher.c b/gnu/packages/aux-files/guile-launcher.c index 47ba069de1..bed63353a9 100644 --- a/gnu/packages/aux-files/guile-launcher.c +++ b/gnu/packages/aux-files/guile-launcher.c @@ -73,14 +73,19 @@ main (int argc, char **argv) which is always preferable over the C locale. */ setlocale (LC_ALL, "en_US.utf8"); - const char *str; - str = getenv ("GUILE_LOAD_PATH"); - load_path = str != NULL ? strdup (str) : NULL; - str = getenv ("GUILE_LOAD_COMPILED_PATH"); - load_compiled_path = str ? strdup (str) : NULL; + /* Allow ./pre-inst-env to inject local paths. That way local sources + are preferred for most operations. */ + if (getenv ("GUIX_UNINSTALLED") == NULL) + { + const char *str; + str = getenv ("GUILE_LOAD_PATH"); + load_path = str != NULL ? strdup (str) : NULL; + str = getenv ("GUILE_LOAD_COMPILED_PATH"); + load_compiled_path = str ? strdup (str) : NULL; - unsetenv ("GUILE_LOAD_PATH"); - unsetenv ("GUILE_LOAD_COMPILED_PATH"); + unsetenv ("GUILE_LOAD_PATH"); + unsetenv ("GUILE_LOAD_COMPILED_PATH"); + } /* XXX: Do not let GMP allocate via libgc as this can lead to memory corruption in GnuTLS/Nettle since Nettle also uses GMP: -- 2.31.1