~ruther/guix-local

04b6d6f7f7a73e39dcff1e2bca3113ea567e2944 — Ludovic Courtès 8 years ago 12235a1
gnu: guile-ssh: Update to 0.11.2.

* gnu/packages/ssh.scm (guile-ssh): Update to 0.11.2.
[source]: Remove 'patches', 'modules', and 'snippet'.
* gnu/packages/patches/guile-ssh-channel-finalization.patch,
gnu/packages/patches/guile-ssh-double-free.patch,
gnu/packages/patches/guile-ssh-rexec-bug.patch: Remove.
* gnu/local.mk (dist_patch_DATA): Remove them.
5 files changed, 2 insertions(+), 98 deletions(-)

M gnu/local.mk
D gnu/packages/patches/guile-ssh-channel-finalization.patch
D gnu/packages/patches/guile-ssh-double-free.patch
D gnu/packages/patches/guile-ssh-rexec-bug.patch
M gnu/packages/ssh.scm
M gnu/local.mk => gnu/local.mk +0 -3
@@ 675,9 675,6 @@ 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-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			\

D gnu/packages/patches/guile-ssh-channel-finalization.patch => gnu/packages/patches/guile-ssh-channel-finalization.patch +0 -28
@@ 1,28 0,0 @@
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

D gnu/packages/patches/guile-ssh-double-free.patch => gnu/packages/patches/guile-ssh-double-free.patch +0 -37
@@ 1,37 0,0 @@
Fix a double-free or use-after-free issue with Guile-SSH used
with Guile 2.2.  See <https://bugs.gnu.org/26976>.

diff --git a/libguile-ssh/channel-type.c b/libguile-ssh/channel-type.c
index 3dd641f..0839854 100644
--- a/libguile-ssh/channel-type.c
+++ b/libguile-ssh/channel-type.c
@@ -229,10 +229,11 @@ ptob_close (SCM channel)
       ssh_channel_free (ch->ssh_channel);
     }
 
+  SCM_SETSTREAM (channel, NULL);
+
 #if USING_GUILE_BEFORE_2_2
   scm_gc_free (pt->write_buf, pt->write_buf_size, "port write buffer");
   scm_gc_free (pt->read_buf,  pt->read_buf_size, "port read buffer");
-  SCM_SETSTREAM (channel, NULL);
 
   return 0;
 #endif
diff --git a/libguile-ssh/sftp-file-type.c b/libguile-ssh/sftp-file-type.c
index 8879924..f87cf03 100644
--- a/libguile-ssh/sftp-file-type.c
+++ b/libguile-ssh/sftp-file-type.c
@@ -224,10 +224,11 @@ ptob_close (SCM sftp_file)
       sftp_close (fd->file);
     }
 
+  SCM_SETSTREAM (sftp_file, NULL);
+
 #if USING_GUILE_BEFORE_2_2
   scm_gc_free (pt->write_buf, pt->write_buf_size, "port write buffer");
   scm_gc_free (pt->read_buf,  pt->read_buf_size, "port read buffer");
-  SCM_SETSTREAM (sftp_file, NULL);
 
   return 1;
 #endif

D gnu/packages/patches/guile-ssh-rexec-bug.patch => gnu/packages/patches/guile-ssh-rexec-bug.patch +0 -16
@@ 1,16 0,0 @@
Fix a bug whereby 'node-guile-version' would pass a node instead of
a session to 'rexec'.

diff --git a/modules/ssh/dist/node.scm b/modules/ssh/dist/node.scm
index 9c065c7..29a3906 100644
--- a/modules/ssh/dist/node.scm
+++ b/modules/ssh/dist/node.scm
@@ -411,7 +411,8 @@ procedure returns the 1st evaluated value if multiple values were returned."
   "Get Guile version installed on a NODE, return the version string.  Return
 #f if Guile is not installed."
   (receive (result rc)
-      (rexec node "which guile > /dev/null && guile --version")
+      (rexec (node-session node)
+             "which guile > /dev/null && guile --version")
     (and (zero? rc)
          (car result))))

M gnu/packages/ssh.scm => gnu/packages/ssh.scm +2 -14
@@ 215,7 215,7 @@ Additionally, various channel-specific options can be negotiated.")
(define-public guile-ssh
  (package
    (name "guile-ssh")
    (version "0.11.0")
    (version "0.11.2")
    (home-page "https://github.com/artyom-poptsov/guile-ssh")
    (source (origin
              ;; ftp://memory-heap.org/software/guile-ssh/guile-ssh-VERSION.tar.gz


@@ 227,19 227,7 @@ Additionally, various channel-specific options can be negotiated.")
              (file-name (string-append name "-" version ".tar.gz"))
              (sha256
               (base32
                "0r261i8kc3avbmbwgyzak2vnqwssjlgz37g2y2fwm80w9bmn2m7j"))
              (patches (search-patches "guile-ssh-rexec-bug.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/
               ;; that are not instantiated yet.  Work around it.
               '(substitute* "configure.ac"
                  (("AC_CONFIG_LINKS\\(\\[examples/([^:]+):.*" _ file)
                   (string-append "AC_CONFIG_FILES([examples/" file
                                  "], [chmod +x examples/"
                                  file "])\n"))))))
                "1w0k5s09xj5xycb7lbp5b7rm0xncclms3jwl98lwj8fxwngi1s90"))))
    (build-system gnu-build-system)
    (outputs '("out" "debug"))
    (arguments