GNU bug report logs - #44612
Read standard input in `guix repl'

Previous Next

Package: guix;

Reported by: Pierre Neidhardt <mail <at> ambrevar.xyz>

Date: Fri, 13 Nov 2020 09:42:01 UTC

Severity: normal

Tags: notabug

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 44612 in the body.
You can then email your comments to 44612 AT debbugs.gnu.org in the normal way.

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#44612; Package guix. (Fri, 13 Nov 2020 09:42:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Pierre Neidhardt <mail <at> ambrevar.xyz>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Fri, 13 Nov 2020 09:42:01 GMT) Full text and rfc822 format available.

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

From: Pierre Neidhardt <mail <at> ambrevar.xyz>
To: bug-guix <at> gnu.org
Subject: Read standard input in `guix repl'
Date: Fri, 13 Nov 2020 10:41:38 +0100
[Message part 1 (text/plain, inline)]
`guix repl` is a fantastic, hassle-free tool to bind Guix with
third-party languages.  I've done it here:

https://github.com/atlas-engineer/nyxt/blob/2-pre-release-4/libraries/ospama/ospama-guix.lisp

It just works!

The only issue is that it needs to be passed a file, so I must create a
temporary file so that I can call `guix repl` on it.

It'd be better if we could send Guile code to the standard input of the
`guix repl -` process to bypass file generation.

Thoughts?

-- 
Pierre Neidhardt
https://ambrevar.xyz/
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Fri, 13 Nov 2020 19:09:01 GMT) Full text and rfc822 format available.

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

From: Bengt Richter <bokr <at> bokr.com>
To: Pierre Neidhardt <mail <at> ambrevar.xyz>
Cc: 44612 <at> debbugs.gnu.org
Subject: Re: bug#44612: Read standard input in `guix repl'
Date: Fri, 13 Nov 2020 20:08:30 +0100
Hi Pierre,

On +2020-11-13 10:41:38 +0100, Pierre Neidhardt wrote:
> `guix repl` is a fantastic, hassle-free tool to bind Guix with
> third-party languages.  I've done it here:
> 
> https://github.com/atlas-engineer/nyxt/blob/2-pre-release-4/libraries/ospama/ospama-guix.lisp
> 
> It just works!
> 
> The only issue is that it needs to be passed a file, so I must create a
> temporary file so that I can call `guix repl` on it.
> 
> It'd be better if we could send Guile code to the standard input of the
> `guix repl -` process to bypass file generation.
> 
> Thoughts?
>

Would this enable people to type something like
    wget -O - http:try.this.for.example.com/fun.mischief|guix repl -
and if so, can you suggest some options for automatic hash or signature
checking so that a paranoid could feel safe using a file pointed to
by a friend? 

(I know one can already do silly stuff ... :)

I was hoping for a concise option that would enable a standard way of doing
integrity/trust checks by the stdin bufferful within guix. (Which I guess implies
designing fun.mischief file syntax as some kind of container packet stream, with
individually verifiable packets -- what would that mean for input to guix repl?). 

Maybe a --paranoid option at the level of --dry-run or -n ?
(maybe configurable as default --paranoid=on :)

As far as avoiding file generation, a pipeline that needs file-size chunks to do
validation checks would only avoid file inode supply limits, right?
I guess YMMV per platform? IPC also has supply limits, IIRC.

Hm, what about an option for guix like
   guix  --trust-manifest="file-containing-sufficient-verification-info-for-what-happens-next" repl -
meaning e.g., sha256sum value for what would be passed via '-' and if that contains references
to other files etc., than hashes or signatures etc for everything entailed.

> -- 
> Pierre Neidhardt
> https://ambrevar.xyz/

-- 
Regards,
Bengt Richter




Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Fri, 13 Nov 2020 20:28:01 GMT) Full text and rfc822 format available.

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

From: Tobias Geerinckx-Rice <me <at> tobias.gr>
To: Pierre Neidhardt <mail <at> ambrevar.xyz>
Cc: bug-guix <at> gnu.org, 44612 <at> debbugs.gnu.org
Subject: Re: bug#44612: Read standard input in `guix repl'
Date: Fri, 13 Nov 2020 21:27:28 +0100
[Message part 1 (text/plain, inline)]
Pierre,

Pierre Neidhardt 写道:
> The only issue is that it needs to be passed a file, so I must 
> create a
> temporary file so that I can call `guix repl` on it.

A magic ‘-’ alias is nice, providing ‘guix repl -- -’ still DTRT 
(I know, who does that, but still).

But why can't you just pipe your input into ‘guix repl’ now?

Kind regards,

T G-R
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Fri, 13 Nov 2020 20:28:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Fri, 13 Nov 2020 22:27:01 GMT) Full text and rfc822 format available.

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

From: zimoun <zimon.toutoune <at> gmail.com>
To: Bengt Richter <bokr <at> bokr.com>, Pierre Neidhardt <mail <at> ambrevar.xyz>
Cc: 44612 <at> debbugs.gnu.org
Subject: Re: bug#44612: Read standard input in `guix repl'
Date: Fri, 13 Nov 2020 23:24:26 +0100
Dear,

On Fri, 13 Nov 2020 at 20:08, Bengt Richter <bokr <at> bokr.com> wrote:

> Would this enable people to type something like
>     wget -O - http:try.this.for.example.com/fun.mischief|guix repl -
> and if so, can you suggest some options for automatic hash or signature
> checking so that a paranoid could feel safe using a file pointed to
> by a friend? 

How is it different to:

   cat file | guix repl
or
   guix repl -- file

?  « Stupid is as stupid does, sir. »  Well, it is hard nor impossible
to prevent people to shoot themselves in their foot if they really want
to.  Somehow.


For instance,

--8<---------------cut here---------------start------------->8---
$ cat /tmp/foo.scm | 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.
name: hello
version: 2.10
outputs: out
systems: x86_64-linux i686-linux
dependencies: 
location: gnu/packages/base.scm:74:2
homepage: https://www.gnu.org/software/hello/
license: GPL 3+
synopsis: Hello, GNU world: An example GNU package  
description: GNU Hello prints the message "Hello, world!" and then exits.  It serves as an example of standard GNU coding practices.  As such, it supports command-line arguments, multiple languages, and so on.

$1 = #t
scheme@(guix-user)> 
$ cat /tmp/foo.scm
(use-modules (gnu packages base)
             (guix scripts show))

(guix-show "hello")
--8<---------------cut here---------------end--------------->8---

