GNU bug report logs - #42688
Running a script with `guix repl` doesn't "see" additional channels using (%package-module-path)

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix; Reported by: pkill9 <pkill9@HIDDEN>; dated Mon, 3 Aug 2020 03:34:01 UTC; Maintainer for guix is bug-guix@HIDDEN.

Message received at 42688 <at> debbugs.gnu.org:


Received: (at 42688) by debbugs.gnu.org; 17 Sep 2020 19:11:07 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 17 15:11:07 2020
Received: from localhost ([127.0.0.1]:39105 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kIzJD-0001kR-02
	for submit <at> debbugs.gnu.org; Thu, 17 Sep 2020 15:11:07 -0400
Received: from eggs.gnu.org ([209.51.188.92]:39426)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1kIzJ8-0001jm-J6
 for 42688 <at> debbugs.gnu.org; Thu, 17 Sep 2020 15:11:06 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:43623)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <ludo@HIDDEN>)
 id 1kIzJ1-00084q-K2; Thu, 17 Sep 2020 15:10:55 -0400
Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=39922 helo=ribbon)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <ludo@HIDDEN>)
 id 1kIzJ1-0003GP-5e; Thu, 17 Sep 2020 15:10:55 -0400
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: Leo Prikler <leo.prikler@HIDDEN>
Subject: Re: bug#42688: Running a script with `guix repl` doesn't "see"
 additional channels using (%package-module-path)
References: <20200803043331.78b20336@HIDDEN>
 <dd34fe61016d7c2d9e7f9f0043927f94760f52b9.camel@HIDDEN>
 <874knws9mu.fsf@HIDDEN>
 <34cc318a15bd8070d0863214864687c0d45a414c.camel@HIDDEN>
X-URL: http://www.fdn.fr/~lcourtes/
X-Revolutionary-Date: Jour du =?utf-8?Q?G=C3=A9nie?= de =?utf-8?Q?l'Ann?=
 =?utf-8?Q?=C3=A9e?= 228 de la =?utf-8?Q?R=C3=A9volution?=
X-PGP-Key-ID: 0x090B11993D9AEBB5
X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc
X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4  0CFB 090B 1199 3D9A EBB5
X-OS: x86_64-pc-linux-gnu
Date: Thu, 17 Sep 2020 21:10:53 +0200
In-Reply-To: <34cc318a15bd8070d0863214864687c0d45a414c.camel@HIDDEN>
 (Leo Prikler's message of "Thu, 17 Sep 2020 18:15:23 +0200")
Message-ID: <877dss9q2q.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 42688
Cc: 42688 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Hi,

Leo Prikler <leo.prikler@HIDDEN> skribis:

> Am Donnerstag, den 17.09.2020, 17:31 +0200 schrieb Ludovic Court=C3=A8s:
>> Hi Leo,
>>=20
>> [...]
>>=20
>> =E2=80=98scm_program_arguments_fluid=E2=80=99 is marked as SCM_INTERNAL,=
 so it=E2=80=99s
>> really
>> inaccessible.
> Thought so.
>
>> However, perhaps we could save the initial value of (program-
>> arguments)
>> in (guix ui) and use that in (guix describe)?
> I'd personally put it in (guix describe) and use the same autoload
> trick, that you've now used for %package-module-path (or a dedicated
> save-...-excursion).

In general, (guix =E2=80=A6) module should not depend on (gnu =E2=80=A6) mo=
dules, which
rules out this option.

> (guix ui) has a heavy closure for (guix describe) to pull.

Every (guix scripts =E2=80=A6) module depends on (guix ui) via the =E2=80=
=98guix=E2=80=99
command.  (Probably something we could improve, but that=E2=80=99s the way =
it
is.)

Now, I realize my proposal was misguided because (guix describe) should
remain =E2=80=9CUI-free=E2=80=9D so to speak.  Hmm=E2=80=A6

