From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id PX96J4YuYl9nFgAA0tVLHw (envelope-from ) for ; Wed, 16 Sep 2020 15:25:58 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id AEbJIoYuYl/eEQAAbx9fmQ (envelope-from ) for ; Wed, 16 Sep 2020 15:25:58 +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 21233940609 for ; Wed, 16 Sep 2020 15:25:58 +0000 (UTC) Received: from localhost ([::1]:34598 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kIZJl-0007xG-3t for larch@yhetil.org; Wed, 16 Sep 2020 11:25:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33464) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kIZIt-0007QD-Hv for bug-guix@gnu.org; Wed, 16 Sep 2020 11:25:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:52409) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kIZIt-0006IV-2L for bug-guix@gnu.org; Wed, 16 Sep 2020 11:25:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kIZIs-0001rX-V8 for bug-guix@gnu.org; Wed, 16 Sep 2020 11:25:02 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#42688: Running a script with `guix repl` doesn't "see" additional channels using (%package-module-path) References: <20200803043331.78b20336@runbox.com> In-Reply-To: <20200803043331.78b20336@runbox.com> Resent-From: Leo Prikler Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Wed, 16 Sep 2020 15:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 42688 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: <42688@debbugs.gnu.org> Received: via spool by 42688-submit@debbugs.gnu.org id=B42688.16002698947125 (code B ref 42688); Wed, 16 Sep 2020 15:25:02 +0000 Received: (at 42688) by debbugs.gnu.org; 16 Sep 2020 15:24:54 +0000 Received: from localhost ([127.0.0.1]:35721 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kIZIj-0001ql-Oj for submit@debbugs.gnu.org; Wed, 16 Sep 2020 11:24:54 -0400 Received: from ex07htca01.uni-graz.at ([143.50.13.79]:41354) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kIZAg-0001e2-O3 for 42688@debbugs.gnu.org; Wed, 16 Sep 2020 11:16:35 -0400 Received: from EX13MS01.pers.ad.uni-graz.at (2002:8f32:dbf::8f32:dbf) by ex07htca01.pers.ad.uni-graz.at (2002:8f32:d4f::8f32:d4f) with Microsoft SMTP Server (TLS) id 8.3.515.0; Wed, 16 Sep 2020 17:16:32 +0200 Received: from nijino.local (217.149.165.169) by EX13MS01.pers.ad.uni-graz.at (2002:8f32:dbf::8f32:dbf) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 16 Sep 2020 17:16:32 +0200 Message-ID: From: Leo Prikler Date: Wed, 16 Sep 2020 17:16:52 +0200 Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.34.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: EX13MS04.pers.ad.uni-graz.at (2002:8f32:dc2::8f32:dc2) To EX13MS01.pers.ad.uni-graz.at (2002:8f32:dbf::8f32:dbf) X-Spam-Score: -0.7 (/) X-Mailman-Approved-At: Wed, 16 Sep 2020 11:24:51 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -1.7 (-) X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Spam-Score: -1.01 X-TUID: 05JJIIyRcZgv Hi Guix, I've finally figured out, what causes this issue. Guix repl uses the following code to call scripts: ``` (unless (null? script) ;; Run script (save-module-excursion (lambda () (set-program-arguments script) (set-user-module) (load-in-vicinity "." (car script))))) ``` But `guix describe` (which is used to initialize %package-module-path) has the following: ``` (define current-profile (mlambda () "Return the profile (created by 'guix pull') the calling process lives in, or #f if this is not applicable." (match (command-line) ((program . _) (and (string-suffix? "/bin/guix" program) [...]))))) (define current-profile-entries [...]) (define current-channel-entries [...]) (define package-path-entries [...]) ``` Each of these procedures depends on the previous, building up a chain that fails exactly in the case where we (set-program-arguments [...]) with a script other than the current channel's guix (which is probably the way you'd want to use `guix repl`). There are some ways of resolving this. One would be to access earlier versions of "command-line" – it does resolve to a fluid, but that fluid itself is not exposed to Guile. Perhaps there might be some FFI magic to access it. You could also set up your script to fake being a Guix command by setting the command line to be (cons* "$HOME/.config/guix/current/bin/guix" "repl" (command-line)), i.e. reconstructing the way your script has been invoked. This would obviously break if you were to call it with a different Guix, also you'd have to resolve $HOME instead of writing it like that, but you'd have access to your channels. On the other hand, we could patch `guix repl` to initialize %package- module-path earlier (still leaving `guix describe` broken) or somehow try to work around that issue in `guix describe`. Regards, Leo