All the best,
simon




Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Sat, 14 Nov 2020 09:53:02 GMT) Full text and rfc822 format available.

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

From: Pierre Neidhardt <mail <at> ambrevar.xyz>
To: Tobias Geerinckx-Rice <me <at> tobias.gr>
Cc: bug-guix <at> gnu.org, 44612 <at> debbugs.gnu.org
Subject: Re: bug#44612: Read standard input in `guix repl'
Date: Sat, 14 Nov 2020 10:52:21 +0100
[Message part 1 (text/plain, inline)]
Tobias Geerinckx-Rice <me <at> tobias.gr> writes:

> A magic ‘-’ alias is nice, providing ‘guix repl -- -’ still DTRT 
> (I know, who does that, but still).
>
> But why can't you just pipe your input into ‘guix repl’ now?

It does not work now, I haven't looked at the details.

-- 
Pierre Neidhardt
https://ambrevar.xyz/
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Sat, 14 Nov 2020 09:53:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Sat, 14 Nov 2020 11:24:01 GMT) Full text and rfc822 format available.

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

From: Tobias Geerinckx-Rice <me <at> tobias.gr>
To: Pierre Neidhardt <mail <at> ambrevar.xyz>
Cc: bug-guix <at> gnu.org, 44612 <at> debbugs.gnu.org
Subject: Re: bug#44612: Read standard input in `guix repl'
Date: Sat, 14 Nov 2020 12:23:13 +0100
[Message part 1 (text/plain, inline)]
Pierre,

So far this looks like an (SB)CL(-specific) bug, right?  Does it 
happen anywhere else?  I tried Guile[0].

Pierre Neidhardt 写道:
> It does not work now, I haven't looked at the details.

Please do.

To ‘it does not work’ I can reply only that Nyxt doesn't build 
[log attached] on current master & that learning Common Lisp by 
putting random text into SBCL doesn't work :-)

Kind regards,

T G-R

[0]:
(use-modules ((ice-9 popen)))
(let ((g (open-output-pipe "guix repl")))
 ;; XXX The Guile prompt after each input line is ugly.
 (display "(use-modules ((guix))) (%store-prefix)" g)
 (close-pipe g))

[nyxt.log (application/octet-stream, attachment)]
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Sat, 14 Nov 2020 11:24:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Sat, 14 Nov 2020 13:20:01 GMT) Full text and rfc822 format available.

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

From: Pierre Neidhardt <mail <at> ambrevar.xyz>
To: Tobias Geerinckx-Rice <me <at> tobias.gr>
Cc: bug-guix <at> gnu.org, 44612 <at> debbugs.gnu.org
Subject: Re: bug#44612: Read standard input in `guix repl'
Date: Sat, 14 Nov 2020 14:19:04 +0100
[Message part 1 (text/plain, inline)]
Hey Tobias,

Always good to have someone actually test the stuff :)

Tobias Geerinckx-Rice <me <at> tobias.gr> writes:

> So far this looks like an (SB)CL(-specific) bug, right?  Does it 
> happen anywhere else?  I tried Guile[0].

Maybe there was a misunderstanding, it's not about Common Lisp.
We can do easier than from Guile, i.e. from a shell:

--8<---------------cut here---------------start------------->8---
echo '(display "hello")' | guix repl
--8<---------------cut here---------------end--------------->8---

and... it works! O.o

OK, my bad then, I mistested somehow.

For future reference, it's also works in Common Lisp:

--8<---------------cut here---------------start------------->8---
> (with-input-from-string (s "(display \"foo\\n\")")
           (uiop:run-program '("guix" "repl") :input s :output t :error-output nil))
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.
foo

--8<---------------cut here---------------end--------------->8---

However this brings me to another issue: the program output is prefixed
with the REPL welcome message which is printed to stdout.

So ideally when we read from standard input we should not include the
welcome message.

Any clue how to do that?

-- 
Pierre Neidhardt
https://ambrevar.xyz/
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Sat, 14 Nov 2020 13:20:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Sat, 14 Nov 2020 13:26:02 GMT) Full text and rfc822 format available.

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

From: Pierre Neidhardt <mail <at> ambrevar.xyz>
To: Tobias Geerinckx-Rice <me <at> tobias.gr>
Cc: bug-guix <at> gnu.org, 44612 <at> debbugs.gnu.org
Subject: Re: bug#44612: Read standard input in `guix repl'
Date: Sat, 14 Nov 2020 14:24:53 +0100
[Message part 1 (text/plain, inline)]
Tobias Geerinckx-Rice <me <at> tobias.gr> writes:

> To ‘it does not work’ I can reply only that Nyxt doesn't build 
> [log attached] on current master

Shoot! :p

Which architecture?

I builds for me on x86-64 at commit
403ba4140f52b9ea9483e4c775f102bbb9753e51.

I've released Nyxt 2-pre-release-4 a few days ago and I've used it to
build the Guix pack, so your feedback is surprising.

Or is it a reproducibility issue?

-- 
Pierre Neidhardt
https://ambrevar.xyz/
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Sat, 14 Nov 2020 13:26:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Sat, 14 Nov 2020 13:59:02 GMT) Full text and rfc822 format available.

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

From: Tobias Geerinckx-Rice <me <at> tobias.gr>
To: Pierre Neidhardt <mail <at> ambrevar.xyz>
Cc: bug-guix <at> gnu.org, 44612 <at> debbugs.gnu.org
Subject: Re: bug#44612: Read standard input in `guix repl'
Date: Sat, 14 Nov 2020 14:58:08 +0100
[Message part 1 (text/plain, inline)]
Pierre,

Pierre Neidhardt 写道:
> and... it works! O.o

Don't you hate it when that happens?  Ban bug suicide.

(Does that mean this one can be closed?  Or retitled, if we want 
to debug Nyxt? :-)

> For future reference, it's also works in Common Lisp:
>            (uiop:run-program '("guix" "repl") :input s :output t 
>            :error-output nil))

Well, I stranded trying to import (or whatever the CL term is) 
UIOP itself, but my Common Lisp-fu is hella weak.

> However this brings me to another issue: the program output is 
> prefixed
> with the REPL welcome message which is printed to stdout.
>
> So ideally when we read from standard input we should not 
> include the
> welcome message.

That's a question for Guile channels, but I totally agree.  It's 
annoying and nowhere near ‘an interactive mode’ as suggested by 
the GPL3.

This is sensible:

 $ echo echo Hi. | bash
 Hi.
 $ 

