GNU bug report logs - #59256
Emacs-guix tab-completion returns gexp error

Previous Next

Package: guix;

Reported by: Joshua Hecker <joshua0609 <at> mailbox.org>

Date: Mon, 14 Nov 2022 09:13:02 UTC

Severity: normal

To reply to this bug, email your comments to 59256 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#59256; Package guix. (Mon, 14 Nov 2022 09:13:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Joshua Hecker <joshua0609 <at> mailbox.org>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Mon, 14 Nov 2022 09:13:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Joshua Hecker <joshua0609 <at> mailbox.org>
To: bug-guix <at> gnu.org
Subject: Emacs-guix tab-completion returns gexp error
Date: Sun, 13 Nov 2022 16:16:22 -0600
To Guix,

Emacs-guix tab-completion or M-x guix-command returns:

Error in evaluating guile expression: ice-9/boot-9.scm:1685:16: In procedure raise-exception:
/home/crono/.config/guix/current/share/guile/site/3.0/guix/scripts/deploy.scm:177:7: Unknown # object: "#~"

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
scheme@(emacs-guix) [1]>

It seems to me that the repl doesnt have the gexp module loaded? I have
tried changing the guix-load-path and guix-compiled-load-path for
emacs. As well as loading the gexp module in both the emacs-guix and
internal repl.

For the "is this reproducible" question just in case:
https://logs.guix.gnu.org/guix/2022-11-08.log#204945
https://logs.guix.gnu.org/guix/2022-11-13.log#195613

Thank you,
-Joshua




Information forwarded to bug-guix <at> gnu.org:
bug#59256; Package guix. (Sat, 26 Nov 2022 20:46:02 GMT) Full text and rfc822 format available.

Message #8 received at 59256 <at> debbugs.gnu.org (full text, mbox):

From: Joshua Hecker <joshua0609 <at> mailbox.org>
To: Joshua Hecker <joshua0609 <at> mailbox.org>, 59256 <at> debbugs.gnu.org
Subject: Re: bug#59256: Emacs-guix tab-completion returns gexp error
Date: Sat, 26 Nov 2022 14:45:24 -0600
To Guix,

Just following up for the record, turning (setq guix-repl-use-server
nil) does fix the reading issue. For whats it worth at least we can
safely say it with how sockets (at least in for guile) handle gexp.
I will investigate further with do time.

stay safe,
-Joshua




Information forwarded to bug-guix <at> gnu.org:
bug#59256; Package guix. (Thu, 15 Dec 2022 13:02:02 GMT) Full text and rfc822 format available.

Message #11 received at 59256 <at> debbugs.gnu.org (full text, mbox):

From: calcium <calcium <at> disroot.org>
To: 59256 <at> debbugs.gnu.org
Subject: Emacs-guix tab-completion returns gexp error
Date: Thu, 15 Dec 2022 13:01:13 +0000
The problem can be tracked back from elisp procedure `guix-pcomplete-search-in-help` in guix-pcomplete.el to `guix-help-string` in guix-misc.el, to this problematic code :
```
(guix-eval-read "(help-string )")
```

The procedure help-string exists, as can be seen below :
```
(guix-eval-read
 "(begin
  (use-modules (ice-9 format))
  (format #f \"~s\"
   help-string))") ;; => "#<procedure help-string commands>"
```

but the object that `(help-string)` returns seems incompatible with guile's own repl/shell ....

The solution might be to just change the `help-string` procedure to return another kind of object, or to fix guile's repl/shell for that kind of object.






Information forwarded to bug-guix <at> gnu.org:
bug#59256; Package guix. (Mon, 02 Jan 2023 07:30:01 GMT) Full text and rfc822 format available.

Message #14 received at 59256 <at> debbugs.gnu.org (full text, mbox):

From: Joshua Hecker <joshua0609 <at> mailbox.org>
To: calcium <calcium <at> disroot.org>, 59256 <at> debbugs.gnu.org
Subject: Re: bug#59256: Emacs-guix tab-completion returns gexp error
Date: Mon, 02 Jan 2023 01:29:34 -0600
calcium <calcium <at> disroot.org> writes:

> The problem can be tracked back from elisp procedure
> `guix-pcomplete-search-in-help` in guix-pcomplete.el to
> `guix-help-string` in guix-misc.el, to this problematic code :
>
> ```
> (guix-eval-read "(help-string )")
> ```
>
>
> The procedure help-string exists, as can be seen below :
>
> ```
> (guix-eval-read
>   "(begin
>    (use-modules (ice-9 format))
>    (format #f \"~s\"
>     help-string))") ;; => "#<procedure help-string commands>"
> ```
>
> but the object that `(help-string)` returns seems incompatible with guile's own repl/shell ....
>
> The solution might be to just change the `help-string` procedure to
> return another kind of object, or to fix guile's repl/shell for that
> kind of object.

