guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

03/03: gnu: guile-ssh: Close RREPL channel ports before they are finaliz


From: Ludovic Courtès
Subject: 03/03: gnu: guile-ssh: Close RREPL channel ports before they are finalized.
Date: Tue, 13 Jun 2017 17:22:42 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit 8e469b67f95cfe5b95405b503b8ee315fdf8ce66
Author: Ludovic Courtès <address@hidden>
Date:   Tue Jun 13 23:20:25 2017 +0200

    gnu: guile-ssh: Close RREPL channel ports before they are finalized.
    
    Partly fixes <https://bugs.gnu.org/26976>.
    
    * gnu/packages/patches/guile-ssh-channel-finalization.patch: New file.
    * gnu/packages/ssh.scm (guile-ssh)[source](patches): Use it.
    * gnu/local.mk (dist_patch_DATA): Add it.
---
 gnu/local.mk                                       |  3 ++-
 .../patches/guile-ssh-channel-finalization.patch   | 28 ++++++++++++++++++++++
 gnu/packages/ssh.scm                               |  3 ++-
 3 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/gnu/local.mk b/gnu/local.mk
index f761ad2..608ded7 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -656,8 +656,9 @@ dist_patch_DATA =                                           
\
   %D%/packages/patches/guile-present-coding.patch              \
   %D%/packages/patches/guile-relocatable.patch                 \
   %D%/packages/patches/guile-rsvg-pkgconfig.patch              \
-  %D%/packages/patches/guile-ssh-rexec-bug.patch               \
+  gnu/packages/patches/guile-ssh-channel-finalization.patch    \
   %D%/packages/patches/guile-ssh-double-free.patch             \
+  %D%/packages/patches/guile-ssh-rexec-bug.patch               \
   %D%/packages/patches/gtk2-respect-GUIX_GTK2_PATH.patch       \
   %D%/packages/patches/gtk2-respect-GUIX_GTK2_IM_MODULE_FILE.patch \
   %D%/packages/patches/gtk2-theme-paths.patch                  \
diff --git a/gnu/packages/patches/guile-ssh-channel-finalization.patch 
b/gnu/packages/patches/guile-ssh-channel-finalization.patch
new file mode 100644
index 0000000..54b5055
--- /dev/null
+++ b/gnu/packages/patches/guile-ssh-channel-finalization.patch
@@ -0,0 +1,28 @@
+Avoid asynchronous channel finalization, which could lead to segfaults due to
+libssh not being thread-safe: <https://bugs.gnu.org/26976>.
+
+--- guile-ssh-0.11.0/modules/ssh/dist/node.scm 2017-06-13 14:37:44.861671297 
+0200
++++ guile-ssh-0.11.0/modules/ssh/dist/node.scm 2017-06-13 14:38:02.841580565 
+0200
+@@ -391,11 +391,18 @@ listens on an expected port, return #f o
+   "Evaluate QUOTED-EXP on the node and return the evaluated result."
+   (let ((repl-channel (node-open-rrepl node)))
+     (rrepl-skip-to-prompt repl-channel)
+-    (call-with-values (lambda () (rrepl-eval repl-channel quoted-exp))
+-      (lambda vals
+-        (and (node-stop-repl-server? node)
++    (dynamic-wind
++      (const #t)
++      (lambda ()
++        (rrepl-eval repl-channel quoted-exp))
++      (lambda ()
++        (when (node-stop-repl-server? node)
+              (node-stop-server node))
+-        (apply values vals)))))
++
++        ;; Close REPL-CHANNEL right away to prevent finalization from
++        ;; happening in another thread at the wrong time (see
++        ;; <https://bugs.gnu.org/26976>.)
++        (close-port repl-channel)))))
+ 
+ (define (node-eval-1 node quoted-exp)
+   "Evaluate QUOTED-EXP on the node and return the evaluated result.  The
diff --git a/gnu/packages/ssh.scm b/gnu/packages/ssh.scm
index d79663a..d03686c 100644
--- a/gnu/packages/ssh.scm
+++ b/gnu/packages/ssh.scm
@@ -229,7 +229,8 @@ Additionally, various channel-specific options can be 
negotiated.")
                (base32
                 "0r261i8kc3avbmbwgyzak2vnqwssjlgz37g2y2fwm80w9bmn2m7j"))
               (patches (search-patches "guile-ssh-rexec-bug.patch"
-                                       "guile-ssh-double-free.patch"))
+                                       "guile-ssh-double-free.patch"
+                                       "guile-ssh-channel-finalization.patch"))
               (modules '((guix build utils)))
               (snippet
                ;; 'configure.ac' mistakenly tries to link files from examples/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]