This is not:

 $ echo '(display "Hi.\n")' | guile
 GNU Guile 3.0.2
 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.
 Hi.
 scheme@(guile-user)> 
 $

> Any clue how to do that?

The following line in my ~/.guile does just that:

 (set! repl-welcome (const #t))

...unfortunately, it doesn't work late:

 $ echo '(use-modules ((system repl common))) \
   (set! repl-welcome (const #t))' | guix repl
 [shouty noises]
 $

It does not appear documented if and how you'd make Guile load a 
different (Nyxt-specific) init file name.

This reminds me: do you want Nyxt to call ‘guix repl -q’ to skip 
loading ~/.guile to make your UI more predictable & debuggable? 
Or keep it as an escape hatch for cool hacks?

Kind regards,

T G-R
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Sat, 14 Nov 2020 13:59:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Sat, 14 Nov 2020 14:13:02 GMT) Full text and rfc822 format available.

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

From: Tobias Geerinckx-Rice <me <at> tobias.gr>
To: Pierre Neidhardt <mail <at> ambrevar.xyz>
Cc: bug-guix <at> gnu.org, 44612 <at> debbugs.gnu.org
Subject: Re: bug#44612: Read standard input in `guix repl'
Date: Sat, 14 Nov 2020 15:12:10 +0100
[Message part 1 (text/plain, inline)]
Pierre Neidhardt 写道:
> Tobias Geerinckx-Rice <me <at> tobias.gr> writes:
>
>> To ‘it does not work’ I can reply only that Nyxt doesn't build 
>> [log attached] on current master
>
> Shoot! :p
>
> Which architecture?

Boring old x86_64 I'm afraid.

> I builds for me on x86-64 at commit
> 403ba4140f52b9ea9483e4c775f102bbb9753e51.

I pulled to that commit but it's still the same ungrafted 
derivation 
(/gnu/store/bdi8dq8i3f59zxp7jrabas847dh80m7x-nyxt-2-pre-release-4.drv).

Building for the fourth time now, with -{M,c}1...

...nope, always the same error:

 Unhandled ASDF/FIND-COMPONENT:MISSING-DEPENDENCY in thread
   #<SB-THREAD:THREAD "main thread" RUNNING {1001898213}>:
 Component "cl-base64" not found, required by #<SYSTEM "dexador">

So I'm surprised it does build for you.  Weak Lisp-fu or not, that 
looks pretty deterministic to me.  Weird.

> Or is it a reproducibility issue?

No, it's an error in the ‘build’ phase.

Kind regards,

T G-R
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Sat, 14 Nov 2020 14:13:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Sat, 14 Nov 2020 14:27:02 GMT) Full text and rfc822 format available.

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

From: zimoun <zimon.toutoune <at> gmail.com>
To: Pierre Neidhardt <mail <at> ambrevar.xyz>, Tobias Geerinckx-Rice <me <at> tobias.gr>
Cc: 44612 <at> debbugs.gnu.org
Subject: Re: bug#44612: Read standard input in `guix repl'
Date: Sat, 14 Nov 2020 13:09:54 +0100
Hi Pierre,

On Sat, 14 Nov 2020 at 10:52, Pierre Neidhardt <mail <at> ambrevar.xyz> wrote:
> Tobias Geerinckx-Rice <me <at> tobias.gr> writes:
>
>> A magic ‘-’ alias is nice, providing ‘guix repl -- -’ still DTRT 
>> (I know, who does that, but still).
>>
>> But why can't you just pipe your input into ‘guix repl’ now?
>
> It does not work now, I haven't looked at the details.

It does with the plain shell pipe ’|’:

--8<---------------cut here---------------start------------->8---
$ echo 42 | 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.
$1 = 42
scheme@(guix-user)>
$ 
--8<---------------cut here---------------end--------------->8---

Another example here:

  <https://yhetil.org/guix-bugs/86mtzkdhet.fsf <at> tournier.info>


Please look at the details.

All the best,
simon




Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Sat, 14 Nov 2020 15:05:02 GMT) Full text and rfc822 format available.

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

From: Guillaume Le Vaillant <glv <at> posteo.net>
To: Tobias Geerinckx-Rice <me <at> tobias.gr>
Cc: bug-guix <at> gnu.org, Pierre Neidhardt <mail <at> ambrevar.xyz>,
 44612 <at> debbugs.gnu.org
Subject: Re: bug#44612: Read standard input in `guix repl'
Date: Sat, 14 Nov 2020 16:03:56 +0100
[Message part 1 (text/plain, inline)]
Tobias Geerinckx-Rice via Bug reports for GNU Guix <bug-guix <at> gnu.org> skribis:

> Pierre,
>
> Pierre Neidhardt 写道:
>> and... it works! O.o
>
> Don't you hate it when that happens?  Ban bug suicide.
>
> (Does that mean this one can be closed?  Or retitled, if we want to debug
> Nyxt? :-)
>
>> For future reference, it's also works in Common Lisp:
>>            (uiop:run-program '("guix" "repl") :input s :output
>> t            :error-output nil))
>
> Well, I stranded trying to import (or whatever the CL term is) UIOP itself, but
> my Common Lisp-fu is hella weak.
>
>> However this brings me to another issue: the program output is prefixed
>> with the REPL welcome message which is printed to stdout.
>>
>> So ideally when we read from standard input we should not include the
>> welcome message.
>
> That's a question for Guile channels, but I totally agree.  It's annoying and
> nowhere near ‘an interactive mode’ as suggested by the GPL3.
>
> This is sensible:
>
>  $ echo echo Hi. | bash
>  Hi.
>  $ 
> This is not:
>
>  $ echo '(display "Hi.\n")' | guile
>  GNU Guile 3.0.2
>  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.
>  Hi.
>  scheme@(guile-user)>   $
>
>> Any clue how to do that?
>
> The following line in my ~/.guile does just that:
>
>  (set! repl-welcome (const #t))
>
> ...unfortunately, it doesn't work late:
>
>  $ echo '(use-modules ((system repl common))) \
>    (set! repl-welcome (const #t))' | guix repl
>  [shouty noises]
>  $
>
> It does not appear documented if and how you'd make Guile load a different
> (Nyxt-specific) init file name.
>
> This reminds me: do you want Nyxt to call ‘guix repl -q’ to skip loading
> ~/.guile to make your UI more predictable & debuggable? Or keep it as an escape
> hatch for cool hacks?
>
> Kind regards,
>
> T G-R

It looks like you can get rid of the welcome message by using the '-s'
option:

$ echo '(display "Hi.\n")' | guile -s /dev/stdin
Hi.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Sat, 14 Nov 2020 15:05:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Sat, 14 Nov 2020 15:08:02 GMT) Full text and rfc822 format available.

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

From: Guillaume Le Vaillant <glv <at> posteo.net>
To: Tobias Geerinckx-Rice <me <at> tobias.gr>
Cc: bug-guix <at> gnu.org, Pierre Neidhardt <mail <at> ambrevar.xyz>,
 44612 <at> debbugs.gnu.org
Subject: Re: bug#44612: Read standard input in `guix repl'
Date: Sat, 14 Nov 2020 16:07:27 +0100
[Message part 1 (text/plain, inline)]
Guillaume Le Vaillant <glv <at> posteo.net> skribis:

> It looks like you can get rid of the welcome message by using the '-s'
> option:
>
> $ echo '(display "Hi.\n")' | guile -s /dev/stdin
> Hi.

Or:
$ echo '(display "Hi.\n")' | guix repl /dev/stdin
Hi.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Sat, 14 Nov 2020 15:08:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Sat, 14 Nov 2020 15:23:01 GMT) Full text and rfc822 format available.

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

