unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* (Geiser or guile bug) Guix-daemon output is missing
@ 2015-09-06  9:03 Alex Kost
  2015-09-06 21:28 ` Ludovic Courtès
  0 siblings, 1 reply; 7+ messages in thread
From: Alex Kost @ 2015-09-06  9:03 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1668 bytes --]

Hello.

There is a strange problem with evaluating a code using Geiser, which
leads to some missing output in a REPL.  I have an example demonstrating
the problem using some Guix code, but I would like to have a pure guile
recipe, so that it can be reported.

So how to reproduce the bug.  At first, make a file "test-bug.scm"
(attached) and put it somewhere to GUIX_PACKAGE_PATH.  Run "guix build
test-package" in shell to make sure that the package is found.  The
building will fail, but it's fine for this demonstration.  Note that
there is a usual output from guix-daemon ("@ build-started …").

Now the bug itself:

1. Start Geiser (M-x run-guile)

2. Make a scheme buffer and evaluate (use-modules (guix scripts build))
   there using "C-x C-e" or "C-M-x" (or any other "geiser-eval-…"
   command).  This is important: do not ,use module in the REPL;
   evaluate ‘use-modules’ clause in a scheme buffer!

3. Go to the REPL and run the following there:

   (catch 'quit (lambda () (guix-build "test-package")) (const #t)).

You get only "The following derivation will be built: …" but there is no
build output from guix-daemon.

Now if you close the REPL and repeat this recipe but on the 2nd step you
evaluate (use-modules (guix scripts build)) or ,use(guix scripts build)
in the REPL itself, you will see the build output as expected.

So there is something special with this guix-daemon output and with
Geiser synchronous evaluating (using ‘geiser-eval--send/wait’) that
sends this output to a better world.

I appreciate any ideas on solving this bug or making a guix-independent
recipe to reproduce it.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: test-bug.scm --]
[-- Type: text/x-scheme, Size: 305 bytes --]

(define-module (test-bug)
  #:use-module (guix packages)
  #:use-module (guix build-system trivial)
  #:use-module (gnu packages base))

(define-public test-package
  (package (inherit hello)
    (name "test-package")
    (build-system trivial-build-system)
    (arguments
     '(#:builder (const #t)))))

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: (Geiser or guile bug) Guix-daemon output is missing
  2015-09-06  9:03 (Geiser or guile bug) Guix-daemon output is missing Alex Kost
@ 2015-09-06 21:28 ` Ludovic Courtès
  2015-09-07 19:58   ` Alex Kost
  2015-09-09 16:47   ` Alex Kost
  0 siblings, 2 replies; 7+ messages in thread
From: Ludovic Courtès @ 2015-09-06 21:28 UTC (permalink / raw)
  To: Alex Kost; +Cc: guix-devel

Alex Kost <alezost@gmail.com> skribis:

