summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorArtyom V. Poptsov <poptsov.artyom@gmail.com>2017-05-21 20:45:20 +0300
committerArtyom V. Poptsov <poptsov.artyom@gmail.com>2017-05-21 20:45:20 +0300
commitcb6dc775411ac12617a620fa77e763fe0fc0828e (patch)
treef2e0f32472beab8114ae3933371dbfbe6c3431b1 /tests
parentlog.c (_gssh_log_warning): New procedure (diff)
downloadguile-ssh-cb6dc775411ac12617a620fa77e763fe0fc0828e.tar.gz
channel-type.c (print_channel): Bugfix: Handle freed channels
Guile-SSH would always crash with SIGSEGV errors when tried to print a freed channel object (e.g. after calling 'close' on a channel). This patch fixes the bug. * libguile-ssh/channel-type.c (print_channel): Bugfix: Handle freed channels properly. * tests/client-server.scm ("channel-request-exec, printing a freed channel"): New test case. * NEWS: Update.
Diffstat (limited to 'tests')
-rw-r--r--tests/client-server.scm19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/client-server.scm b/tests/client-server.scm
index b56a329..702cd3a 100644
--- a/tests/client-server.scm
+++ b/tests/client-server.scm
@@ -23,6 +23,7 @@
(srfi srfi-26)
(ice-9 threads)
(ice-9 rdelim)
+ (ice-9 regex)
(rnrs bytevectors)
(rnrs io ports)
(ssh server)
@@ -585,6 +586,24 @@
(channel-request-exec channel "uname")
(channel-get-exit-status channel)))))))
+(test-assert-with-log "channel-request-exec, printing a freed channel"
+ (run-client-test
+
+ ;; server
+ (lambda (server)
+ (start-server/channel-test server))
+
+ ;; client
+ (lambda ()
+ (call-with-connected-session/channel-test
+ (lambda (session)
+ (let ((channel (make-channel session)))
+ (channel-open-session channel)
+ (channel-request-exec channel "uname")
+ (close channel)
+ (string-match "#<unknown channel \\(freed\\) [0-9a-f]+>"
+ (object->string channel))))))))
+
;; data transferring
;; FIXME: Probably these TCs can be implemented more elegantly.