From: Tobias Geerinckx-Rice <me <at> tobias.gr>
To: Guillaume Le Vaillant <glv <at> posteo.net>
Cc: bug-guix <at> gnu.org, Pierre Neidhardt <mail <at> ambrevar.xyz>,
 44612 <at> debbugs.gnu.org
Subject: Re: bug#44612: Read standard input in `guix repl'
Date: Sat, 14 Nov 2020 16:22:10 +0100
[Message part 1 (text/plain, inline)]
Guillaume,

Guillaume Le Vaillant 写道:
> It looks like you can get rid of the welcome message by using 
> the '-s'
> option:

Wonderful!

But I'd tried ‘-s’ already:

 $ guile -s /tmp/scm
 GNU Guile 3.0.4
 Copyright (C) 1995-2020 Free Software Foundation, Inc.
 [...here we go again...]

That's starting to look like a bug.  Or rather, having to use 
‘/dev/stdin’ explicity is clearly an ugly work-around 
for... something.

Kind regards,

T G-R
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Sat, 14 Nov 2020 15:23:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Sat, 14 Nov 2020 15:37:01 GMT) Full text and rfc822 format available.

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

From: Tobias Geerinckx-Rice <me <at> tobias.gr>
Cc: Guillaume Le Vaillant <glv <at> posteo.net>, bug-guix <at> gnu.org, mail <at> ambrevar.xyz,
 44612 <at> debbugs.gnu.org
Subject: Re: bug#44612: Read standard input in `guix repl'
Date: Sat, 14 Nov 2020 16:36:27 +0100
[Message part 1 (text/plain, inline)]
The point is that people shouldn't have to resort to gross 
not-even-POSIX hacks just to get rid of this message.  Imagine 
typing

 ... | grep x /dev/stdin | uniq /dev/stdin | wc /dev/stdin

Kind regards,

T G-R
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Sat, 14 Nov 2020 15:37:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Sat, 14 Nov 2020 15:44:01 GMT) Full text and rfc822 format available.

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

From: Christopher Baines <mail <at> cbaines.net>
To: Pierre Neidhardt <mail <at> ambrevar.xyz>
Cc: Tobias Geerinckx-Rice <me <at> tobias.gr>, 44612 <at> debbugs.gnu.org
Subject: Re: bug#44612: Read standard input in `guix repl'
Date: Sat, 14 Nov 2020 15:43:02 +0000
[Message part 1 (text/plain, inline)]
Pierre Neidhardt <mail <at> ambrevar.xyz> writes:

> Hey Tobias,
>
> Always good to have someone actually test the stuff :)
>
> Tobias Geerinckx-Rice <me <at> tobias.gr> writes:
>
>> So far this looks like an (SB)CL(-specific) bug, right?  Does it 
>> happen anywhere else?  I tried Guile[0].
>
> Maybe there was a misunderstanding, it's not about Common Lisp.
> We can do easier than from Guile, i.e. from a shell:
>
> --8<---------------cut here---------------start------------->8---
> echo '(display "hello")' | guix repl
> --8<---------------cut here---------------end--------------->8---
>
> and... it works! O.o
>
> OK, my bad then, I mistested somehow.
>
> For future reference, it's also works in Common Lisp:
>
> --8<---------------cut here---------------start------------->8---
>> (with-input-from-string (s "(display \"foo\\n\")")
>            (uiop:run-program '("guix" "repl") :input s :output t :error-output nil))
> 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.
> foo
>
> --8<---------------cut here---------------end--------------->8---
>
> However this brings me to another issue: the program output is prefixed
> with the REPL welcome message which is printed to stdout.
>
> So ideally when we read from standard input we should not include the
> welcome message.
>
> Any clue how to do that?

I haven't been following along too closely, but I'm surprised guix repl
--type=machine hasn't been mentioned, is that relevant?
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Sat, 14 Nov 2020 16:04:02 GMT) Full text and rfc822 format available.

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

From: Pierre Neidhardt <mail <at> ambrevar.xyz>
To: Christopher Baines <mail <at> cbaines.net>
Cc: Tobias Geerinckx-Rice <me <at> tobias.gr>, 44612 <at> debbugs.gnu.org
Subject: Re: bug#44612: Read standard input in `guix repl'
Date: Sat, 14 Nov 2020 17:03:40 +0100
[Message part 1 (text/plain, inline)]
Hi Chris!

Christopher Baines <mail <at> cbaines.net> writes:

>> Any clue how to do that?
>
> I haven't been following along too closely, but I'm surprised guix repl
> --type=machine hasn't been mentioned, is that relevant?

Ha, didn't know about this one, I should have read the manual more
closely!

Sadly, it doesn't cut it:

--8<---------------cut here---------------start------------->8---
> echo '(display "Hi.\n")' | guix repl -t machine 2>/dev/null
(repl-version 0 1 1)
Hi.
(values (non-self-quoting 2052 "#<unspecified>"))
--8<---------------cut here---------------end--------------->8---

-- 
Pierre Neidhardt
https://ambrevar.xyz/
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Sat, 14 Nov 2020 16:06:01 GMT) Full text and rfc822 format available.

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