Im certain it's not anyone procedure, but rather the internal repl being in a
socket file. I dont know how guile is handling sockets, but guile
(socketed) cant read '#' for some reason.

The next step might be going to the guile mailing list and getting some
answers there, cause guile has nil for documentation and I have come up
empty handed in looking for any answers for guile socket files. Either way, I
think emacs-guix is important enough to get this fix, so will do.

Stay safe,
-Joshua




Information forwarded to bug-guix <at> gnu.org:
bug#59256; Package guix. (Tue, 03 Jan 2023 22:26:02 GMT) Full text and rfc822 format available.

Message #17 received at 59256 <at> debbugs.gnu.org (full text, mbox):

From: Maxime Devos <maximedevos <at> telenet.be>
To: Joshua Hecker <joshua0609 <at> mailbox.org>, 59256 <at> debbugs.gnu.org
Subject: Re: bug#59256: Emacs-guix tab-completion returns gexp error
Date: Tue, 3 Jan 2023 23:25:46 +0100
[Message part 1 (text/plain, inline)]
I've heard about something about Guile sockets and REPLs, so I've 
investigated a bit and I think I found a Guix bug instead of a Guile bug 
(and is unrelated to sockets or REPLs):

In the error message, there is a mention of "#~". Perhaps somehow, no 
hash extension (not sure about terminology) for G-exps installed?
This is confirmed by:

scheme@(emacs-guix) [2]> (fluid-ref* %read-hash-procedures 0)
$24 = ((#\. . #<procedure 7fbac9e323d0 at ice-9/boot-9.scm:2251:18 (c 
port)>))

It's also not a matter of some parametrisation:

scheme@(emacs-guix) [2]> (fluid-ref* %read-hash-procedures 1)
$25 = ()
scheme@(emacs-guix) [2]> (fluid-ref* %read-hash-procedures 2)
$26 = ()

How does this happen? (after all, (guix scripts deploy) imports (guix gexp))

Going by the backtrace I get:

[...]
In guix/ui.scm:
   2263:7 17 (run-guix . _)
