Subject: Potential REPL Server Bug (with a Patch)

From: isaac lewis <[email-masked]>
Date: Mon, 2 Jul 2018 12:21:02 -0400

Good afternoon,

I experienced some issues on both Debian and Fedora a while ago with
the REPL server module.  After searching the bug database, I didn't
find any similar reports, so I decided to investigate the issues a bit
more and found that they appear to be caused by a non-idiomatic use of
dynamic-wind (that was likely the result of a typo).  A patch is
given below.

Sincerely,

Isaac Lewis

>From 6dedc1a6d64ecbf6f1c9a4e60a6ea4a46c5b55ff Mon Sep 17 00:00:00 2001
From: Isaac Lewis <[email-masked]>
Date: Mon, 2 Jul 2018 11:37:27 -0400
Subject: [PATCH] Fix a bug in the REPL server.

---
 module/system/repl/server.scm | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/module/system/repl/server.scm b/module/system/repl/server.scm
index 725eb4e..f18441d 100644
--- a/module/system/repl/server.scm
+++ b/module/system/repl/server.scm
@@ -146,14 +146,15 @@

   (dynamic-wind
     (lambda () #f)
-    (with-continuation-barrier
-     (lambda ()
-       (parameterize ((current-input-port client)
-                      (current-output-port client)
-                      (current-error-port client)
-                      (current-warning-port client))
-         (with-fluids ((*repl-stack* '()))
-           (start-repl)))))
+    (lambda ()
+      (with-continuation-barrier
+       (lambda ()
+         (parameterize ((current-input-port client)
+                        (current-output-port client)
+                        (current-error-port client)
+                        (current-warning-port client))
+                       (with-fluids ((*repl-stack* '()))
+                                    (start-repl))))))
     (lambda () (close-socket! client))))

-- 
2.9.5