From: Pierre Neidhardt <mail <at> ambrevar.xyz>
To: Tobias Geerinckx-Rice <me <at> tobias.gr>
Cc: bug-guix <at> gnu.org, 44612 <at> debbugs.gnu.org
Subject: Re: bug#44612: Read standard input in `guix repl'
Date: Sat, 14 Nov 2020 17:05:29 +0100
[Message part 1 (text/plain, inline)]
I think this is the old non-UTF8 encoding grafting issue (if you ask me,
I'll send you the link).  Try:

--8<---------------cut here---------------start------------->8---
guix build --no-grafts nyxt
--8<---------------cut here---------------end--------------->8---

If this is the case, nothing Nyxt can do here I'm afraid, as it's a Guix
issue with the reference scannr (it does not find non-UTF8 references).

-- 
Pierre Neidhardt
https://ambrevar.xyz/
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Sat, 14 Nov 2020 16:06:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Sat, 14 Nov 2020 16:07:02 GMT) Full text and rfc822 format available.

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

From: Pierre Neidhardt <mail <at> ambrevar.xyz>
To: Guillaume Le Vaillant <glv <at> posteo.net>, Tobias Geerinckx-Rice
 <me <at> tobias.gr>
Cc: bug-guix <at> gnu.org, 44612 <at> debbugs.gnu.org
Subject: Re: bug#44612: Read standard input in `guix repl'
Date: Sat, 14 Nov 2020 17:06:40 +0100
[Message part 1 (text/plain, inline)]
Fantastic, this works!

Thanks a lot, Guillaume!

I'll update Nyxt then.

-- 
Pierre Neidhardt
https://ambrevar.xyz/
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Sat, 14 Nov 2020 16:07:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Sat, 14 Nov 2020 16:12:02 GMT) Full text and rfc822 format available.

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

From: Pierre Neidhardt <mail <at> ambrevar.xyz>
To: Tobias Geerinckx-Rice <me <at> tobias.gr>
Cc: bug-guix <at> gnu.org, 44612 <at> debbugs.gnu.org
Subject: Re: bug#44612: Read standard input in `guix repl'
Date: Sat, 14 Nov 2020 17:11:03 +0100
[Message part 1 (text/plain, inline)]
Tobias Geerinckx-Rice <me <at> tobias.gr> writes:

> Pierre,
>
> Pierre Neidhardt 写道:
>> and... it works! O.o
>
> Don't you hate it when that happens?  Ban bug suicide.
>
> (Does that mean this one can be closed?  Or retitled,

We can retitle it to remove the Guile banner indeed.


> if we want to debug Nyxt? :-)

Err... I'm confused, this is not about Nyxt :p

>> For future reference, it's also works in Common Lisp:
>>            (uiop:run-program '("guix" "repl") :input s :output t 
>>            :error-output nil))
>
> Well, I stranded trying to import (or whatever the CL term is) 
> UIOP itself, but my Common Lisp-fu is hella weak.

If you tried with SBCL, then you need to first require UIOP:

--8<---------------cut here---------------start------------->8---
(require :uiop)
(with-input-from-string (s "(display \"foo\\n\")")
  (uiop:run-program '("guix" "repl") :input s :output :string :error-output nil))
--8<---------------cut here---------------end--------------->8---

> This reminds me: do you want Nyxt to call ‘guix repl -q’ to skip 
> loading ~/.guile to make your UI more predictable & debuggable? 
> Or keep it as an escape hatch for cool hacks?

Oops, thanks for the reminder.  Will do indeed, I don't think it's
needed in Nyxt.  Or maybe make it optional.  Well, if someone ever
complains about it...

Cheers!

-- 
Pierre Neidhardt
https://ambrevar.xyz/
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Sat, 14 Nov 2020 16:12:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Sat, 14 Nov 2020 16:14:02 GMT) Full text and rfc822 format available.

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

From: Tobias Geerinckx-Rice <me <at> tobias.gr>
To: Pierre Neidhardt <mail <at> ambrevar.xyz>
Cc: bug-guix <at> gnu.org, 44612 <at> debbugs.gnu.org
Subject: Re: bug#44612: Read standard input in `guix repl'
Date: Sat, 14 Nov 2020 17:13:49 +0100
[Message part 1 (text/plain, inline)]
Pierre Neidhardt 写道:
> guix build --no-grafts nyxt

That's what fails.  I haven't tried building with grafts.

Kind regards,

T G-R
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Sat, 14 Nov 2020 16:14:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Sat, 14 Nov 2020 16:26:02 GMT) Full text and rfc822 format available.

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

From: Pierre Neidhardt <mail <at> ambrevar.xyz>
To: Tobias Geerinckx-Rice <me <at> tobias.gr>
Cc: bug-guix <at> gnu.org, 44612 <at> debbugs.gnu.org
Subject: Re: bug#44612: Read standard input in `guix repl'
Date: Sat, 14 Nov 2020 17:25:52 +0100
[Message part 1 (text/plain, inline)]
Does building sbcl-dexador work for you?

Maybe it's a parallel build issue.  Can you reduce the number cores to 1
see if that helps?

-- 
Pierre Neidhardt
https://ambrevar.xyz/
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Sat, 14 Nov 2020 16:27:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Sat, 14 Nov 2020 17:09:02 GMT) Full text and rfc822 format available.

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

From: Tobias Geerinckx-Rice <me <at> tobias.gr>
To: Pierre Neidhardt <mail <at> ambrevar.xyz>
Cc: bug-guix <at> gnu.org, 44612 <at> debbugs.gnu.org
Subject: Re: bug#44612: Read standard input in `guix repl'
Date: Sat, 14 Nov 2020 18:08:11 +0100
[Message part 1 (text/plain, inline)]
Pierre Neidhardt 写道:
> Does building sbcl-dexador work for you?

Yes, even with multiple cores & grafts enabled.

> Maybe it's a parallel build issue.  Can you reduce the number 
> cores to 1
> see if that helps?

I think I mentioned in my previous mail that I was using -{M,c}1. 
Anyway, I was, the message never changes.

Here's that ungrafted derivation again:

 /gnu/store/2s6m5wkjksxi63wv1cz73x0kqj0az2l9-nyxt-2-pre-release-4.drv

Can you confirm that we're building the same thing?

> Err... I'm confused, this is not about Nyxt :p

 Always has been,
   /
T G-R
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Sat, 14 Nov 2020 17:16:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Sat, 14 Nov 2020 17:22:01 GMT) Full text and rfc822 format available.

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