In ice-9/boot-9.scm:
  1747:15 16 (with-exception-handler #<procedure 7fbac4ead6c0 at 
ice-9/boot-9.scm:1831:7 (exn)> _ #:unwind? _ #:unwind-for-type _)
In guix/ui.scm:
  2184:20 15 (show-guix-help)
In srfi/srfi-1.scm:
   691:23 14 (filter-map #<procedure source-file-command (file)> _ . _)
In ice-9/ports.scm:
   433:17 13 (call-with-input-file _ _ #:binary _ #:encoding _ 
#:guess-encoding _)
In guix/ui.scm:
  2109:16 12 (_ #<input: 
/home/antipode/.config/guix/current/share/guile/site/3.0/guix/scripts/deploy.scm 
22>)
In ice-9/read.scm:
   734:20 11 (%read #<input: 
/home/antipode/.config/guix/current/share/guile/site/3.0/guix/scripts/deploy.scm 
22> #<procedure 7fbac42c5280 at ice-9/read.scm:862:8 (line column datum)> _)
    210:5 10 (read-parenthesized #\))
[...]

That is, one of the earliest things that happen, is that (guix ui) reads 
the file "(guix scripts deploy)" -- it doesn't do the reflection 
equivalent of (use-module ...) which will run the imports before reading 
the rest of the code.

As such, the hash extension isn't installed even though it is required 
to read the file and even though the required module (guix gexp) is 
listed in the imports!

To fix this, I propose modifying 'source-file-command' in (guix ui), by 
adding a clause to

        (match (read port)
          (('define-command _ ('synopsis synopsis)
             _ ...)
           (command command-name synopsis 'main))
          (('define-command _
             ('category category) ('synopsis synopsis)
             _ ...)
           (command command-name synopsis category))
          ((? eof-object?)
           #f)
          (_
           (loop)))))))

which recognises (define-module [...] #:use-module MODULE ...),
and if MODULE is (guix gexp) or (srfi srfi-88), then does 
(resolve-module 'MODULE #:ensure #false) before continuing with (loop).

(Untested!)

Greetings,
Maxime.
[OpenPGP_0x49E3EE22191725EE.asc (application/pgp-keys, attachment)]
[OpenPGP_signature (application/pgp-signature, attachment)]

Information forwarded to bug-guix <at> gnu.org:
bug#59256; Package guix. (Wed, 22 Mar 2023 06:11:01 GMT) Full text and rfc822 format available.

Message #20 received at 59256 <at> debbugs.gnu.org (full text, mbox):

From: Joshua Hecker <joshua0609 <at> mailbox.org>
To: Maxime Devos <maximedevos <at> telenet.be>, 59256 <at> debbugs.gnu.org
Subject: Re: bug#59256: Emacs-guix tab-completion returns gexp error
Date: Wed, 22 Mar 2023 01:10:14 -0500
Maxime Devos <maximedevos <at> telenet.be> writes:

Sorry for getting back to you so late, life got in the way, work and
setting up my POWER9 machine :). But I still hope you can provide some
wisdom.

> I've heard about something about Guile sockets and REPLs, so I've
> investigated a bit and I think I found a Guix bug instead of a Guile
> bug (and is unrelated to sockets or REPLs):

Im glad you found something different happening behind the scenes. I
only came to that conclusion because I loaded my own [default] geiser
repl with emacs-guix mode, and comparing that to the emacs-guix repl
that loads automatically.

> In the error message, there is a mention of "#~". Perhaps somehow, no
> hash extension (not sure about terminology) for G-exps installed?
> This is confirmed by:
>
> scheme@(emacs-guix) [2]> (fluid-ref* %read-hash-procedures 0)
> $24 = ((#\. . #<procedure 7fbac9e323d0 at ice-9/boot-9.scm:2251:18 (c
> port)>))
>
> It's also not a matter of some parametrisation:
>
> scheme@(emacs-guix) [2]> (fluid-ref* %read-hash-procedures 1)
> $25 = ()
> scheme@(emacs-guix) [2]> (fluid-ref* %read-hash-procedures 2)
> $26 = ()
>
> How does this happen? (after all, (guix scripts deploy) imports (guix gexp))
>
> Going by the backtrace I get:
>
> [...]
> In guix/ui.scm:
>    2263:7 17 (run-guix . _)
> In ice-9/boot-9.scm:
>   1747:15 16 (with-exception-handler #<procedure 7fbac4ead6c0 at
>   ice-9/boot-9.scm:1831:7 (exn)> _ #:unwind? _ #:unwind-for-type _)
> In guix/ui.scm:
>   2184:20 15 (show-guix-help)
> In srfi/srfi-1.scm:
>    691:23 14 (filter-map #<procedure source-file-command (file)> _ . _)
> In ice-9/ports.scm:
>    433:17 13 (call-with-input-file _ _ #:binary _ #:encoding _
>    #:guess-encoding _)
> In guix/ui.scm:
>   2109:16 12 (_ #<input:
>   /home/antipode/.config/guix/current/share/guile/site/3.0/guix/scripts/deploy.scm
>   22>)
> In ice-9/read.scm:
>    734:20 11 (%read #<input:
>    /home/antipode/.config/guix/current/share/guile/site/3.0/guix/scripts/deploy.scm
>    22> #<procedure 7fbac42c5280 at ice-9/read.scm:862:8 (line column
>   datum)> _)
>     210:5 10 (read-parenthesized #\))
> [...]
>
> That is, one of the earliest things that happen, is that (guix ui)
> reads the file "(guix scripts deploy)" -- it doesn't do the reflection
> equivalent of (use-module ...) which will run the imports before
> reading the rest of the code.
>
> As such, the hash extension isn't installed even though it is required
> to read the file and even though the required module (guix gexp) is
> listed in the imports!
>
> To fix this, I propose modifying 'source-file-command' in (guix ui),
> by adding a clause to
>
>         (match (read port)
>           (('define-command _ ('synopsis synopsis)
>              _ ...)
>            (command command-name synopsis 'main))
>           (('define-command _
>              ('category category) ('synopsis synopsis)
>              _ ...)
>            (command command-name synopsis category))
>           ((? eof-object?)
>            #f)
>           (_
>            (loop)))))))
>
> which recognises (define-module [...] #:use-module MODULE ...),
> and if MODULE is (guix gexp) or (srfi srfi-88), then does
> (resolve-module 'MODULE #:ensure #false) before continuing with
> (loop).
>
> (Untested!)

Very cool that you found this. I would love to test this out, is there
any formal way to apply this and have emacs point to the test guix?
Sorry for novice questions, any info to do the work would be much appreciated.

Stay safe,
-Joshua
 




Information forwarded to bug-guix <at> gnu.org:
bug#59256; Package guix. (Wed, 05 Apr 2023 12:37:02 GMT) Full text and rfc822 format available.

Message #23 received at 59256 <at> debbugs.gnu.org (full text, mbox):

From: Maxime Devos <maximedevos <at> telenet.be>
To: Joshua Hecker <joshua0609 <at> mailbox.org>, 59256 <at> debbugs.gnu.org
Subject: Re: bug#59256: Emacs-guix tab-completion returns gexp error
Date: Wed, 5 Apr 2023 14:36:37 +0200
[Message part 1 (text/plain, inline)]
Op 22-03-2023 om 07:10 schreef Joshua Hecker:
> [...]

I'm not involved in Guix development anymore.

Greetings,
Maxime.
[OpenPGP_0x49E3EE22191725EE.asc (application/pgp-keys, attachment)]
[OpenPGP_signature (application/pgp-signature, attachment)]

This bug report was last modified 2 years and 154 days ago.

Previous Next


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