>> > 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`.
>>=20
>> Initializing (%package-module-path) earlier sounds like a good idea
>> too,
>> maybe like this:
>>=20
>> [...]=20
>>=20
> I haven't tested that yet (pre-inst-env makes it so Guix doesn't have
> any channels anyway), but yeah, something like that would have been my
> idea.

Alright, I=E2=80=99ll give it a spin.

Thank you!

Ludo=E2=80=99.




Information forwarded to bug-guix@HIDDEN:
bug#42688; Package guix. Full text available.

Message received at 42688 <at> debbugs.gnu.org:


Received: (at 42688) by debbugs.gnu.org; 17 Sep 2020 16:15:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 17 12:15:21 2020
Received: from localhost ([127.0.0.1]:38809 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kIwYt-0003Xm-6m
	for submit <at> debbugs.gnu.org; Thu, 17 Sep 2020 12:15:21 -0400
Received: from mailrelay.tugraz.at ([129.27.2.202]:52842)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <leo.prikler@HIDDEN>) id 1kIwYq-0003Tz-TN
 for 42688 <at> debbugs.gnu.org; Thu, 17 Sep 2020 12:15:06 -0400
Received: from nijino.local (217-149-165-169.nat.highway.telekom.at
 [217.149.165.169])
 by mailrelay.tugraz.at (Postfix) with ESMTPSA id 4BshrP4T2Mz3xBY;
 Thu, 17 Sep 2020 18:15:01 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tugraz.at;
 s=mailrelay; t=1600359301;
 bh=BKFOaSokaguPgvcyj9kxaO87uM/7gT5nkDcUvgJL5Ps=;
 h=Subject:From:To:Cc:Date:In-Reply-To:References;
 b=R64l2XC6egt++u24CHH9HufiQozu4tSpzLRrlxk1BFHApM/I9GSYcy51r3US1moC+
 itx107rpRNzNtWitv/m3ElIiuq/ffFhUsTOLVA8h+QrFH2RLDFeyckc+wEv8UgdQwr
 OQvJ1d5b033hwHqP/1cErXiqZkbgK0rK9uIuluSI=
Message-ID: <34cc318a15bd8070d0863214864687c0d45a414c.camel@HIDDEN>
Subject: Re: bug#42688: Running a script with `guix repl` doesn't "see"
 additional channels using (%package-module-path)
From: Leo Prikler <leo.prikler@HIDDEN>
To: Ludovic =?ISO-8859-1?Q?Court=E8s?= <ludo@HIDDEN>
Date: Thu, 17 Sep 2020 18:15:23 +0200
In-Reply-To: <874knws9mu.fsf@HIDDEN>
References: <20200803043331.78b20336@HIDDEN>
 <dd34fe61016d7c2d9e7f9f0043927f94760f52b9.camel@HIDDEN>
 <874knws9mu.fsf@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
User-Agent: Evolution 3.34.2 
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-TUG-Backscatter-control: bt4lQm5Tva3SBgCuw0EnZw
X-Spam-Scanner: SpamAssassin 3.003001 
X-Spam-Score-relay: -1.9
X-Scanned-By: MIMEDefang 2.74 on 129.27.10.117
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 42688
Cc: 42688 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi Ludo,
Am Donnerstag, den 17.09.2020, 17:31 +0200 schrieb Ludovic Courtès:
> Hi Leo,
> 
> [...]
> 
> ‘scm_program_arguments_fluid’ is marked as SCM_INTERNAL, so it’s
> really
> inaccessible.
Thought so.

> However, perhaps we could save the initial value of (program-
> arguments)
> in (guix ui) and use that in (guix describe)?
I'd personally put it in (guix describe) and use the same autoload
trick, that you've now used for %package-module-path (or a dedicated
save-...-excursion).  (guix ui) has a heavy closure for (guix describe)
to pull.

> > 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`.
> 
> Initializing (%package-module-path) earlier sounds like a good idea
> too,
> maybe like this:
> 
> [...] 
> 
I haven't tested that yet (pre-inst-env makes it so Guix doesn't have
any channels anyway), but yeah, something like that would have been my
idea.

Regards,
Leo





Information forwarded to bug-guix@HIDDEN:
bug#42688; Package guix. Full text available.

Message received at 42688 <at> debbugs.gnu.org:


Received: (at 42688) by debbugs.gnu.org; 17 Sep 2020 15:31:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 17 11:31:24 2020
Received: from localhost ([127.0.0.1]:38676 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kIvsZ-0007a4-Ud
	for submit <at> debbugs.gnu.org; Thu, 17 Sep 2020 11:31:24 -0400
Received: from eggs.gnu.org ([209.51.188.92]:56404)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1kIvsS-0007Py-Kh
 for 42688 <at> debbugs.gnu.org; Thu, 17 Sep 2020 11:31:23 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:38752)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <ludo@HIDDEN>)
 id 1kIvsL-000742-DS; Thu, 17 Sep 2020 11:31:09 -0400
Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=55990 helo=ribbon)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <ludo@HIDDEN>)
 id 1kIvsK-0002bM-8t; Thu, 17 Sep 2020 11:31:08 -0400
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: Leo Prikler <leo.prikler@HIDDEN>
Subject: Re: bug#42688: Running a script with `guix repl` doesn't "see"
 additional channels using (%package-module-path)