From: Pierre Neidhardt <mail <at> ambrevar.xyz>
To: Tobias Geerinckx-Rice <me <at> tobias.gr>
Cc: bug-guix <at> gnu.org, 44612 <at> debbugs.gnu.org
Subject: Re: bug#44612: Read standard input in `guix repl'
Date: Sat, 14 Nov 2020 18:21:25 +0100
[Message part 1 (text/plain, inline)]
Tobias Geerinckx-Rice <me <at> tobias.gr> writes:

> Here's that ungrafted derivation again:
>
>   /gnu/store/2s6m5wkjksxi63wv1cz73x0kqj0az2l9-nyxt-2-pre-release-4.drv
>
> Can you confirm that we're building the same thing?

We are not, it seems:

--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix build --no-grafts -d nyxt
/gnu/store/bdi8dq8i3f59zxp7jrabas847dh80m7x-nyxt-2-pre-release-4.drv
--8<---------------cut here---------------end--------------->8---

Commit 403ba4140f52b9ea9483e4c775f102bbb9753e51.

-- 
Pierre Neidhardt
https://ambrevar.xyz/
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Sat, 14 Nov 2020 17:22:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Sat, 14 Nov 2020 17:34:01 GMT) Full text and rfc822 format available.

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

From: Tobias Geerinckx-Rice <me <at> tobias.gr>
To: Pierre Neidhardt <mail <at> ambrevar.xyz>
Cc: bug-guix <at> gnu.org, 44612 <at> debbugs.gnu.org
Subject: Re: bug#44612: Read standard input in `guix repl'
Date: Sat, 14 Nov 2020 18:33:10 +0100
[Message part 1 (text/plain, inline)]
Pierre Neidhardt 写道:
> Tobias Geerinckx-Rice <me <at> tobias.gr> writes:
>
>> Here's that ungrafted derivation again:
>>
>>   /gnu/store/2s6m5wkjksxi63wv1cz73x0kqj0az2l9-nyxt-2-pre-release-4.drv
>>
>> Can you confirm that we're building the same thing?
>
> We are not, it seems:
>
> --8<---------------cut 
> here---------------start------------->8---
> $ ./pre-inst-env guix build --no-grafts -d nyxt
> /gnu/store/bdi8dq8i3f59zxp7jrabas847dh80m7x-nyxt-2-pre-release-4.drv
> --8<---------------cut 
> here---------------end--------------->8---
>
> Commit 403ba4140f52b9ea9483e4c775f102bbb9753e51.

Hm, OK, even with

 $ git checkout 403ba4140f52b9ea9483e4c775f102bbb9753e51
 $ guix environment guix -- ./pre-inst-env guix build \
   --no-grafts nyxt -{M,c}1 -d
→ 
/gnu/store/2s6m5wkjksxi63wv1cz73x0kqj0az2l9-nyxt-2-pre-release-4.drv

But for whatever reason I have your derivation, and

 $ guix build --no-grafts -{M,c}1 \
   /gnu/store/bdi8dq8i3f59zxp7jrabas847dh80m7x-nyxt-2-pre-release-4.drv

fails just as reliably, in the same way, so I don't think that's 
related.

I'll try it on a different x86_64 machine.

Kind regards,

T G-R
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Sat, 14 Nov 2020 17:34:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Sat, 14 Nov 2020 19:15:01 GMT) Full text and rfc822 format available.

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

From: zimoun <zimon.toutoune <at> gmail.com>
To: Tobias Geerinckx-Rice <me <at> tobias.gr>, Pierre Neidhardt <mail <at> ambrevar.xyz>
Cc: 44612 <at> debbugs.gnu.org
Subject: Re: bug#44612: Read standard input in `guix repl'
Date: Sat, 14 Nov 2020 20:08:15 +0100
Hi Tobias,

Do not know if it is expected but that downloads the world… then it
compiles it.  It is not Green-friendly. ;-)

If it helps, what I get on my laptop:

>> Commit 403ba4140f52b9ea9483e4c775f102bbb9753e51.

[..]

>> /gnu/store/bdi8dq8i3f59zxp7jrabas847dh80m7x-nyxt-2-pre-release-4.drv

[..]

>   $ guix environment guix -- ./pre-inst-env guix build \
>     --no-grafts nyxt -{M,c}1 -d
> →
> /gnu/store/2s6m5wkjksxi63wv1cz73x0kqj0az2l9-nyxt-2-pre-release-4.drv

[..]

>   $ guix build --no-grafts -{M,c}1 \
>     /gnu/store/bdi8dq8i3f59zxp7jrabas847dh80m7x-nyxt-2-pre-release-4.drv
>
> fails just as reliably, in the same way, so I don't think that's
> related.


--8<---------------cut here---------------start------------->8---
$ guix time-machine --commit=403ba4140f52b9ea9483e4c775f102bbb9753e51 \
       -- build --no-grafts -d nyxt
Updating channel 'guix' from Git repository at 'https://git.savannah.gnu.org/git/guix.git'...
/gnu/store/bdi8dq8i3f59zxp7jrabas847dh80m7x-nyxt-2-pre-release-4.drv

$ guix time-machine --commit=403ba4140f52b9ea9483e4c775f102bbb9753e51 \
       -- build --no-grafts nyxt
Updating channel 'guix' from Git repository at 'https://git.savannah.gnu.org/git/guix.git'...
/gnu/store/1fa4443ripbxjnyvk577hp98r7szrbh2-nyxt-2-pre-release-4

$ guix time-machine --commit=403ba4140f52b9ea9483e4c775f102bbb9753e51 \
       -- build --no-grafts nyxt -{M,c}1 -d
Updating channel 'guix' from Git repository at 'https://git.savannah.gnu.org/git/guix.git'...
/gnu/store/bdi8dq8i3f59zxp7jrabas847dh80m7x-nyxt-2-pre-release-4.drv
--8<---------------cut here---------------end--------------->8---


Cheers,
simon




Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Mon, 16 Nov 2020 09:26:02 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: Bengt Richter <bokr <at> bokr.com>
Cc: Pierre Neidhardt <mail <at> ambrevar.xyz>, 44612 <at> debbugs.gnu.org
Subject: Re: bug#44612: Read standard input in `guix repl'
Date: Mon, 16 Nov 2020 10:25:44 +0100
Hi,

Bengt Richter <bokr <at> bokr.com> skribis:

> On +2020-11-13 10:41:38 +0100, Pierre Neidhardt wrote:
>> `guix repl` is a fantastic, hassle-free tool to bind Guix with
>> third-party languages.  I've done it here:
>> 
>> https://github.com/atlas-engineer/nyxt/blob/2-pre-release-4/libraries/ospama/ospama-guix.lisp

