remote: Make sure the user doesn't mess up with the REPL protocol.

Reported by zerodaysfordays@sdf.lonestar.org (Jakob L. Kreuze).

* guix/remote.scm (trampoline): Wrap 'primitive-load' in
'with-output-to-port'.
This commit is contained in:
Ludovic Courtès 2019-07-15 17:58:01 +02:00
parent 5db07b971d
commit 6f8eb9f1d8
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 7 additions and 1 deletions

View File

@ -76,8 +76,14 @@ result to the current output port using the (guix repl) protocol."
(with-imported-modules (source-module-closure '((guix repl))) (with-imported-modules (source-module-closure '((guix repl)))
#~(begin #~(begin
(use-modules (guix repl)) (use-modules (guix repl))
(send-repl-response '(primitive-load #$program)
;; We use CURRENT-OUTPUT-PORT for REPL messages, so redirect PROGRAM's
;; output to CURRENT-ERROR-PORT so that it does not interfere.
(send-repl-response '(with-output-to-port (current-error-port)
(lambda ()
(primitive-load #$program)))
(current-output-port)) (current-output-port))
(force-output)))) (force-output))))
(define* (remote-eval exp session (define* (remote-eval exp session