From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id IH9rE2egGmHZhAEAgWs5BA (envelope-from ) for ; Mon, 16 Aug 2021 19:29:11 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id EJkQD2egGmEXPwAA1q6Kng (envelope-from ) for ; Mon, 16 Aug 2021 17:29:11 +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 620008C1A for ; Mon, 16 Aug 2021 19:29:10 +0200 (CEST) Received: from localhost ([::1]:54562 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mFgQ9-0000Ox-7k for larch@yhetil.org; Mon, 16 Aug 2021 13:29:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50310) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mFgQ3-0000OR-0T for guix-patches@gnu.org; Mon, 16 Aug 2021 13:29:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:39342) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mFgQ2-0005mL-R7 for guix-patches@gnu.org; Mon, 16 Aug 2021 13:29:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mFgQ2-0001Yq-Ho for guix-patches@gnu.org; Mon, 16 Aug 2021 13:29:02 -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: Mon, 16 Aug 2021 17:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48434 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 48434@debbugs.gnu.org Received: via spool by 48434-submit@debbugs.gnu.org id=B48434.16291349245975 (code B ref 48434); Mon, 16 Aug 2021 17:29:02 +0000 Received: (at 48434) by debbugs.gnu.org; 16 Aug 2021 17:28:44 +0000 Received: from localhost ([127.0.0.1]:50888 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mFgPk-0001YJ-2k for submit@debbugs.gnu.org; Mon, 16 Aug 2021 13:28:44 -0400 Received: from mail-wm1-f43.google.com ([209.85.128.43]:42873) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mFgPf-0001Y3-Nv for 48434@debbugs.gnu.org; Mon, 16 Aug 2021 13:28:42 -0400 Received: by mail-wm1-f43.google.com with SMTP id w21-20020a7bc1150000b02902e69ba66ce6so443722wmi.1 for <48434@debbugs.gnu.org>; Mon, 16 Aug 2021 10:28:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=15vOQ7xUyAHjrsVEwTH5ulSFoIw/A7shNSc2A6QXDY0=; b=rPv2RLhK3yolwY8F80jSqaGkFD03Aknk3ROkByW3Jvpf6UDisNdWm9h1qS7tB9L0Xb JpHnr7OBHwAzHRg4LKNwewiYT0Jzc+xDHJw5wGvpHwYSQF4kBB5gmYfaIZdQ2OmHdx62 qJ+gbiDM9pS/18iLCVMFXbwxc5hPyNYevbtt26ubKkcUEbKuKfo1/TuucKQ25t4BQ3UE lV8e0o+NFO29on5AeprdqsvWK0OZgGnUsKw4d4YFUeT+hQLg/Qkloef/f8C4fbkCLNEC +1OmYSk/kIZIW5w5R4+Ls3Wr/nlpX3E7LmhdvDKhfzBl2HztCscxcH7dh2HR5US/jsLC /d0w== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=15vOQ7xUyAHjrsVEwTH5ulSFoIw/A7shNSc2A6QXDY0=; b=RmaulGE+V343tTvOqBPg8mvUKinRakO4BERVfgZZ5nL+4QNeitThPvH7FHMEhfNZz6 tnYydv8gMEf6bGJ4rYRM0E+y2iiXREQLZqzo4FiBW0YnnrqoUg//h1pNbOBHcP62VpNI D68xgEfQo2PZklz6PmfKfSoQyI+2ediuU5QFcBjuys+2qswejuQroYkcaGOzAbc368y1 xxzIcJj4uVNfYaYbmzt8UHjK757IoPtwLztRgKRoO0H6s7P48RXdeq43WPn9jdaO5ZjS kzNYntrhE/S8w/HRIX5iLujZhqDO49rDffP/DijPXhdEGwU76+sVHYgy7hwCfP2Su1DM NzOw== X-Gm-Message-State: AOAM532IMRsW7cdLSeR50mXXyCb6SH9jl7C3bn3BK3BmeySb3VhgYBy5 GdhSAf8hrnsfqMz3SoXi/VrouNY+GrA= X-Google-Smtp-Source: ABdhPJxCALSzP2iiRM+vf4Rxj5cMdoQhOnUHkXn/KOhD8o9kk0oF0SFqORAPYRBxsrCKlLTZqQZ3uQ== X-Received: by 2002:a1c:2905:: with SMTP id p5mr198982wmp.146.1629134913657; Mon, 16 Aug 2021 10:28:33 -0700 (PDT) Received: from zn3 (host81-129-83-184.range81-129.btcentralplus.com. [81.129.83.184]) by smtp.gmail.com with ESMTPSA id p8sm137324wme.22.2021.08.16.10.28.32 for <48434@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Aug 2021 10:28:33 -0700 (PDT) Date: Mon, 16 Aug 2021 18:28:31 +0100 From: Sergei Trofimovich Message-ID: <20210816182822.654d3e1f@zn3> In-Reply-To: <20210515095227.3245343-1-slyfox@gentoo.org> References: <20210515095227.3245343-1-slyfox@gentoo.org> X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.29; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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=1629134950; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=15vOQ7xUyAHjrsVEwTH5ulSFoIw/A7shNSc2A6QXDY0=; b=WrWiBi/Aecz+sBFTki+JpiNdPZBhD+JWnmDxUafzGPYc/avO1hqfz+hjQqB0tHA/2+//sf wQOQMJOgPlhBQLmi9ieB6kIT6neSZBHxVcRujmcz8XU0oiH65T5SffYWqXuvO6dHZiE6R6 1qFsHh643hySLkjYJay5G6lHqxbtu7MgDqDQqt6XCrX9nAL8XcFjhm5Hur8etkR3A+J6Gl /nToQoIr0T/dNXw/BNohU8i09p7P20CwPCoQYG5RSlcKpzS/cnOKlylagZt/Fe9IYK/gr/ W3PQsRP/34mDUhkWSp33LsnKndGf9a7iYT2zAuwKc2jnsNHz7LGp481iTnSn4w== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1629134950; a=rsa-sha256; cv=none; b=Px2gwweakiYR00y5YkjoHDVXg7gMm5KGH6gHIuLo47uK/N31grEcpQyZ2jfi/ERqucW9ba 7YVhrvLUsLinzvUJr+gruNitssxzYbMdaBFiB2UQGRSL9SxfYmXbtpwy4dPXTmkT3XVsYh DbqDo4knEJMi3+pttDm3KkbUtaRjvfZqBblT0cCSSXWAPDTuADE4M7Ts/aSZCBtIajyWA4 cGgZtCzn0wnMnDmPEK/829D95tH4lMSgio9IgIVSv37TmS/5CTnZoSbV5VMuLrdUBwa7oq KsKYsy4ZeblXUq4N6SHEqaR98HhNx2aDlDwB9HRBsEZcBABlOJ8MVlKcywrMWw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20161025 header.b=rPv2RLhK; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (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: -0.81 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20161025 header.b=rPv2RLhK; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (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: 620008C1A X-Spam-Score: -0.81 X-Migadu-Scanner: scn1.migadu.com X-TUID: GgNb/Y7orKau On Sat, 15 May 2021 10:52:27 +0100 Sergei Trofimovich wrote: > 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: Stumbled on it again today when cloned fresh guix repo and forgot to apply this patch. Is it a reasonable approach? Or something else is at fault here? Thanks! -- Sergei