I recommend using ‘guix repl -t machine’ and keeping the REPL process
around instead of respawning it for every expression.

Ludo’.




Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Mon, 16 Nov 2020 10:46:01 GMT) Full text and rfc822 format available.

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

From: Tobias Geerinckx-Rice <me <at> tobias.gr>
To: zimoun <zimon.toutoune <at> gmail.com>
Cc: Pierre Neidhardt <mail <at> ambrevar.xyz>, 44612 <at> debbugs.gnu.org
Subject: Re: bug#44612: Read standard input in `guix repl'
Date: Mon, 16 Nov 2020 11:45:41 +0100
[Message part 1 (text/plain, inline)]
Simon,

zimoun 写道:
> Do not know if it is expected but that downloads the world… then 
> it
> compiles it.  It is not Green-friendly. ;-)

What exactly downloads the world?

Kind regards,

T G-R
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Mon, 16 Nov 2020 11:37:02 GMT) Full text and rfc822 format available.

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

From: Pierre Neidhardt <mail <at> ambrevar.xyz>
To: Ludovic Courtès <ludo <at> gnu.org>, Bengt Richter
 <bokr <at> bokr.com>
Cc: 44612 <at> debbugs.gnu.org
Subject: Re: bug#44612: Read standard input in `guix repl'
Date: Mon, 16 Nov 2020 12:36:02 +0100
[Message part 1 (text/plain, inline)]
Ludovic Courtès <ludo <at> gnu.org> writes:

> Hi,
>
> Bengt Richter <bokr <at> bokr.com> skribis:
>
>> On +2020-11-13 10:41:38 +0100, Pierre Neidhardt wrote:
>>> `guix repl` is a fantastic, hassle-free tool to bind Guix with
>>> third-party languages.  I've done it here:
>>> 
>>> https://github.com/atlas-engineer/nyxt/blob/2-pre-release-4/libraries/ospama/ospama-guix.lisp
>
> I recommend using ‘guix repl -t machine’

Looks like `-t machine` has the same issue.
This does what I want:

--8<---------------cut here---------------start------------->8---
$ echo "(display \"Hi.\\n\")" | guix repl -t machine /dev/stdin
Hi.
--8<---------------cut here---------------end--------------->8---

This does not:

--8<---------------cut here---------------start------------->8---
$ echo "(display \"Hi.\\n\")" | guix repl -t machine  
(repl-version 0 1 1)
Hi.
(values (non-self-quoting 2052 "#<unspecified>"))
--8<---------------cut here---------------end--------------->8---

> and keeping the REPL process around instead of respawning it for every
> expression.

At first glance, we would want to do this indeed.

But in the case of Nyxt, there would be no point when to terminate the
process, so it would be around for the whole time Nyxt is running, which
may not be desirable.

Alternatively, I could simply keep it alive for a given duration (1
minute?) and automatically spawn it if the process is dead.

Any recommendations?

-- 
Pierre Neidhardt
https://ambrevar.xyz/
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Mon, 16 Nov 2020 11:54:01 GMT) Full text and rfc822 format available.

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

From: Pierre Neidhardt <mail <at> ambrevar.xyz>
To: Ludovic Courtès <ludo <at> gnu.org>, Bengt Richter
 <bokr <at> bokr.com>
Cc: 44612 <at> debbugs.gnu.org
Subject: Re: bug#44612: Read standard input in `guix repl'
Date: Mon, 16 Nov 2020 12:53:47 +0100
[Message part 1 (text/plain, inline)]
If I understand correctly, "-t machine" is for when we want to retrieve
the results of all top-level evaluations.

If we only want specific results, then we are better off "passing" the
desired value to the caller by dumping them to the standard output.

For the latter, "-t machine" is not necessary I believe.

Is this correct?

-- 
Pierre Neidhardt
https://ambrevar.xyz/
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Mon, 16 Nov 2020 11:56:02 GMT) Full text and rfc822 format available.

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

From: zimoun <zimon.toutoune <at> gmail.com>
To: Tobias Geerinckx-Rice <me <at> tobias.gr>
Cc: Pierre Neidhardt <mail <at> ambrevar.xyz>, 44612 <at> debbugs.gnu.org
Subject: Re: bug#44612: Read standard input in `guix repl'
Date: Mon, 16 Nov 2020 12:38:21 +0100
Hi Tobias,

On Mon, 16 Nov 2020 at 11:45, Tobias Geerinckx-Rice <me <at> tobias.gr> wrote:

> What exactly downloads the world?

I have not inspected but I think that’s because a lot of substitutes
missing:

--8<---------------cut here---------------start------------->8---
$ pkgs=$(guix time-machine --branch=version-1.2.0 -- package -A ^sbcl- |cut -f1)
$ guix time-machine --branch=version-1.2.0 -- weather $pkgs
Updating channel 'guix' from Git repository at 'https://git.savannah.gnu.org/git/guix.git'...
computing 455 package derivations for x86_64-linux...
looking for 456 store items on https://ci.guix.gnu.org...
updating substitutes from 'https://ci.guix.gnu.org'... 100.0%
https://ci.guix.gnu.org
  71.3% substitutes available (325 out of 456)
  at least 214.4 MiB of nars (compressed)
  431.6 MiB on disk (uncompressed)
  0.008 seconds per request (3.5 seconds in total)
  130.2 requests per second

  0.0% (0 out of 131) of the missing items are queued
  at least 1,000 queued builds
      x86_64-linux: 490 (49.0%)
      i686-linux: 353 (35.3%)
      aarch64-linux: 133 (13.3%)
      armhf-linux: 24 (2.4%)
  build rate: 30.54 builds per hour
      aarch64-linux: 4.21 builds per hour
      i686-linux: 10.14 builds per hour
      x86_64-linux: 11.45 builds per hour
      armhf-linux: 4.73 builds per hour
--8<---------------cut here---------------end--------------->8---

Well, I have not pulled ’master’ since a couple of days but should be
the same, I guess.  Yes, it is with f6a42ac:

  72.4% substitutes available (336 out of 464)


All the best,
simon




Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Mon, 16 Nov 2020 12:53:02 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: Pierre Neidhardt <mail <at> ambrevar.xyz>
Cc: 44612 <at> debbugs.gnu.org, Bengt Richter <bokr <at> bokr.com>
Subject: Re: bug#44612: Read standard input in `guix repl'
Date: Mon, 16 Nov 2020 13:52:23 +0100
Hi,