> Now the bug itself:
>
> 1. Start Geiser (M-x run-guile)
>
> 2. Make a scheme buffer and evaluate (use-modules (guix scripts build))
>    there using "C-x C-e" or "C-M-x" (or any other "geiser-eval-…"
>    command).  This is important: do not ,use module in the REPL;
>    evaluate ‘use-modules’ clause in a scheme buffer!
>
> 3. Go to the REPL and run the following there:
>
>    (catch 'quit (lambda () (guix-build "test-package")) (const #t)).
>
> You get only "The following derivation will be built: …" but there is no
> build output from guix-daemon.

Ha ha!  Try this before:

  (current-build-output-port (current-error-port))

The trick here is that ‘current-build-output-port’ is initialized to
(current-error-port), but that initialization happens at the top-level,
apparently before Geiser has rebound ‘current-error-port’, hence the
silence.

HTH!

Ludo’.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: (Geiser or guile bug) Guix-daemon output is missing
  2015-09-06 21:28 ` Ludovic Courtès
@ 2015-09-07 19:58   ` Alex Kost
  2015-09-09 16:47   ` Alex Kost
  1 sibling, 0 replies; 7+ messages in thread
From: Alex Kost @ 2015-09-07 19:58 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Ludovic Courtès (2015-09-07 00:28 +0300) wrote:

> Alex Kost <alezost@gmail.com> skribis:
>
>> Now the bug itself:
>>
>> 1. Start Geiser (M-x run-guile)
>>
>> 2. Make a scheme buffer and evaluate (use-modules (guix scripts build))
>>    there using "C-x C-e" or "C-M-x" (or any other "geiser-eval-…"
>>    command).  This is important: do not ,use module in the REPL;
>>    evaluate ‘use-modules’ clause in a scheme buffer!
>>
>> 3. Go to the REPL and run the following there:
>>
>>    (catch 'quit (lambda () (guix-build "test-package")) (const #t)).
>>
>> You get only "The following derivation will be built: …" but there is no
>> build output from guix-daemon.
>
> Ha ha!  Try this before:
>
>   (current-build-output-port (current-error-port))
>
> The trick here is that ‘current-build-output-port’ is initialized to
> (current-error-port), but that initialization happens at the top-level,
> apparently before Geiser has rebound ‘current-error-port’, hence the
> silence.
>
> HTH!

Thanks for answering!  This helped to make a simple recipe, so I
reported it: <https://github.com/jaor/geiser/issues/83>.

-- 
Alex

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: (Geiser or guile bug) Guix-daemon output is missing
  2015-09-06 21:28 ` Ludovic Courtès
  2015-09-07 19:58   ` Alex Kost
@ 2015-09-09 16:47   ` Alex Kost
  2015-09-09 20:11     ` Ludovic Courtès
  1 sibling, 1 reply; 7+ messages in thread
From: Alex Kost @ 2015-09-09 16:47 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Ludovic Courtès (2015-09-07 00:28 +0300) wrote:

> Alex Kost <alezost@gmail.com> skribis:
>
>> Now the bug itself:
>>
>> 1. Start Geiser (M-x run-guile)
>>
>> 2. Make a scheme buffer and evaluate (use-modules (guix scripts build))
>>    there using "C-x C-e" or "C-M-x" (or any other "geiser-eval-…"
>>    command).  This is important: do not ,use module in the REPL;
>>    evaluate ‘use-modules’ clause in a scheme buffer!
>>
>> 3. Go to the REPL and run the following there:
>>
>>    (catch 'quit (lambda () (guix-build "test-package")) (const #t)).
>>
>> You get only "The following derivation will be built: …" but there is no
>> build output from guix-daemon.
>
> Ha ha!  Try this before:
>
>   (current-build-output-port (current-error-port))
>
> The trick here is that ‘current-build-output-port’ is initialized to
> (current-error-port), but that initialization happens at the top-level,
> apparently before Geiser has rebound ‘current-error-port’, hence the
> silence.

As a workaround for this issue it was proposed¹ to transform
‘current-build-output-port’ into a procedure (I have checked that it
solves the problem).  What do you think about it?  Perhaps to make sure
that the port will be always the same define it like this:

(define current-build-output-port (memoize current-error-port))

Is it acceptable?

[1] https://github.com/jaor/geiser/issues/83#issuecomment-1386298474

-- 
Alex

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: (Geiser or guile bug) Guix-daemon output is missing
  2015-09-09 16:47   ` Alex Kost
@ 2015-09-09 20:11     ` Ludovic Courtès
  2015-09-09 21:24       ` Alex Kost
  0 siblings, 1 reply; 7+ messages in thread
From: Ludovic Courtès @ 2015-09-09 20:11 UTC (permalink / raw)
  To: Alex Kost; +Cc: guix-devel

Alex Kost <alezost@gmail.com> skribis:

> As a workaround for this issue it was proposed¹ to transform
> ‘current-build-output-port’ into a procedure (I have checked that it
> solves the problem).  What do you think about it?  Perhaps to make sure
> that the port will be always the same define it like this:
>
> (define current-build-output-port (memoize current-error-port))
>
> Is it acceptable?

No, ‘current-build-output-port’ should remain a SRFI-39 parameter so
that callers can easily rebind it.

However, perhaps the guix.el code could do:

  (current-build-output-port (current-error-port))

at startup; would that be doable?

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: (Geiser or guile bug) Guix-daemon output is missing
  2015-09-09 20:11     ` Ludovic Courtès
@ 2015-09-09 21:24       ` Alex Kost
  2015-09-10 16:44         ` Alex Kost
  0 siblings, 1 reply; 7+ messages in thread
From: Alex Kost @ 2015-09-09 21:24 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Ludovic Courtès (2015-09-09 23:11 +0300) wrote:

> Alex Kost <alezost@gmail.com> skribis:
>
>> As a workaround for this issue it was proposed¹ to transform
>> ‘current-build-output-port’ into a procedure (I have checked that it
>> solves the problem).  What do you think about it?  Perhaps to make sure
>> that the port will be always the same define it like this:
>>
>> (define current-build-output-port (memoize current-error-port))
>>
>> Is it acceptable?
>
> No, ‘current-build-output-port’ should remain a SRFI-39 parameter so
> that callers can easily rebind it.
>
> However, perhaps the guix.el code could do:
>
>   (current-build-output-port (current-error-port))
>
> at startup; would that be doable?

(IMO it would be so ugly, that I should say: "no")

Do you mean at startup of Guix REPL?  If you remember the point is to
add an emacs command to build the package in the current Geiser REPL
(not Guix REPL).  So to prevent this disappearing of the build output,
(current-build-output-port (current-error-port)) should be evaluated in
the *Geiser REPL*.  We can make a workaround just for ‘build-package’
procedure by putting this port assigning in it, but the only way to make
a global solution is to get rid of the top-level setting of
‘current-build-output-port’, for example by:

(define current-build-output-port (make-parameter #f))

and bind it to current-error-port in ‘process-stderr’, but I suppose
this is also undesired, right?

-- 
Alex

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: (Geiser or guile bug) Guix-daemon output is missing
  2015-09-09 21:24       ` Alex Kost
@ 2015-09-10 16:44         ` Alex Kost
  0 siblings, 0 replies; 7+ messages in thread
From: Alex Kost @ 2015-09-10 16:44 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Alex Kost (2015-09-10 00:24 +0300) wrote:

> Ludovic Courtès (2015-09-09 23:11 +0300) wrote:
>
>> Alex Kost <alezost@gmail.com> skribis:
>>
>>> As a workaround for this issue it was proposed¹ to transform
>>> ‘current-build-output-port’ into a procedure (I have checked that it
>>> solves the problem).  What do you think about it?  Perhaps to make sure
>>> that the port will be always the same define it like this:
>>>
>>> (define current-build-output-port (memoize current-error-port))
>>>
>>> Is it acceptable?
>>
>> No, ‘current-build-output-port’ should remain a SRFI-39 parameter so
>> that callers can easily rebind it.
>>
>> However, perhaps the guix.el code could do:
>>
>>   (current-build-output-port (current-error-port))
>>
>> at startup; would that be doable?
>
> (IMO it would be so ugly, that I should say: "no")

After thinking more, I had an idea how to make a not-so-ugly workaround,
so "yes", I think I'll do a workaround on elisp side.

-- 
Alex

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-09-10 16:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-06  9:03 (Geiser or guile bug) Guix-daemon output is missing Alex Kost
2015-09-06 21:28 ` Ludovic Courtès
2015-09-07 19:58   ` Alex Kost
2015-09-09 16:47   ` Alex Kost
2015-09-09 20:11     ` Ludovic Courtès
2015-09-09 21:24       ` Alex Kost
2015-09-10 16:44         ` Alex Kost

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).