Hello community, here is the log from the commit of package guile-ssh for openSUSE:Factory checked in at 2020-11-26 23:14:59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/guile-ssh (Old) and /work/SRC/openSUSE:Factory/.guile-ssh.new.5913 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "guile-ssh" Thu Nov 26 23:14:59 2020 rev:5 rq:850995 version:0.13.1 Changes: -------- --- /work/SRC/openSUSE:Factory/guile-ssh/guile-ssh.changes 2020-01-14 21:13:54.334946152 +0100 +++ /work/SRC/openSUSE:Factory/.guile-ssh.new.5913/guile-ssh.changes 2020-11-26 23:16:00.357066110 +0100 @@ -1,0 +2,15 @@ +Fri Nov 6 17:51:15 UTC 2020 - Jonathan Brielmaier <jbrielma...@opensuse.org> + +- Update to 0.13.1: + * API change: 'call-with-ssh-forward' does not start a thread + * API change: add 'nodelay' option for Guile-SSH sessions + * Fix some random segfaults in the channel and session code + * Add support for macOS + * Disable libguile-ssh static library + * Don't use deprecated libssh procedures + * Fix segfaults on GC'ing + * Channels procedures now check if the parent session is alive + * Changes in documentation +- Update library to 13 + +------------------------------------------------------------------- Old: ---- v0.12.0.tar.gz New: ---- v0.13.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ guile-ssh.spec ++++++ --- /var/tmp/diff_new_pack.gujbNZ/_old 2020-11-26 23:16:01.101066688 +0100 +++ /var/tmp/diff_new_pack.gujbNZ/_new 2020-11-26 23:16:01.101066688 +0100 @@ -16,10 +16,10 @@ # -%define libsoname lib%{name}12 +%define libsoname lib%{name}13 Name: guile-ssh -Version: 0.12.0 +Version: 0.13.1 Release: 0 Summary: SSH protocol access from Guile License: GPL-3.0-or-later ++++++ v0.12.0.tar.gz -> v0.13.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guile-ssh-0.12.0/.github/workflows/guile2.2.yml new/guile-ssh-0.13.1/.github/workflows/guile2.2.yml --- old/guile-ssh-0.12.0/.github/workflows/guile2.2.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/guile-ssh-0.13.1/.github/workflows/guile2.2.yml 2020-08-19 07:29:40.000000000 +0200 @@ -0,0 +1,35 @@ +name: GNU Guile 2.2 + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - name: Install dependencies + run: | + sudo apt update + sudo apt install guile-2.2 guile-2.2-libs guile-library + sudo apt install guile-2.2-dev texinfo texlive + sudo apt install automake autoconf + sudo apt install libssh-dev + sudo apt install libtool + sudo apt install gcc-9 + - name: Checkout repository + uses: actions/checkout@v2 + - name: Autoreconf + run: autoreconf -vif + - name: Configure + run: ./configure + - name: Make + run: make + - name: Run tests + run: make check + - name: Make distribution + run: make distcheck diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guile-ssh-0.12.0/.github/workflows/guile3.0.yml new/guile-ssh-0.13.1/.github/workflows/guile3.0.yml --- old/guile-ssh-0.12.0/.github/workflows/guile3.0.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/guile-ssh-0.13.1/.github/workflows/guile3.0.yml 2020-08-19 07:29:40.000000000 +0200 @@ -0,0 +1,26 @@ +name: GNU Guile 3.0 + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + name: Required Packages + strategy: + matrix: + distro: + - 'ubuntu:20.04' + include: + - distro: 'ubuntu:20.04' + pre: 'apt -qy install guile-3.0 guile-3.0-libs guile-3.0-dev guile-library texinfo libssh-dev libtool texlive gettext make automake autoconf gcc' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: Test building on ${{ matrix.distro }} + env: + PRE: ${{ matrix.pre }} + run: | + docker run --rm -e PRE -e DEBIAN_FRONTEND=noninteractive -v $PWD:/guile-ssh -w /guile-ssh ${{ matrix.distro }} /bin/sh -c '[ -n "${PRE}" ] && apt update && ${PRE} && autoreconf -vif && ./configure && make check' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guile-ssh-0.12.0/.gitignore new/guile-ssh-0.13.1/.gitignore --- old/guile-ssh-0.12.0/.gitignore 2020-01-05 17:19:18.000000000 +0100 +++ new/guile-ssh-0.13.1/.gitignore 2020-08-19 07:29:40.000000000 +0200 @@ -31,3 +31,6 @@ GRTAGS GTAGS /doc/version.texi + +# Ignore distributions +guile-ssh-* diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guile-ssh-0.12.0/AUTHORS new/guile-ssh-0.13.1/AUTHORS --- old/guile-ssh-0.12.0/AUTHORS 2020-01-05 17:19:18.000000000 +0100 +++ new/guile-ssh-0.13.1/AUTHORS 2020-08-19 07:29:40.000000000 +0200 @@ -68,3 +68,20 @@ <https://aur.archlinux.org/packages/guile-ssh/> * Lars-Dominik Braun <l...@leibniz-psychology.org> GSSAPI support. +* Aleix Conchillo Flaqué <aconchi...@gmail.com> + Fixed Guile-SSH building on macOS. Also packaged the library for Homebrew + package manager. + + In the root directory, changes to: + configure.ac + + In subdirectory 'modules/ssh/', changes to: + Makefile.am + + In subdirectory 'modules/ssh/dist/', changes to: + Makefile.am + + In subdirectory 'tests', changes to: + Makefile.am + common.scm + sssh-ssshd.scm diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guile-ssh-0.12.0/NEWS new/guile-ssh-0.13.1/NEWS --- old/guile-ssh-0.12.0/NEWS 2020-01-05 17:19:18.000000000 +0100 +++ new/guile-ssh-0.13.1/NEWS 2020-08-19 07:29:40.000000000 +0200 @@ -7,7 +7,46 @@ are permitted in any medium without royalty provided the copyright notice and this notice are preserved. -* Changes in version 0.12.0 +* Changes in version 0.13.1 (2020-08-19) +** Fix segfaults on GC'ing + The library would always fail with segmentation fault when the GC tried to + free Guile-SSH session when Guile-SSH channels related to this sessions + were in use. + + Now live channels prevent the keep Guile-SSH session from freeing. +** Channels procedures now check if the parent session is alive + Channels procedures now check if the parent session is alive and + connected. If this is not the case, an guile-ssh-error is issued. + +* Changes in version 0.13.0 (2020-07-18) +** API change: 'call-with-ssh-forward' does not start a thread + The procedure does not start a thread because multi-threading with libssh + sometimes leads to random segfaults. + + Now 'call-with-ssh-forward' calls the provided procedure with a channel as + an argument instead. + + If you wish to have a socket that forwards all the data to the remote side + through an SSH channel, you should implement a separate process that + forwards the data. There is an example in the directory 'examples/rpc' that + shows how to implement such a forwarding. +** API change: add 'nodelay' option for Guile-SSH sessions + Thanks to Lars-Dominik Braun. +** Fix some random segfaults in the channel and session code +** Add support for macOS + Now Guile-SSH can be installed on macOS through a Homebrew Tap: + https://github.com/aconchillo/homebrew-guile + + Thanks to Aleix Conchillo Flaqué! +** Disable libguile-ssh static library + This change is a part of poring Guile-SSH to macOS. +** Don't use deprecated libssh procedures + Add additional checks that replace deprecated procedures with the new ones + when newer libssh library is present. +** Changes in documentation + Fix Texinfo warnings. + +* Changes in version 0.12.0 (2020-01-05) ** API change: Implement new version of the RREPL API As proposed by Ludovic Courtès, this Guile-SSH version includes an implementation of a new stateless RREPL. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guile-ssh-0.12.0/README new/guile-ssh-0.13.1/README --- old/guile-ssh-0.12.0/README 2020-01-05 17:19:18.000000000 +0100 +++ new/guile-ssh-0.13.1/README 2020-08-19 07:29:40.000000000 +0200 @@ -5,6 +5,9 @@ Guile-SSH is a library that provides access to the [[https://en.wikipedia.org/wiki/Secure_Shell][SSH protocol]] for programs written in [[https://www.gnu.org/software/guile/][GNU Guile]] interpreter. It is built upon the [[https://www.libssh.org/][libssh]] library. + +[[https://github.com/artyom-poptsov/guile-ssh/][https://github.com/artyom-poptsov/guile-ssh/workflows/GNU%20Guile%202.2/badge.svg]] [[https://github.com/artyom-poptsov/guile-ssh/][https://github.com/artyom-poptsov/guile-ssh/workflows/GNU%20Guile%203.0/badge.svg]] + * Features - The API that is sufficient for building of standalone SSH clients and servers, or for embedding client/server functionality in your lispy Scheme @@ -40,8 +43,8 @@ - [[https://www.gnu.org/software/guile/][GNU Guile]], version 2.0.12 or later (known to work with 2.0.12, 2.0.14, 2.2.4) - - [[http://www.libssh.org/][libssh]], version 0.6.4 or later (0.7.3 or later is recommended due to - [[https://www.libssh.org/2016/02/23/libssh-0-7-3-security-and-bugfix-release/][CVE-2016-0739 found in previous versions]].) + - [[http://www.libssh.org/][libssh]], version 0.7.3 or later (older versions have [[https://www.libssh.org/2016/02/23/libssh-0-7-3-security-and-bugfix-release/][CVE-2016-0739]] -- don't + use them, really.) * Distribution @@ -120,6 +123,8 @@ https://www.parabola.nu/packages/?q=guile-ssh - Using openSUSE GNU/Linux package: https://software.opensuse.org/package/guile-ssh + - Using a Homebrew Tap on macOS (thanks to Aleix Conchillo Flaqué): + https://github.com/aconchillo/homebrew-guile - Manually. If you're considering manual installation, see the notes below. Thanks for all the people who helped with packaging of Guile-SSH! diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guile-ssh-0.12.0/THANKS new/guile-ssh-0.13.1/THANKS --- old/guile-ssh-0.12.0/THANKS 2020-01-05 17:19:18.000000000 +0100 +++ new/guile-ssh-0.13.1/THANKS 2020-08-19 07:29:40.000000000 +0200 @@ -8,6 +8,7 @@ Thanks to the following people who contributed to Guile-SSH through bug reports or patches: +* Aleix Conchillo Flaqué <aconchi...@gmail.com> * David Kastrup <d...@gnu.org> * David Thompson <da...@gnu.org> * Ludovic Courtès <l...@gnu.org> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guile-ssh-0.12.0/configure.ac new/guile-ssh-0.13.1/configure.ac --- old/guile-ssh-0.12.0/configure.ac 2020-01-05 17:19:18.000000000 +0100 +++ new/guile-ssh-0.13.1/configure.ac 2020-08-19 07:29:40.000000000 +0200 @@ -21,7 +21,7 @@ along with Guile-SSH. If not, see <http://www.gnu.org/licenses/>. ]]) -AC_INIT([Guile-SSH], [0.12.0], [poptsov.art...@gmail.com], +AC_INIT([Guile-SSH], [0.13.1], [poptsov.art...@gmail.com], [guile-ssh], [https://github.com/artyom-poptsov/guile-ssh]) @@ -35,6 +35,7 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])], [AC_SUBST([AM_DEFAULT_VERBOSITY],1)]) AC_PROG_CC +LT_INIT([disable-static]) if test "x$GCC" = "xyes"; then # Use compiler warnings. @@ -64,13 +65,22 @@ Using a potentially vulnerable version of libssh <https://www.libssh.org/2016/02/23/libssh-0-7-3-security-and-bugfix-release/>])]) -dnl Checking for libssh 0.8.x +dnl Checking for libssh 0.8.x. PKG_CHECK_MODULES([LIBSSH_0_8], [libssh >= 0.8.0], [AC_DEFINE(HAVE_LIBSSH_0_8, 1, [Use libssh 0.8])], [AC_DEFINE(HAVE_LIBSSH_0_8, 0, [Use libssh < 0.8])]) AM_CONDITIONAL(HAVE_LIBSSH_0_8, $HAVE_LIBSSH_0_8) +dnl NOTE that Ubuntu 18.04 LTS have "fake" libssh 0.8 +dnl (0.8.0~20170825.94fa1e38-1ubuntu0.6) that is actually 0.7, so we need to +dnl check 0.8.1+ to make sure we have a valid libssh 0.8. +PKG_CHECK_MODULES([LIBSSH_0_8_1], [libssh >= 0.8.1], + [AC_DEFINE(HAVE_LIBSSH_0_8_1, 1, [Use libssh 0.8.1])], + [AC_DEFINE(HAVE_LIBSSH_0_8_1, 0, [Use libssh < 0.8.1])]) + +AM_CONDITIONAL(HAVE_LIBSSH_0_8_1, $HAVE_LIBSSH_0_8_1) + PKG_CHECK_MODULES([LIBSSH_0_9], [libssh >= 0.9.0], [AC_DEFINE(HAVE_LIBSSH_0_9, 1, [Use libssh 0.9])], [AC_DEFINE(HAVE_LIBSSH_0_9, 0, [Use libssh < 0.9])]) @@ -109,7 +119,7 @@ fi AC_SUBST([guilesitedir]) -LIBGUILE_SSH_INTERFACE="12:0:0" +LIBGUILE_SSH_INTERFACE="13:1:0" AC_SUBST(LIBGUILE_SSH_INTERFACE) GUILE_EFFECTIVE_VERSION=`$GUILE -c '(display (effective-version))'` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guile-ssh-0.12.0/doc/api-channels.texi new/guile-ssh-0.13.1/doc/api-channels.texi --- old/guile-ssh-0.12.0/doc/api-channels.texi 2020-01-05 17:19:18.000000000 +0100 +++ new/guile-ssh-0.13.1/doc/api-channels.texi 2020-08-19 07:29:40.000000000 +0200 @@ -209,7 +209,7 @@ @item again We are in the nonblocking mode and the call to be done again. @item error -An error occured. +An error occurred. @end table The local port forwarding works as follows: @@ -265,7 +265,7 @@ @item again We are in the nonblocking mode and the call to be done again. @item error -An error occured. +An error occurred. @end table Reverse port forwarding looks as follows: @@ -306,7 +306,7 @@ @item again We are in the nonblocking mode and the call to be done again. @item error -An error occured. +An error occurred. @end table Here's an example Guile program that uses @code{channel-cancel-forward} to diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guile-ssh-0.12.0/doc/api-dist.texi new/guile-ssh-0.13.1/doc/api-dist.texi --- old/guile-ssh-0.12.0/doc/api-dist.texi 2020-01-05 17:19:18.000000000 +0100 +++ new/guile-ssh-0.13.1/doc/api-dist.texi 2020-08-19 07:29:40.000000000 +0200 @@ -101,7 +101,7 @@ another node from the @var{nodes} list. When job execution failed on all nodes, an error is reported. -In a case when an error that occured during job execution is considered +In a case when an error that occurred during job execution is considered non-recoverable (eg. when evaluation of @var{proc} on a node failed due to an unbound variable) then execution of a job stops immediately. @end deffn @@ -172,11 +172,11 @@ There are two types of node errors: recoverable and non-recoverable. The first group is represented by @code{node-error} exceptions. If an exception -of this kind is occured then there is a chance that a job can be executed on +of this kind is occurred then there is a chance that a job can be executed on another node. That's because such an exception occures in cases when a node is unreachable, for example. The second group is represented by @code{node-repl-error} exceptions. Such exceptions mean that an error is -occured during execution of a job on a node's REPL -- eg. due to the malformed +occurred during execution of a job on a node's REPL -- eg. due to the malformed job. Those errors are non-recoverable because if the job is broken it will likely fail on another nodes as well. @@ -186,7 +186,7 @@ @deffn {Scheme Procedure} node-eval node quoted-exp Evaluate a @var{quoted-exp} on a @var{node} and return four values: an evaluation result, a number of the evaluation, a module name and a language -name. Throw @code{node-repl-error} if a non-recoverable error occured, or +name. Throw @code{node-repl-error} if a non-recoverable error occurred, or @code{node-error} if the evaluation potentially could be succesfully evaluated on another node. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guile-ssh-0.12.0/doc/api-sessions.texi new/guile-ssh-0.13.1/doc/api-sessions.texi --- old/guile-ssh-0.12.0/doc/api-sessions.texi 2020-01-05 17:19:18.000000000 +0100 +++ new/guile-ssh-0.13.1/doc/api-sessions.texi 2020-08-19 07:29:40.000000000 +0200 @@ -88,9 +88,9 @@ @item ok Success. @item again -@var{timeout} occured. +@var{timeout} occurred. @item error -An error occured. +An error occurred. @end table @end deffn @@ -306,7 +306,7 @@ The known host file does not exist. The host is thus unknown. File will be created if host key is accepted. @item error -An error occured. +An error occurred. @end table @end deffn diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guile-ssh-0.12.0/doc/api-sftp.texi new/guile-ssh-0.13.1/doc/api-sftp.texi --- old/guile-ssh-0.12.0/doc/api-sftp.texi 2020-01-05 17:19:18.000000000 +0100 +++ new/guile-ssh-0.13.1/doc/api-sftp.texi 2020-08-19 07:29:40.000000000 +0200 @@ -29,7 +29,7 @@ @deffn {Scheme Procedure} sftp-get-error sftp-session Get the last SFTP error from a @var{sftp-session}. Return the error name as a -symbol, or throw @code{guile-ssh-error} on if an error occured in the +symbol, or throw @code{guile-ssh-error} on if an error occurred in the procedure itself. The procedure returns one of the following values: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guile-ssh-0.12.0/doc/api-shell.texi new/guile-ssh-0.13.1/doc/api-shell.texi --- old/guile-ssh-0.12.0/doc/api-shell.texi 2020-01-05 17:19:18.000000000 +0100 +++ new/guile-ssh-0.13.1/doc/api-shell.texi 2020-08-19 07:29:40.000000000 +0200 @@ -70,7 +70,7 @@ @deffn {Scheme Procedure} fallback-pkill session pattern [#:full?=#f] [#:signal='SIGTERM] Guile-SSH implementation of @command{pkill} that uses pure Bash, @file{/proc} -filsystem and Guile itself to kill a process. Note that this procedure won't +filesystem and Guile itself to kill a process. Note that this procedure won't work if Guile is missing on a target machine. Send a @var{signal} to a process which name matches to @var{pattern} on a diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guile-ssh-0.12.0/doc/api-tunnels.texi new/guile-ssh-0.13.1/doc/api-tunnels.texi --- old/guile-ssh-0.12.0/doc/api-tunnels.texi 2020-01-05 17:19:18.000000000 +0100 +++ new/guile-ssh-0.13.1/doc/api-tunnels.texi 2020-08-19 07:29:40.000000000 +0200 @@ -71,25 +71,55 @@ @end deffn @deffn {Scheme Procedure} call-with-ssh-forward tunnel proc -Open a new @var{tunnel} and start port forwarding. @var{proc} is called with -a socket as an argument. All I/O on the socket will be forwarded to the -remote host and port of a @var{tunnel}. Return the result the @var{proc} +Open a new @var{tunnel} and start port forwarding. @var{proc} is called with +an open channel as an argument. All I/O on the channel will be forwarded to +the remote host and port of a @var{tunnel}. Return the result the @var{proc} call. As a practical example, let's say you want to use -@url{https://www.gnu.org/software/guile-rpc/, Guile-RPC} over SSH. Here's how -you can implement an RPC call using @code{call-with-ssh-forward}: +@url{https://www.gnu.org/software/guile-rpc/, Guile-RPC} over SSH. Here's how +you can implement a using @code{call-with-ssh-forward}: @lisp -(let ((t (make-tunnel session - #:port 12345 - ;; Suppose a Guile-RPC server listens on - ;; 127.0.0.1:23456 on the remote host: - #:host "127.0.0.1" - #:host-port 23456))) - (call-with-ssh-forward t - (lambda (socket) - (RPC-PROGRAM-proc some-data #x123 socket)))) +(let ((pid (primitive-fork))) + (if (zero? pid) + ;; Make a new SSH session, connect it and authenticate the user. + (let* ((host "example.org") + (user "alice") + (session (make-session #:user user + #:host host + #:port 22 + #:log-verbosity 'nolog))) + (connect! session) + (userauth-agent! session) + ;; Make a new SSH tunnel. + (let ((tunnel (make-tunnel session + #:port 12345 + ;; Guile-RPC server listens on 127.0.0.1 + ;; on the remote host. + #:host "127.0.0.1" + ;; Guile-RPC server port. + #:host-port 6666))) + ;; Start the forwarder loop. + (start-forward tunnel))) + ;; Parent process. + (let ((sock (socket PF_INET SOCK_STREAM 0))) + (dynamic-wind + (const #t) + (lambda () + (sleep 1) + ;; Connect to the port that is listened to by the spawned process. + (connect sock AF_INET + (inet-pton AF_INET "127.0.0.1") + 12345) + + ;; Make an RPC call using the SSH tunnel. + (display (invoke-split-number 3.14 #x7777 sock)) + (newline)) + (lambda () + (close sock) + (kill pid SIGTERM) + (waitpid pid)))))) @end lisp The full example of an RPC client that uses a SSH tunnel is in diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guile-ssh-0.12.0/doc/guile-ssh.texi new/guile-ssh-0.13.1/doc/guile-ssh.texi --- old/guile-ssh-0.12.0/doc/guile-ssh.texi 2020-01-05 17:19:18.000000000 +0100 +++ new/guile-ssh-0.13.1/doc/guile-ssh.texi 2020-08-19 07:29:40.000000000 +0200 @@ -198,20 +198,20 @@ @end menu +@include api-sessions.texi @include api-auth.texi @include api-agent.texi +@include api-keys.texi @include api-channels.texi @include api-tunnels.texi -@include api-sessions.texi -@include api-keys.texi -@include api-messages.texi -@include api-servers.texi +@include api-popen.texi +@include api-shell.texi @include api-logging.texi @include api-version.texi -@include api-dist.texi +@include api-servers.texi +@include api-messages.texi @include api-sftp.texi -@include api-popen.texi -@include api-shell.texi +@include api-dist.texi @include examples.texi diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guile-ssh-0.12.0/examples/rpc/client.scm.in new/guile-ssh-0.13.1/examples/rpc/client.scm.in --- old/guile-ssh-0.12.0/examples/rpc/client.scm.in 2020-01-05 17:19:18.000000000 +0100 +++ new/guile-ssh-0.13.1/examples/rpc/client.scm.in 2020-08-19 07:29:40.000000000 +0200 @@ -69,10 +69,12 @@ "Entry point of the program." (let* ((options-spec '((user (single-char #\u) (value #t)) (port (single-char #\p) (value #t)) + (local-port (single-char #\l) (value #t)) (help (single-char #\h) (value #f)))) (options (getopt-long args options-spec)) (user (option-ref options 'user (getenv "USER"))) (port (option-ref options 'port "22")) + (local-port (option-ref options 'local-port "12345")) (help-needed? (option-ref options 'help #f)) (args (option-ref options '() #f))) @@ -81,25 +83,39 @@ (null? args)) (print-help-and-exit)) - ;; Make a new SSH session, connect it and authenticate the user. - (let* ((host (car args)) - (session (make-session #:user user - #:host host - #:port (string->number port) - #:log-verbosity 'nolog))) - (connect! session) - (userauth-agent! session) - ;; Make a new SSH tunnel. - (let ((tunnel (make-tunnel session - #:port 12345 - ;; Guile-RPC server listens on localhost. - #:host "127.0.0.1" - ;; Guile-RPC server port. - #:host-port 6666))) - ;; Make an RPC call using the SSH tunnel. - (call-with-ssh-forward tunnel - (lambda (socket) - (display (invoke-split-number 3.14 #x7777 socket)) - (newline))))))) + (let ((pid (primitive-fork))) + (if (zero? pid) + ;; Make a new SSH session, connect it and authenticate the user. + (let* ((host (car args)) + (session (make-session #:user user + #:host host + #:port (string->number port) + #:log-verbosity 'nolog))) + (connect! session) + (userauth-agent! session) + ;; Make a new SSH tunnel. + (let ((tunnel (make-tunnel session + #:port (string->number local-port) + ;; Guile-RPC server listens on localhost. + #:host "127.0.0.1" + ;; Guile-RPC server port. + #:host-port 6666))) + (start-forward tunnel))) + (let ((sock (socket PF_INET SOCK_STREAM 0))) + (dynamic-wind + (const #t) + (lambda () + (sleep 1) + (connect sock AF_INET (inet-pton AF_INET "127.0.0.1") + (string->number local-port)) + + ;; Make an RPC call using the SSH tunnel. + + (display (invoke-split-number 3.14 #x7777 sock)) + (newline)) + (lambda () + (close sock) + (kill pid SIGTERM) + (waitpid pid)))))))) ;;; client.scm ends here. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guile-ssh-0.12.0/examples/sssh.scm.in new/guile-ssh-0.13.1/examples/sssh.scm.in --- old/guile-ssh-0.12.0/examples/sssh.scm.in 2020-01-05 17:19:18.000000000 +0100 +++ new/guile-ssh-0.13.1/examples/sssh.scm.in 2020-08-19 07:29:40.000000000 +0200 @@ -166,6 +166,7 @@ #:log-verbosity (string->symbol ssh-debug)))) (and known-hosts-file + (not (string-null? known-hosts-file)) (session-set! session 'knownhosts known-hosts-file)) (print-debug "3. connect! (ssh_connect_x)\n") @@ -175,9 +176,10 @@ (userauth-get-list session)) (print-debug "4. authenticate-server (ssh_is_server_known)\n") - (case (authenticate-server session) - ((ok) (print-debug " ok\n")) - ((not-known) (display " The server is unknown. Please check MD5.\n"))) + (unless (string-null? known-hosts-file) + (case (authenticate-server session) + ((ok) (print-debug " ok\n")) + ((not-known) (display " The server is unknown. Please check MD5.\n")))) (let* ((pubkey (get-server-public-key session)) (hash (get-public-key-hash pubkey 'md5))) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guile-ssh-0.12.0/libguile-ssh/.gitignore new/guile-ssh-0.13.1/libguile-ssh/.gitignore --- old/guile-ssh-0.12.0/libguile-ssh/.gitignore 2020-01-05 17:19:18.000000000 +0100 +++ new/guile-ssh-0.13.1/libguile-ssh/.gitignore 2020-08-19 07:29:40.000000000 +0200 @@ -7,4 +7,7 @@ *.lo *.la +config.h +config.h.in +stamp-h1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guile-ssh-0.12.0/libguile-ssh/channel-func.c new/guile-ssh-0.13.1/libguile-ssh/channel-func.c --- old/guile-ssh-0.12.0/libguile-ssh/channel-func.c 2020-01-05 17:19:18.000000000 +0100 +++ new/guile-ssh-0.13.1/libguile-ssh/channel-func.c 2020-08-19 07:29:40.000000000 +0200 @@ -49,6 +49,10 @@ struct channel_data *data = _scm_to_channel_data (channel); int res; GSSH_VALIDATE_CHANNEL_DATA (data, channel, FUNC_NAME); + + if (! _gssh_channel_parent_session_connected_p (data)) + guile_ssh_error1 (FUNC_NAME, "Parent session is not connected", channel); + res = ssh_channel_open_session (data->ssh_channel); _gssh_log_debug_format(FUNC_NAME, channel, "result: %d", res); if (res != SSH_OK) @@ -78,6 +82,9 @@ GSSH_VALIDATE_OPEN_CHANNEL (channel, SCM_ARG1, FUNC_NAME); SCM_ASSERT (scm_is_string (cmd), cmd, SCM_ARG2, FUNC_NAME); + if (! _gssh_channel_parent_session_connected_p (data)) + guile_ssh_error1 (FUNC_NAME, "Parent session is not connected", channel); + c_cmd = scm_to_locale_string (cmd); res = ssh_channel_request_exec (data->ssh_channel, c_cmd); _gssh_log_debug_format(FUNC_NAME, scm_list_2 (channel, cmd), @@ -109,6 +116,10 @@ GSSH_VALIDATE_OPEN_CHANNEL (channel, SCM_ARG1, FUNC_NAME); cd = _scm_to_channel_data (channel); + + if (! _gssh_channel_parent_session_connected_p (cd)) + guile_ssh_error1 (FUNC_NAME, "Parent session is not connected", channel); + res = ssh_channel_get_exit_status (cd->ssh_channel); _gssh_log_debug_format(FUNC_NAME, channel, "result: %d", res); if (res == SSH_ERROR) { @@ -137,6 +148,9 @@ SCM_ASSERT (scm_is_unsigned_integer (exit_status, 0, UINT32_MAX), exit_status, SCM_ARG2, FUNC_NAME); + if (! _gssh_channel_parent_session_connected_p (cd)) + guile_ssh_error1 (FUNC_NAME, "Parent session is not connected", channel); + res = ssh_channel_request_send_exit_status (cd->ssh_channel, scm_to_uint32 (exit_status)); _gssh_log_debug_format(FUNC_NAME, scm_list_2 (channel, exit_status), @@ -164,6 +178,9 @@ GSSH_VALIDATE_OPEN_CHANNEL (channel, SCM_ARG1, FUNC_NAME); + if (! _gssh_channel_parent_session_connected_p (data)) + guile_ssh_error1 (FUNC_NAME, "Parent session is not connected", channel); + res = ssh_channel_request_pty (data->ssh_channel); _gssh_log_debug_format(FUNC_NAME, channel, "result: %d", res); if (res != SSH_OK) @@ -189,6 +206,9 @@ GSSH_VALIDATE_OPEN_CHANNEL (channel, SCM_ARG1, FUNC_NAME); + if (! _gssh_channel_parent_session_connected_p (data)) + guile_ssh_error1 (FUNC_NAME, "Parent session is not connected", channel); + res = ssh_channel_request_shell (data->ssh_channel); _gssh_log_debug_format(FUNC_NAME, channel, "result: %d", res); if (res != SSH_OK) @@ -220,6 +240,9 @@ SCM_ASSERT (scm_is_string (name), name, SCM_ARG2, FUNC_NAME); SCM_ASSERT (scm_is_string (value), value, SCM_ARG3, FUNC_NAME); + if (! _gssh_channel_parent_session_connected_p (data)) + guile_ssh_error1 (FUNC_NAME, "Parent session is not connected", channel); + c_name = scm_to_locale_string (name); c_value = scm_to_locale_string (value); res = ssh_channel_request_env (data->ssh_channel, c_name, c_value); @@ -271,6 +294,7 @@ struct channel_data *cd = _scm_to_channel_data (channel); char *c_remote_host = NULL; char *c_source_host = NULL; + struct session_data *sd = NULL; int res; SCM_ASSERT (scm_is_string (remote_host), remote_host, SCM_ARG2, FUNC_NAME); @@ -278,6 +302,19 @@ SCM_ASSERT (scm_is_string (source_host), source_host, SCM_ARG4, FUNC_NAME); SCM_ASSERT (scm_is_number (local_port), local_port, SCM_ARG5, FUNC_NAME); + if (! cd) + guile_ssh_error1 (FUNC_NAME, "Channel is freed: ", channel); + + if (! _gssh_channel_parent_session_connected_p (cd)) + guile_ssh_error1 (FUNC_NAME, "Parent session is not connected", channel); + + sd = _scm_to_session_data (cd->session); + if (! sd) + guile_ssh_error1 (FUNC_NAME, "Session is freed: ", cd->session); + + if (! ssh_is_connected (sd->ssh_session)) + guile_ssh_error1 (FUNC_NAME, "Session is disconnected: ", channel); + scm_dynwind_begin (0); c_remote_host = scm_to_locale_string (remote_host); @@ -305,6 +342,9 @@ scm_dynwind_end (); + scm_remember_upto_here_1 (channel); + scm_remember_upto_here_1 (cd->session); + return _ssh_result_to_symbol (res); } #undef FUNC_NAME @@ -419,6 +459,9 @@ SCM_ASSERT (scm_is_unsigned_integer (row, 0, UINT32_MAX), row, SCM_ARG2, FUNC_NAME); + if (! _gssh_channel_parent_session_connected_p (data)) + guile_ssh_error1 (FUNC_NAME, "Parent session is not connected", channel); + ssh_channel_change_pty_size (data->ssh_channel, scm_to_uint32 (col), scm_to_uint32 (row)); @@ -442,6 +485,9 @@ GSSH_VALIDATE_OPEN_CHANNEL (channel, SCM_ARG1, FUNC_NAME); SCM_ASSERT (scm_is_symbol (stream_name), stream_name, SCM_ARG2, FUNC_NAME); + if (! _gssh_channel_parent_session_connected_p (cd)) + guile_ssh_error1 (FUNC_NAME, "Parent session is not connected", channel); + if (scm_is_eq (stream_name, scm_from_locale_symbol ("stdout"))) { cd->is_stderr = 0; @@ -474,6 +520,9 @@ GSSH_VALIDATE_OPEN_CHANNEL (channel, SCM_ARG1, FUNC_NAME); + if (! _gssh_channel_parent_session_connected_p (cd)) + guile_ssh_error1 (FUNC_NAME, "Parent session is not connected", channel); + if (cd->is_stderr == 0) return scm_from_locale_symbol ("stdout"); if (cd->is_stderr == 1) @@ -524,6 +573,9 @@ GSSH_VALIDATE_CHANNEL_DATA (cd, channel, FUNC_NAME); + if (! _gssh_channel_parent_session_connected_p (cd)) + guile_ssh_error1 (FUNC_NAME, "Parent session is not connected", channel); + pt_bits = SCM_CELL_TYPE (channel); if ((pt_bits & SCM_WRTNG) == 0) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guile-ssh-0.12.0/libguile-ssh/channel-type.c new/guile-ssh-0.13.1/libguile-ssh/channel-type.c --- old/guile-ssh-0.12.0/libguile-ssh/channel-type.c 2020-01-05 17:19:18.000000000 +0100 +++ new/guile-ssh-0.13.1/libguile-ssh/channel-type.c 2020-08-19 07:29:40.000000000 +0200 @@ -1,6 +1,6 @@ /* channel-type.c -- SSH channel smob. * - * Copyright (C) 2013, 2014, 2015, 2016, 2017 Artyom V. Poptsov <poptsov.art...@gmail.com> + * Copyright (C) 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Artyom V. Poptsov <poptsov.art...@gmail.com> * Copyright (C) 2017 Ludovic Courtès <l...@gnu.org> * * This file is part of Guile-SSH. @@ -51,7 +51,7 @@ #if USING_GUILE_BEFORE_2_2 /* Read data from the channel. Return EOF if no data is available or - throw `guile-ssh-error' if an error occured. */ + throw `guile-ssh-error' if an error occurred. */ static int ptob_fill_input (SCM channel) #define FUNC_NAME "ptob_fill_input" @@ -178,6 +178,9 @@ char *data = (char *) SCM_BYTEVECTOR_CONTENTS (src) + start; struct channel_data *channel_data = _scm_to_channel_data (channel); + if (! _gssh_channel_parent_session_connected_p (channel_data)) + guile_ssh_error1 (FUNC_NAME, "Parent session is not connected", channel); + int res = ssh_channel_write (channel_data->ssh_channel, data, count); if (res == SSH_ERROR) { @@ -202,7 +205,7 @@ int res = ssh_channel_poll (cd->ssh_channel, cd->is_stderr); if (res == SSH_ERROR) - guile_ssh_error1 (FUNC_NAME, "An error occured.", channel); + guile_ssh_error1 (FUNC_NAME, "An error occurred.", channel); return (res != SSH_EOF) ? res : 0; } @@ -224,13 +227,27 @@ ptob_flush (channel); #endif - if (ch && ssh_channel_is_open (ch->ssh_channel)) + if (ch) { - _gssh_log_debug ("ptob_close", "closing and freeing the channel...", - channel); - ssh_channel_close (ch->ssh_channel); - ssh_channel_free (ch->ssh_channel); - _gssh_log_debug1 ("ptob_close", "closing and freeing the channel... done"); + struct session_data *sd = _scm_to_session_data (ch->session); + if (sd && ssh_is_connected (sd->ssh_session)) + { + if (ssh_channel_is_open (ch->ssh_channel)) + { + _gssh_log_debug ("ptob_close", "closing and freeing the channel...", + channel); + ssh_channel_close (ch->ssh_channel); + ssh_channel_free (ch->ssh_channel); + _gssh_log_debug1 ("ptob_close", "closing and freeing the channel... done"); + } + } + else + { + _gssh_log_debug1 ("ptob_close", + "the channel is already freed" + " along with the parent session."); + } + scm_gc_unprotect_object (ch->session); } else { @@ -247,8 +264,6 @@ #endif } - - /* Print the CHANNEL object to port PORT. */ static int print_channel (SCM channel, SCM port, scm_print_state *pstate) @@ -270,16 +285,23 @@ } else { - scm_print_port_mode (channel, port); - scm_puts ("channel ", port); - if (SCM_OPPORTP (channel)) + if (! _gssh_channel_parent_session_connected_p (ch)) { - int is_open = ssh_channel_is_open (ch->ssh_channel); - scm_puts (is_open ? "(open) " : "(closed) ", port); + scm_puts ("unknown channel (freed) ", port); } else { - scm_puts ("(closed) ", port); + scm_print_port_mode (channel, port); + scm_puts ("channel ", port); + if (SCM_OPPORTP (channel)) + { + int is_open = ssh_channel_is_open (ch->ssh_channel); + scm_puts (is_open ? "(open) " : "(closed) ", port); + } + else + { + scm_puts ("(closed) ", port); + } } } scm_display (_scm_object_hex_address (channel), port); @@ -298,6 +320,7 @@ struct session_data *session_data = _scm_to_session_data (arg1); ssh_channel ch; + GSSH_VALIDATE_CONNECTED_SESSION (session_data, arg1, SCM_ARG1); SCM_ASSERT (scm_is_integer (flags), flags, SCM_ARG2, FUNC_NAME); ch = ssh_channel_new (session_data->ssh_session); @@ -365,6 +388,8 @@ channel_data->is_stderr = 0; /* Reading from stderr disabled by default */ channel_data->session = session; + scm_gc_protect_object (channel_data->session); + #if USING_GUILE_BEFORE_2_2 { scm_port *pt; @@ -417,6 +442,16 @@ return (struct channel_data *) SCM_STREAM (x); } +/** + * Predicate. Return 1 if the parent session is connected, 0 otherwise. + */ +int +_gssh_channel_parent_session_connected_p (struct channel_data* cd) +{ + struct session_data *sd = _scm_to_session_data (cd->session); + return (sd && ssh_is_connected (sd->ssh_session)); +} + /* channel smob initialization. */ void @@ -432,6 +467,7 @@ #endif ); scm_set_port_close (channel_tag, ptob_close); + scm_set_port_needs_close_on_gc (channel_tag, 1); #if USING_GUILE_BEFORE_2_2 scm_set_port_flush (channel_tag, ptob_flush); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guile-ssh-0.12.0/libguile-ssh/channel-type.h new/guile-ssh-0.13.1/libguile-ssh/channel-type.h --- old/guile-ssh-0.12.0/libguile-ssh/channel-type.h 2020-01-05 17:19:18.000000000 +0100 +++ new/guile-ssh-0.13.1/libguile-ssh/channel-type.h 2020-08-19 07:29:40.000000000 +0200 @@ -75,4 +75,6 @@ extern SCM _scm_from_channel_data (ssh_channel ch, SCM session, long flags); +int _gssh_channel_parent_session_connected_p (struct channel_data* cd); + #endif /* ifndef __CHANNEL_TYPE_H__ */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guile-ssh-0.12.0/libguile-ssh/log.c new/guile-ssh-0.13.1/libguile-ssh/log.c --- old/guile-ssh-0.12.0/libguile-ssh/log.c 2020-01-05 17:19:18.000000000 +0100 +++ new/guile-ssh-0.13.1/libguile-ssh/log.c 2020-08-19 07:29:40.000000000 +0200 @@ -66,6 +66,11 @@ SCM userdata = (SCM) c_userdata; scm_call_4 (logging_callback, priority, function, message, userdata); + + scm_remember_upto_here_1 (priority); + scm_remember_upto_here_1 (function); + scm_remember_upto_here_1 (message); + scm_remember_upto_here_1 (userdata); } @@ -252,6 +257,8 @@ _ssh_log (SSH_LOG_NOLOG, function_name, "[GSSH ERROR] %s: %s", msg, c_str); + scm_remember_upto_here_1 (args); + scm_dynwind_end (); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guile-ssh-0.12.0/libguile-ssh/session-func.c new/guile-ssh-0.13.1/libguile-ssh/session-func.c --- old/guile-ssh-0.12.0/libguile-ssh/session-func.c 2020-01-05 17:19:18.000000000 +0100 +++ new/guile-ssh-0.13.1/libguile-ssh/session-func.c 2020-08-19 07:29:40.000000000 +0200 @@ -71,6 +71,9 @@ { "stricthostkeycheck", SSH_OPTIONS_STRICTHOSTKEYCHECK }, { "compression", SSH_OPTIONS_COMPRESSION }, { "compression-level", SSH_OPTIONS_COMPRESSION_LEVEL }, +#if HAVE_LIBSSH_0_8_1 + { "nodelay", SSH_OPTIONS_NODELAY }, +#endif { "callbacks", GSSH_OPTIONS_CALLBACKS }, { NULL, -1 } }; @@ -366,6 +369,9 @@ case SSH_OPTIONS_SSH1: case SSH_OPTIONS_SSH2: case SSH_OPTIONS_STRICTHOSTKEYCHECK: +#if HAVE_LIBSSH_0_8_1 + case SSH_OPTIONS_NODELAY: +#endif return set_bool_opt (session, type, value); case SSH_OPTIONS_FD: @@ -473,6 +479,8 @@ if (res == SSH_ERROR) guile_ssh_error1 (FUNC_NAME, "Unable to get value of the option", option); + scm_remember_upto_here_1 (option); + return value; } #undef FUNC_NAME @@ -625,7 +633,11 @@ GSSH_VALIDATE_CONNECTED_SESSION (data, session, SCM_ARG1); +#if HAVE_LIBSSH_0_9 + res = ssh_session_is_known_server (data->ssh_session); +#else res = ssh_is_server_known (data->ssh_session); +#endif switch (res) { @@ -672,7 +684,12 @@ kd = (struct key_data *) scm_gc_malloc (sizeof (struct key_data), "ssh key"); /* TODO: Check `kd' for NULL. */ +#if HAVE_LIBSSH_0_8 + res = ssh_get_server_publickey (sd->ssh_session, &kd->ssh_key); +#else res = ssh_get_publickey (sd->ssh_session, &kd->ssh_key); +#endif + if (res != SSH_OK) guile_ssh_error1 (FUNC_NAME, "Unable to get the server key", session); @@ -695,7 +712,11 @@ GSSH_VALIDATE_CONNECTED_SESSION (session_data, session, SCM_ARG1); +#if HAVE_LIBSSH_0_9 + res = ssh_session_update_known_hosts (session_data->ssh_session); +#else res = ssh_write_knownhost (session_data->ssh_session); +#endif if (res != SSH_OK) guile_ssh_session_error1 (FUNC_NAME, session_data->ssh_session, session); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guile-ssh-0.12.0/libguile-ssh/sftp-file-type.c new/guile-ssh-0.13.1/libguile-ssh/sftp-file-type.c --- old/guile-ssh-0.12.0/libguile-ssh/sftp-file-type.c 2020-01-05 17:19:18.000000000 +0100 +++ new/guile-ssh-0.13.1/libguile-ssh/sftp-file-type.c 2020-08-19 07:29:40.000000000 +0200 @@ -50,7 +50,7 @@ #if USING_GUILE_BEFORE_2_2 /* Read data from the channel. Return EOF if no data is available or - throw `guile-ssh-error' if an error occured. */ + throw `guile-ssh-error' if an error occurred. */ static int ptob_fill_input (SCM file) #define FUNC_NAME "ptob_fill_input" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guile-ssh-0.12.0/libguile-ssh/threads.c new/guile-ssh-0.13.1/libguile-ssh/threads.c --- old/guile-ssh-0.12.0/libguile-ssh/threads.c 2020-01-05 17:19:18.000000000 +0100 +++ new/guile-ssh-0.13.1/libguile-ssh/threads.c 2020-08-19 07:29:40.000000000 +0200 @@ -1,6 +1,6 @@ /* threads.c -- Initialization of SSH threads * - * Copyright (C) 2013 Artyom V. Poptsov <poptsov.art...@gmail.com> + * Copyright (C) 2013, 2020 Artyom V. Poptsov <poptsov.art...@gmail.com> * * This file is part of Guile-SSH. * @@ -32,7 +32,9 @@ { if (pthreads_state == SSH_PTHREADS_DISABLED) { +#if ! HAVE_LIBSSH_0_8 ssh_threads_set_callbacks (ssh_threads_get_pthread ()); +#endif ssh_init (); pthreads_state = SSH_PTHREADS_ENABLED; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guile-ssh-0.12.0/modules/ssh/Makefile.am new/guile-ssh-0.13.1/modules/ssh/Makefile.am --- old/guile-ssh-0.12.0/modules/ssh/Makefile.am 2020-01-05 17:19:18.000000000 +0100 +++ new/guile-ssh-0.13.1/modules/ssh/Makefile.am 2020-08-19 07:29:40.000000000 +0200 @@ -66,8 +66,8 @@ guilec_env = \ GUILE_AUTO_COMPILE=0 \ $(CROSS_COMPILING_VARIABLE) \ - LD_LIBRARY_PATH="$(abs_top_builddir)/libguile-ssh/.libs/:${LD_LIBRARY_PATH}" \ - GUILE_LOAD_PATH="$(abs_top_srcdir)/modules" \ + GUILE_SYSTEM_EXTENSIONS_PATH="$(abs_top_builddir)/libguile-ssh/.libs/:${GUILE_SYSTEM_EXTENSIONS_PATH}" \ + GUILE_LOAD_PATH="$(abs_top_srcdir)/modules" \ GUILE_LOAD_COMPILED_PATH="$(builddir)/ssh:$$GUILE_LOAD_COMPILED_PATH" .scm.go: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guile-ssh-0.12.0/modules/ssh/dist/Makefile.am new/guile-ssh-0.13.1/modules/ssh/dist/Makefile.am --- old/guile-ssh-0.12.0/modules/ssh/dist/Makefile.am 2020-01-05 17:19:18.000000000 +0100 +++ new/guile-ssh-0.13.1/modules/ssh/dist/Makefile.am 2020-08-19 07:29:40.000000000 +0200 @@ -61,7 +61,7 @@ guilec_env = \ GUILE_AUTO_COMPILE=0 \ $(CROSS_COMPILING_VARIABLE) \ - LD_LIBRARY_PATH="$(abs_top_builddir)/libguile-ssh/.libs/:${LD_LIBRARY_PATH}" \ + GUILE_SYSTEM_EXTENSIONS_PATH="$(abs_top_builddir)/libguile-ssh/.libs/:${GUILE_SYSTEM_EXTENSIONS_PATH}" \ GUILE_LOAD_PATH="$(abs_top_srcdir)/modules" \ GUILE_LOAD_COMPILED_PATH="$(builddir)/ssh:$$GUILE_LOAD_COMPILED_PATH" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guile-ssh-0.12.0/modules/ssh/dist/node.scm new/guile-ssh-0.13.1/modules/ssh/dist/node.scm --- old/guile-ssh-0.12.0/modules/ssh/dist/node.scm 2020-01-05 17:19:18.000000000 +0100 +++ new/guile-ssh-0.13.1/modules/ssh/dist/node.scm 2020-08-19 07:29:40.000000000 +0200 @@ -151,17 +151,6 @@ (make-rrepl session) (%make-node session rrepl-port guile-version))) -(define (node-stop-rrepl! node) - "Stop a RREPL on a NODE." - (close-port (node-rrepl-port node))) - -(define (node-start-rrepl! node) - "Start a new RREPL on a NODE." - (receive (rrepl-port guile-version) - (make-rrepl session) - (node-rrepl-port-set! node rrepl-port) - (node-guile-version-set! node guile-version))) - ;;; Remote REPL (RREPL) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guile-ssh-0.12.0/modules/ssh/dist.scm new/guile-ssh-0.13.1/modules/ssh/dist.scm --- old/guile-ssh-0.12.0/modules/ssh/dist.scm 2020-01-05 17:19:18.000000000 +0100 +++ new/guile-ssh-0.13.1/modules/ssh/dist.scm 2020-08-19 07:29:40.000000000 +0200 @@ -106,7 +106,7 @@ (apply values results))) (define-syntax-rule (dist-map nodes proc lst) - "Do list mapping using distributed computation. The job is splitted to + "Do list mapping using distributed computation. The job is split into nearly equal parts and hand out resulting jobs to a NODES list. Return the result of computation." (let* ((jobs (assign-map nodes lst (quote proc))) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guile-ssh-0.12.0/modules/ssh/session.scm new/guile-ssh-0.13.1/modules/ssh/session.scm --- old/guile-ssh-0.12.0/modules/ssh/session.scm 2020-01-05 17:19:18.000000000 +0100 +++ new/guile-ssh-0.13.1/modules/ssh/session.scm 2020-08-19 07:29:40.000000000 +0200 @@ -74,7 +74,7 @@ knownhosts timeout timeout-usec ssh1 ssh2 log-verbosity ciphers-c-s ciphers-s-c compression-c-s compression-s-c proxycommand stricthostkeycheck compression - compression-level callbacks config) + compression-level nodelay callbacks config) "Make a new SSH session with specified configuration.\n Return a new SSH session." (let ((session (%make-session))) @@ -98,6 +98,7 @@ (session-set-if-specified! stricthostkeycheck) (session-set-if-specified! compression) (session-set-if-specified! compression-level) + (session-set-if-specified! nodelay) (session-set-if-specified! callbacks) (when config diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guile-ssh-0.12.0/modules/ssh/sftp.scm new/guile-ssh-0.13.1/modules/ssh/sftp.scm --- old/guile-ssh-0.12.0/modules/ssh/sftp.scm 2020-01-05 17:19:18.000000000 +0100 +++ new/guile-ssh-0.13.1/modules/ssh/sftp.scm 2020-08-19 07:29:40.000000000 +0200 @@ -113,7 +113,7 @@ (define (sftp-get-error sftp-session) "Get the last SFTP error from a SFTP-SESSION. Return the error name as a symbol, -or throw 'guile-ssh-error' on if an error occured in the procedure itself." +or throw 'guile-ssh-error' on if an error occurred in the procedure itself." (%gssh-sftp-get-error sftp-session)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guile-ssh-0.12.0/modules/ssh/shell.scm new/guile-ssh-0.13.1/modules/ssh/shell.scm --- old/guile-ssh-0.12.0/modules/ssh/shell.scm 2020-01-05 17:19:18.000000000 +0100 +++ new/guile-ssh-0.13.1/modules/ssh/shell.scm 2020-08-19 07:29:40.000000000 +0200 @@ -1,6 +1,6 @@ ;;; shell.scm -- Remote shell. -;; Copyright (C) 2016, 2017 Artyom V. Poptsov <poptsov.art...@gmail.com> +;; Copyright (C) 2016, 2017, 2020 Artyom V. Poptsov <poptsov.art...@gmail.com> ;; ;; This file is a part of Guile-SSH. ;; @@ -48,8 +48,15 @@ #:use-module (ssh channel) #:use-module (ssh popen) #:use-module (ssh log) - #:export (rexec which pgrep pkill fallback-pgrep command-available? - fallback-pkill guile-version loadavg)) + #:export (rexec + which + pgrep + pkill + command-available? + guile-version + loadavg + fallback-pkill + fallback-pgrep)) ;;; @@ -133,7 +140,7 @@ (define* (fallback-pkill session pattern #:key (full? #f) (signal 'SIGTERM)) - "Guile-SSH implementation of 'pkill' that uses pure bash, '/proc' filsystem + "Guile-SSH implementation of 'pkill' that uses pure bash, '/proc' filesystem and Guile itself to kill a process. Note that this procedure won't work if Guile is missing on a target machine. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guile-ssh-0.12.0/modules/ssh/tunnel.scm new/guile-ssh-0.13.1/modules/ssh/tunnel.scm --- old/guile-ssh-0.12.0/modules/ssh/tunnel.scm 2020-01-05 17:19:18.000000000 +0100 +++ new/guile-ssh-0.13.1/modules/ssh/tunnel.scm 2020-08-19 07:29:40.000000000 +0200 @@ -225,7 +225,7 @@ "Make a connection for a reverse TUNNEL. The return value is unspecified." (connect sock AF_INET - (inet-aton (tunnel-host tunnel)) + (inet-pton AF_INET (tunnel-host tunnel)) (tunnel-host-port tunnel))) (let ((timeout (tunnel-timeout tunnel))) @@ -266,29 +266,17 @@ (close sock)))) (define (call-with-ssh-forward tunnel proc) - "Call a procedure PROC as (proc sock) where SOCK is a socket that forwards -all the received data to a remote side through a TUNNEL, and vice versa. -Return the result the PROC call." - (let ((sock (socket PF_INET SOCK_STREAM 0)) - (thread (call-with-new-thread - (lambda () - (start-forward tunnel))))) - - (while #t - (catch #t - (lambda () - (connect sock AF_INET (inet-pton AF_INET (tunnel-bind-address tunnel)) - (tunnel-port tunnel)) - (break)) - (lambda args - (sleep 1)))) - + "Call a procedure PROC as (proc channel) where CHANNEL is a channel that +forwards all the received data to a remote side through a TUNNEL, and vice +versa. Return the result the PROC call." + (let ((channel (tunnel-open-forward-channel tunnel))) (dynamic-wind (const #f) (lambda () - (proc sock)) + (proc channel)) (lambda () - (close-port sock) - (cancel-thread thread))))) + (channel-cancel-forward (channel-get-session channel) + (tunnel-host tunnel) + (tunnel-host-port tunnel)))))) ;;; tunnel.scm ends here. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guile-ssh-0.12.0/tests/Makefile.am new/guile-ssh-0.13.1/tests/Makefile.am --- old/guile-ssh-0.12.0/tests/Makefile.am 2020-01-05 17:19:18.000000000 +0100 +++ new/guile-ssh-0.13.1/tests/Makefile.am 2020-08-19 07:29:40.000000000 +0200 @@ -1,9 +1,9 @@ -## Config file for GNU Automake. +## Config file for GNU Automake. ## ## Copyright (C) 2014, 2015, 2016 Artyom V. Poptsov <poptsov.art...@gmail.com> ## ## This file is part of Guile-SSH. -## +## ## Guile-SSH is free software: you can redistribute it and/or ## modify it under the terms of the GNU General Public License as ## published by the Free Software Foundation, either version 3 of the @@ -43,6 +43,7 @@ abs_top_builddir="$(abs_top_builddir)"; export abs_top_builddir; \ ORIGTERM=${TERM}; export ORIGTERM; \ TERM=xterm; export TERM; \ + GUILE=$(GUILE); export GUILE; \ GUILE_WARN_DEPRECATED=no; export GUILE_WARN_DEPRECATED; \ GUILE_AUTO_COMPILE=0; export GUILE_AUTO_COMPILE; @@ -87,8 +88,8 @@ # TODO: Move environment setup to a separate file. guilec_env = \ GUILE_AUTO_COMPILE=0 \ - LD_LIBRARY_PATH="$(abs_top_builddir)/libguile-ssh/.libs/:${LD_LIBRARY_PATH}" \ - GUILE_LOAD_PATH="$(abs_top_srcdir)/modules" \ + GUILE_SYSTEM_EXTENSIONS_PATH="$(abs_top_builddir)/libguile-ssh/.libs/:${GUILE_SYSTEM_EXTENSIONS_PATH}" \ + GUILE_LOAD_PATH="$(abs_top_srcdir)/modules" \ GUILE_LOAD_COMPILED_PATH="$(builddir)/ssh:$$GUILE_LOAD_COMPILED_PATH" .scm.go: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guile-ssh-0.12.0/tests/common.scm new/guile-ssh-0.13.1/tests/common.scm --- old/guile-ssh-0.12.0/tests/common.scm 2020-01-05 17:19:18.000000000 +0100 +++ new/guile-ssh-0.13.1/tests/common.scm 2020-08-19 07:29:40.000000000 +0200 @@ -72,6 +72,7 @@ (define %topdir (getenv "abs_top_srcdir")) (define %topbuilddir (getenv "abs_top_builddir")) +(define %guile (getenv "GUILE")) (define %addr "127.0.0.1") (define *port* 12400) @@ -284,7 +285,7 @@ (loop (1+ num)) (begin (format-log/scm 'nolog "get-unused-port" - "port choosen: ~a" num) + "port chosen: ~a" num) (set! port-num num) (unlock-mutex mtx) num)))))) @@ -560,9 +561,9 @@ (multifork ;; server (lambda () - (execle "/usr/bin/guile" + (execle %guile (environ) - "/usr/bin/guile" + %guile "-L" (format #f "~a/" %topdir) "-L" (format #f "~a/modules/" %topdir) "-e" "main" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guile-ssh-0.12.0/tests/session.scm new/guile-ssh-0.13.1/tests/session.scm --- old/guile-ssh-0.12.0/tests/session.scm 2020-01-05 17:19:18.000000000 +0100 +++ new/guile-ssh-0.13.1/tests/session.scm 2020-08-19 07:29:40.000000000 +0200 @@ -22,9 +22,13 @@ (use-modules (srfi srfi-64) (ssh session) (ssh log) + (ssh version) ;; Helper procedures (tests common)) +(define %libssh-minor-version + (string->number (cadr (string-split (get-libssh-version) #\.)))) + (set-log-verbosity! 'functions) (test-begin-with-log "session") @@ -68,11 +72,15 @@ (ssh2 #f #t) (log-verbosity nolog rare protocol packet functions nolog) - (compression "yes" "no") (compression-level 1 2 3 4 5 6 7 8 9) + (compression "yes" "no") (callbacks ((user-data . "hello") (global-request-callback . ,(const #f)))))) (res #t)) + + (if (>= %libssh-minor-version 8) + (set! options (cons '(nodelay #f #t) options))) + (for-each (lambda (opt) (for-each @@ -98,6 +106,10 @@ (callbacks "not a list" ((global-request-callback . #f))))) (res #t)) + + (if (>= %libssh-minor-version 8) + (set! options (cons '(nodelay 12345 "string") options))) + (for-each (lambda (opt) (for-each diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guile-ssh-0.12.0/tests/sssh-ssshd.scm new/guile-ssh-0.13.1/tests/sssh-ssshd.scm --- old/guile-ssh-0.12.0/tests/sssh-ssshd.scm 2020-01-05 17:19:18.000000000 +0100 +++ new/guile-ssh-0.13.1/tests/sssh-ssshd.scm 2020-08-19 07:29:40.000000000 +0200 @@ -31,7 +31,7 @@ ;;; -(define *test-cmd* "uname --all") +(define *test-cmd* "uname -a") (define *srv-address* INADDR_LOOPBACK) (define *srv-port* 12600) @@ -50,7 +50,7 @@ %topbuilddir "/examples/sssh.scm" " --identity-file=" %rsakey " --port=" (number->string *srv-port*) - " --known-hosts-file=" %knownhosts + " --known-hosts-file=''" " " (inet-ntop AF_INET *srv-address*) " '" *test-cmd* "'")) @@ -62,51 +62,60 @@ (define ssshd-pid #f) +(define (cleanup pid) + (when pid + (kill pid SIGTERM) + (catch #t + (lambda () + (waitpid pid)) + (const #t))) + (and (file-exists? *srv-pid-file*) + (delete-file *srv-pid-file*))) + +(define (wait-pid-file max-tries pid-file) + (let loop ((exists? #f) + (sleep-time 1) ; s + (try 1)) + (if exists? + (let* ((p (open-input-file pid-file)) + (pid (read-line p))) + (string->number pid)) + (if (<= try max-tries) + (begin + (sleep sleep-time) + (loop (file-exists? pid-file) + (1+ sleep-time) + (1+ try))) + (begin + (format #t "Couldn't read a PID file ~a in ~a tries.~%" + pid-file try) + #f))))) + ;;; Tests (test-assert "ssshd, start" - (let ((*max-tries* 10)) + (let ((max-tries 10)) (system *ssshd-cmd*) - (let wait-pid-file ((exists? #f) - (sleep-time 1) ;s - (try 1)) - (if exists? - (let* ((p (open-input-file *srv-pid-file*)) - (pid (read-line p))) - (set! ssshd-pid (string->number pid))) - (if (<= try *max-tries*) - (begin - (sleep sleep-time) - (wait-pid-file (file-exists? *srv-pid-file*) - (1+ sleep-time) - (1+ try))) - (format #t "Couldn't read a PID file ~a in ~a tries.~%" - *srv-pid-file* try)))) - (sleep 1) - ssshd-pid)) + (let ((pid (wait-pid-file max-tries *srv-pid-file*))) + (cleanup pid) + pid))) (test-assert "sssh, exec" - (let ((output (read-line (open-input-pipe *test-cmd*))) - (p (open-input-pipe *sssh-cmd*)) - (res #f)) - (let r ((l (read-line p))) - (if (not (eof-object? l)) - (if (string=? output l) - (set! res #t) - (r (read-line p))))) - - ;; Cleanup - - (and ssshd-pid - (kill ssshd-pid SIGTERM)) - - (and (file-exists? *srv-pid-file*) - (delete-file *srv-pid-file*)) - - ;; Return the result - - res)) + (let ((max-tries 10)) + (system *ssshd-cmd*) + (let* ((pid (wait-pid-file max-tries *srv-pid-file*)) + (output (read-line (open-input-pipe *test-cmd*))) + (p (open-input-pipe *sssh-cmd*)) + (result (let r ((res "") + (l (read-line p))) + (and (not (eof-object? l)) + (if (string=? output res) + #t + (r (string-append res l) + (read-line p))))))) + (cleanup pid) + result))) (test-end "sssh-ssshd") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/guile-ssh-0.12.0/tests/tunnel.scm new/guile-ssh-0.13.1/tests/tunnel.scm --- old/guile-ssh-0.12.0/tests/tunnel.scm 2020-01-05 17:19:18.000000000 +0100 +++ new/guile-ssh-0.13.1/tests/tunnel.scm 2020-08-19 07:29:40.000000000 +0200 @@ -164,10 +164,12 @@ (tunnel (make-tunnel session #:port local-port #:host remote-host))) - (call-with-ssh-forward tunnel - (lambda (sock) - (write-line %test-string sock) - (poll sock read-line))))))))) + (let ((result (call-with-ssh-forward tunnel + (lambda (channel) + (write-line %test-string channel) + (poll channel read-line))))) + (disconnect! session) + result))))))) (test-assert-with-log "channel-{listen,cancel}-forward" _______________________________________________ openSUSE Commits mailing list -- commit@lists.opensuse.org To unsubscribe, email commit-le...@lists.opensuse.org List Netiquette: https://en.opensuse.org/openSUSE:Mailing_list_netiquette List Archives: https://lists.opensuse.org/archives/list/commit@lists.opensuse.org