Pierre Neidhardt <mail <at> ambrevar.xyz> skribis:

> Ludovic Courtès <ludo <at> gnu.org> writes:
>
>> Hi,
>>
>> Bengt Richter <bokr <at> bokr.com> skribis:
>>
>>> On +2020-11-13 10:41:38 +0100, Pierre Neidhardt wrote:
>>>> `guix repl` is a fantastic, hassle-free tool to bind Guix with
>>>> third-party languages.  I've done it here:
>>>> 
>>>> https://github.com/atlas-engineer/nyxt/blob/2-pre-release-4/libraries/ospama/ospama-guix.lisp
>>
>> I recommend using ‘guix repl -t machine’
>
> Looks like `-t machine` has the same issue.
> This does what I want:
>
> $ echo "(display \"Hi.\\n\")" | guix repl -t machine /dev/stdin
> Hi.
>
>
> This does not:
>
> $ echo "(display \"Hi.\\n\")" | guix repl -t machine  
> (repl-version 0 1 1)
> Hi.
> (values (non-self-quoting 2052 "#<unspecified>"))

The general idea is that the REPL protocol allows you to offload
computations to the ‘guix repl’ process and to read the result of those
computations.  Side effects such as writing to stdout are not treated,
but they’re mostly beyond the scope of ‘guix repl’.

>> and keeping the REPL process around instead of respawning it for every
>> expression.
>
> At first glance, we would want to do this indeed.
>
> But in the case of Nyxt, there would be no point when to terminate the
> process, so it would be around for the whole time Nyxt is running, which
> may not be desirable.

I think it’s desirable since it saves on CPU costs.

> Alternatively, I could simply keep it alive for a given duration (1
> minute?) and automatically spawn it if the process is dead.

Yes, that’s a reasonable tradeoff.

Thanks,
Ludo’.




Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Mon, 16 Nov 2020 16:12:01 GMT) Full text and rfc822 format available.

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

From: Pierre Neidhardt <mail <at> ambrevar.xyz>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 44612 <at> debbugs.gnu.org, Bengt Richter <bokr <at> bokr.com>
Subject: Re: bug#44612: Read standard input in `guix repl'
Date: Mon, 16 Nov 2020 17:11:43 +0100
[Message part 1 (text/plain, inline)]
Perfect, thanks for the feedback!

-- 
Pierre Neidhardt
https://ambrevar.xyz/
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Tue, 01 Dec 2020 07:53:01 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: Pierre Neidhardt <mail <at> ambrevar.xyz>
Cc: 44612 <at> debbugs.gnu.org
Subject: Re: bug#44612: Read standard input in `guix repl'
Date: Tue, 01 Dec 2020 08:52:34 +0100
Hi!

Pierre Neidhardt <mail <at> ambrevar.xyz> skribis:

> It'd be better if we could send Guile code to the standard input of the
> `guix repl -` process to bypass file generation.

I think the thread derailed a bit, but in the end, this is already
possible, in particular with ‘guix repl -t machine’ (designed for this
purpose).

I’m closing, but we can always open a new issue if the need arises.

Thanks,
Ludo’.




Added tag(s) notabug. Request was from Ludovic Courtès <ludo <at> gnu.org> to control <at> debbugs.gnu.org. (Tue, 01 Dec 2020 07:53:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 44612 <at> debbugs.gnu.org and Pierre Neidhardt <mail <at> ambrevar.xyz> Request was from Ludovic Courtès <ludo <at> gnu.org> to control <at> debbugs.gnu.org. (Tue, 01 Dec 2020 07:53:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Tue, 01 Dec 2020 08:30:02 GMT) Full text and rfc822 format available.

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

From: Pierre Neidhardt <mail <at> ambrevar.xyz>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 44612 <at> debbugs.gnu.org
Subject: Re: bug#44612: Read standard input in `guix repl'
Date: Tue, 01 Dec 2020 09:29:25 +0100
[Message part 1 (text/plain, inline)]
Indeed, it works perfectly now, I've implemented your suggestions and
Nyxt is now running a "guix repl server" to which it sends all the
requests.  It's awesome! :)

The only issue remaining is the weird behaviour that one has to pass
/dev/stdin to get rid of the welcome message:

echo '(display "Hi.\n")' | guix repl /dev/stdin

[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Thu, 03 Dec 2020 10:23:02 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: Pierre Neidhardt <mail <at> ambrevar.xyz>
Cc: 44612 <at> debbugs.gnu.org
Subject: Re: bug#44612: Read standard input in `guix repl'
Date: Thu, 03 Dec 2020 11:22:14 +0100
Hi Pierre!

Pierre Neidhardt <mail <at> ambrevar.xyz> skribis:

> Indeed, it works perfectly now, I've implemented your suggestions and
> Nyxt is now running a "guix repl server" to which it sends all the
> requests.  It's awesome! :)
>
> The only issue remaining is the weird behaviour that one has to pass
> /dev/stdin to get rid of the welcome message:
>
> echo '(display "Hi.\n")' | guix repl /dev/stdin

As discussed earlier, I think you should use ‘-t machine’, which doesn’t
have the welcome message.  ‘-t guile’ (the default) is meant for humans,
not for inter-process communication.

Ludo’.




Information forwarded to bug-guix <at> gnu.org:
bug#44612; Package guix. (Thu, 03 Dec 2020 10:34:02 GMT) Full text and rfc822 format available.

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

From: Pierre Neidhardt <mail <at> ambrevar.xyz>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 44612 <at> debbugs.gnu.org
Subject: Re: bug#44612: Read standard input in `guix repl'
Date: Thu, 03 Dec 2020 11:33:00 +0100
[Message part 1 (text/plain, inline)]
Hi Ludo!

Ludovic Courtès <ludo <at> gnu.org> writes:

> As discussed earlier, I think you should use ‘-t machine’, which doesn’t
> have the welcome message.  ‘-t guile’ (the default) is meant for humans,
> not for inter-process communication.

Oh, for sure, I'm using `t machine` now.

All I meant is that the aforementioned behaviour highlights a
probable (harmless) bug, so if someone has got the time, they should
look at what `guix repl` is doing with stdin, something is fishy.

Cheers!

-- 
Pierre Neidhardt
https://ambrevar.xyz/
[signature.asc (application/pgp-signature, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 31 Dec 2020 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 173 days ago.

Previous Next


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