References: <20200803043331.78b20336@HIDDEN>
 <dd34fe61016d7c2d9e7f9f0043927f94760f52b9.camel@HIDDEN>
X-URL: http://www.fdn.fr/~lcourtes/
X-Revolutionary-Date: Jour du =?utf-8?Q?G=C3=A9nie?= de =?utf-8?Q?l'Ann?=
 =?utf-8?Q?=C3=A9e?= 228 de la =?utf-8?Q?R=C3=A9volution?=
X-PGP-Key-ID: 0x090B11993D9AEBB5
X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc
X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4  0CFB 090B 1199 3D9A EBB5
X-OS: x86_64-pc-linux-gnu
Date: Thu, 17 Sep 2020 17:31:05 +0200
In-Reply-To: <dd34fe61016d7c2d9e7f9f0043927f94760f52b9.camel@HIDDEN>
 (Leo Prikler's message of "Wed, 16 Sep 2020 17:16:52 +0200")
Message-ID: <874knws9mu.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 42688
Cc: 42688 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Hi Leo,

Leo Prikler <leo.prikler@HIDDEN> skribis:

> 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`).=20=20

Good catch!

> There are some ways of resolving this.  One would be to access earlier
> versions of "command-line" =E2=80=93 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.

=E2=80=98scm_program_arguments_fluid=E2=80=99 is marked as SCM_INTERNAL, so=
 it=E2=80=99s really
inaccessible.

However, perhaps we could save the initial value of (program-arguments)
in (guix ui) and use that in (guix describe)?

> 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`.

Initializing (%package-module-path) earlier sounds like a good idea too,
maybe like this:


--=-=-=
Content-Type: text/x-patch
Content-Disposition: inline

diff --git a/guix/scripts/repl.scm b/guix/scripts/repl.scm
index 7d4e474e92..b672489ed6 100644
--- a/guix/scripts/repl.scm
+++ b/guix/scripts/repl.scm
@@ -22,6 +22,7 @@
   #:use-module (guix ui)
   #:use-module (guix scripts)
   #:use-module (guix repl)
+  #:autoload   (gnu packages) (%package-module-path)
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-26)
   #:use-module (srfi srfi-37)
