From 6f8eb9f1d8bc8660349658602698db36965bba5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Mon, 15 Jul 2019 17:58:01 +0200 Subject: [PATCH] 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'. --- guix/remote.scm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/guix/remote.scm b/guix/remote.scm index 0959025963..5fecd954e9 100644 --- a/guix/remote.scm +++ b/guix/remote.scm @@ -76,8 +76,14 @@ result to the current output port using the (guix repl) protocol." (with-imported-modules (source-module-closure '((guix repl))) #~(begin (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)) + (force-output)))) (define* (remote-eval exp session