@@ -173,6 +174,10 @@ call THUNK."
   (with-error-handling
 
     (unless (null? script)
+      ;; Before running SCRIPT, initialize %PACKAGE-MODULE-PATH so that it
+      ;; contains the user's channels (the statement triggers an autoload).
+      (%package-module-path)
+
       ;; Run script
       (save-module-excursion
        (lambda ()

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable


?

Thanks!

Ludo=E2=80=99.

--=-=-=--




Information forwarded to bug-guix@HIDDEN:
bug#42688; Package guix. Full text available.

Message received at 42688 <at> debbugs.gnu.org:


Received: (at 42688) by debbugs.gnu.org; 16 Sep 2020 15:24:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 16 11:24:54 2020
Received: from localhost ([127.0.0.1]:35721 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kIZIj-0001ql-Oj
	for submit <at> 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 <leo.prikler@HIDDEN>) id 1kIZAg-0001e2-O3
 for 42688 <at> 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: <dd34fe61016d7c2d9e7f9f0043927f94760f52b9.camel@HIDDEN>
Subject: Running a script with `guix repl` doesn't "see" additional channels
 using (%package-module-path)
From: Leo Prikler <leo.prikler@HIDDEN>
To: <42688 <at> debbugs.gnu.org>
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-Debbugs-Envelope-To: 42688
X-Mailman-Approved-At: Wed, 16 Sep 2020 11:24:51 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

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





Information forwarded to bug-guix@HIDDEN:
bug#42688; Package guix. Full text available.

Message received at 42688 <at> debbugs.gnu.org:


Received: (at 42688) by debbugs.gnu.org; 16 Sep 2020 14:16:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 16 10:16:04 2020
Received: from localhost ([127.0.0.1]:35625 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kIYE7-0008TG-NE
	for submit <at> debbugs.gnu.org; Wed, 16 Sep 2020 10:16:04 -0400
Received: from mail-wr1-f48.google.com ([209.85.221.48]:41725)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <zimon.toutoune@HIDDEN>) id 1kIYE6-0008SX-0b
 for 42688 <at> debbugs.gnu.org; Wed, 16 Sep 2020 10:16:02 -0400
Received: by mail-wr1-f48.google.com with SMTP id w5so7095186wrp.8
 for <42688 <at> debbugs.gnu.org>; Wed, 16 Sep 2020 07:16:01 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version:content-transfer-encoding;
 bh=SPMnsqqsWwon7Zj6kFXPL2UuGuDrtmBk9ukRVn6oSP0=;
 b=Nool+BxKzKDpNuueW4YvDgdjxgMdtWFMRdrVHRWizm57dUtPeUZ9uZsSdjBd5YhefJ
 DzJQNZcBp0vi/2zT4KCg1eHcNj1tDzxEBs0j+udbRtZ0Ltlu5hQcPOez+PQUPf0pMJEM
 uGm3uvYNitjpFMAotY4vg3JuLvPxz07Hdpel+TXL6x4X4hroSquiav4br/ZZQRtM1AMa
 TrNqYc3GdMF8v4rfvoz5eF6fewMvsBsJi/2ie7kDo+NbhGJos+dNhVEfdIFJ0aD1JG9C
 VencASrqWPj9xje9hixkgZkur8bKZ64/PkcYS/ayLGOhbG4AB8jo2IyTk2Rh/FLPVrjk
 p79w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version:content-transfer-encoding;
 bh=SPMnsqqsWwon7Zj6kFXPL2UuGuDrtmBk9ukRVn6oSP0=;
 b=npo448ocyNIYjg4nU4Q4z+SMwrVQdXd99jNoSoU9GUfIKaB1i/M1ULbAox03ODFOkh
 SE7WFjAgpI9Xd7+DcP9nh9/a0m/x8u809yWCD5qcy8HBDdN+fv0+rYO9+qFx0x3jtUu4
 jB806RaPlMysCjVb04yvpysX7/w8PoAvUY4voSpdw2BxJwBBOhiNjB44Xasz56nccYm8
 95mPEKxho0JIq3elav8DWkuf0yUkkeM3fBkl9kgupOjXHQnNwLJVis3Vr7GYGPHPubsj
 lr2RpvVA9UTk/lpmiMmKhhWqVbP4hp/ywothO53O7etCmSL6BysoNqy7gn131RxfzKj7
 4SEg==
X-Gm-Message-State: AOAM5306oVWVwmpyWIGIgMaK6QGnlQ2HXsncJpOCxMuJnoJa7EYZcn7B
 CdIRLxgaCW6+Ntwmz0dsZN72ib0zOC0RUw==
X-Google-Smtp-Source: ABdhPJybFmFZI1BuM7Wp5h/fkDOou2QMNckJ2QbBhP+12H8Mi3RwqB+ptXOOFi/japnBpo0AHdEoLQ==
X-Received: by 2002:adf:e44b:: with SMTP id t11mr4143620wrm.101.1600265755840; 
 Wed, 16 Sep 2020 07:15:55 -0700 (PDT)
Received: from pfiuh02 ([193.48.40.241])
 by smtp.gmail.com with ESMTPSA id d2sm34029284wro.34.2020.09.16.07.15.55
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 16 Sep 2020 07:15:55 -0700 (PDT)
From: zimoun <zimon.toutoune@HIDDEN>
To: pkill9 <pkill9@HIDDEN>
Subject: Re: bug#42688: Running a script with `guix repl` doesn't "see"
 additional channels using (%package-module-path)
References: <20200803043331.78b20336@HIDDEN>
Date: Wed, 16 Sep 2020 16:15:54 +0200
In-Reply-To: <20200803043331.78b20336@HIDDEN> (pkill9@HIDDEN's message
 of "Mon, 3 Aug 2020 04:33:31 +0100")
Message-ID: <87zh5pq02t.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 42688
Cc: 42688 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Dear,

Thank you for the report.  Well, it seems similar to #37399
<https://issues.guix.gnu.org/issue/37399>.


On Mon, 03 Aug 2020 at 04:33, pkill9 <pkill9@HIDDEN> wrote:

> fold-available-packages uses this to search for packages, which I am
> using for a script. As a result, the script doesn't know about packages
> from the additional channels.

What happens if you try the =E2=80=9Ctrick=E2=80=9D using GUILE_LOAD_PATH?
Or the option =E2=80=99-L=E2=80=99?

(Well, maybe a solution for the mean time if you do not have too much
channels).


All the best,
simon





Information forwarded to bug-guix@HIDDEN:
bug#42688; Package guix. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 3 Aug 2020 03:33:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Aug 02 23:33:56 2020
Received: from localhost ([127.0.0.1]:43797 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1k2REa-0004HP-0b
	for submit <at> debbugs.gnu.org; Sun, 02 Aug 2020 23:33:56 -0400
Received: from lists.gnu.org ([209.51.188.17]:47912)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <pkill9@HIDDEN>) id 1k2REX-0004HH-D4
 for submit <at> debbugs.gnu.org; Sun, 02 Aug 2020 23:33:54 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:48832)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <pkill9@HIDDEN>) id 1k2REX-0003Mr-39
 for bug-guix@HIDDEN; Sun, 02 Aug 2020 23:33:53 -0400
Received: from aibo.runbox.com ([91.220.196.211]:41702)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <pkill9@HIDDEN>) id 1k2RER-0005J6-9e
 for bug-guix@HIDDEN; Sun, 02 Aug 2020 23:33:52 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=runbox.com; 
 s=selector2;
 h=Content-Transfer-Encoding:Content-Type:MIME-Version:
 Message-ID:Subject:To:From:Date;
 bh=lSrjIiUUaYmmBRO1+uNKpWoiJxH9w8DS84Ob2xxfF0s=; b=ts2CvDHCEuT0tb3JWvWJ13lmoY
 ToylFcTMip69DoxpV0QjsCX2vgWthkpSc7UvgJV5R+Ih8odYkJiUlstPXfkeXBENQVXTOqiR8oMd6
 vFpLar+UImEZlVHpFI8qYnpj5PKiChNtNVYFKucyWOxtN77iT8vmMI6FznI/E7859FsLaeNb2g5Kh
 00Qk7WH4Z2j0BWN7SlI5p5COmPeYn08SFaAtdDn1+E7ZTotRDl5BOaonTAm7bXWwNYBYNnxLGaE3z
 z3xg5RFWxFTYrpT5xxNWjD2nLec2jcyMM2+f2bl9l8O5jC8p1gMiVyrws6N3KBVBPmy97rIGlEF9P
 QmdYHR3w==;
Received: from [10.9.9.72] (helo=submission01.runbox)
 by mailtransmit03.runbox with esmtp (Exim 4.86_2)
 (envelope-from <pkill9@HIDDEN>) id 1k2REL-0004TI-EX
 for bug-guix@HIDDEN; Mon, 03 Aug 2020 05:33:41 +0200
Received: by submission01.runbox with esmtpsa [Authenticated alias (780724)]
 (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1)
 id 1k2RED-0001q0-QC
 for bug-guix@HIDDEN; Mon, 03 Aug 2020 05:33:33 +0200
Date: Mon, 3 Aug 2020 04:33:31 +0100
From: pkill9 <pkill9@HIDDEN>
To: bug-guix@HIDDEN
Subject: Running a script with `guix repl` doesn't "see" additional channels
 using (%package-module-path)
Message-ID: <20200803043331.78b20336@HIDDEN>
X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-unknown-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Received-SPF: pass client-ip=91.220.196.211; envelope-from=pkill9@HIDDEN;
 helo=aibo.runbox.com
X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/02 23:33:41
X-ACL-Warn: Detected OS   = ???
X-Spam_score_int: -25
X-Spam_score: -2.6
X-Spam_bar: --
X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7,
 RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -0.1 (/)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.1 (--)

Running the following in `guix repl` returns additional channels:
```
itsme@antelope ~> guix repl
GNU Guile 3.0.4
Copyright (C) 1995-2020 Free Software Foundation, Inc.

Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.

Enter `,help' for help.
scheme@(guix-user)> (use-modules (gnu packages))
scheme@(guix-user)> (%package-module-path)
$1 =
(("/gnu/store/kds0mq06qpin125gkikwzdm6mjfwjffc-guix-module-union/share/guile/site/3.0"
. "gnu/packages")
"/gnu/store/96pa4rc57zgqf36y2kv8z20p2jvlgypq-pkill9-free-channel-dependency/share/guile/site/3.0"
"/gnu/store/3ilx18ywdm6xk9f5l1mznrn45vcbncsq-pkill9-free/share/guile/site/3.0")
scheme@(guix-user)>
```

But running the following in "test.scm" with `guix repl /tmp/test.scm
doesn't return additional channels:
```
(use-modules (gnu packages))
(display (%package-module-path))
```

```
((/gnu/store/kds0mq06qpin125gkikwzdm6mjfwjffc-guix-module-union/share/guile/site/3.0
. gnu/packages))
```

fold-available-packages uses this to search for packages, which I am
using for a script. As a result, the script doesn't know about packages
from the additional channels.




Acknowledgement sent to pkill9 <pkill9@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-guix@HIDDEN. Full text available.
Report forwarded to bug-guix@HIDDEN:
bug#42688; Package guix. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Thu, 17 Sep 2020 19:15:01 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.