Hi. I'm writing an article on network backups, and instead of using
my old ssh1 software, I decided to go with openssh all the way. I got
the hang of the openssh way of doing protocol 2 public key
authentication, but ssh is failing to terminate when a pipe is broken.
I am ssh-ing to a remote host and doing a cat or zcat of a dump file,
then on the localhost, I'm using restore to extract files from the
dump stream. With openssh-2.9p1, I can tell with strace on the
localhost that the restore process exits after restoring the file
successfully. I can see in the process list that the ssh command is
still running, though, so the restore appears to "hang".
I suspected that the ssh client was inappropriately ignoring the PIPE
signal, so I tried restoring from a cat of a local stream, and
observed that cat exited with a "Broken pipe" error. I made the
following change, commenting out the line that ignores the SIGPIPE:
nilda:2:ecashin openssh-2.9p1$ diff -u clientloop.c.dist clientloop.c
--- clientloop.c.dist Fri Apr 20 08:50:51 2001
+++ clientloop.c Sun May 20 22:55:35 2001
@@ -814,7 +814,7 @@
signal(SIGINT, signal_handler);
signal(SIGQUIT, signal_handler);
signal(SIGTERM, signal_handler);
- signal(SIGPIPE, SIG_IGN);
+ /* signal(SIGPIPE, SIG_IGN); */
if (have_pty)
signal(SIGWINCH, window_change_handler);
... and got the correct behavior:
[root at nilda test-restore]# ssh meili 'cat nildadump-boot.gz' | \
gunzip -c | restore xf - kernel.h
root at meili's password:
set owner/mode for '.'? [yn] n
Broken pipe
I noticed in the ChangeLog file that SIGPIPE and X forwarding problems
are related somehow ...
Is there any chance of this getting resolved before September? I
don't want to publish an article with scripts that will appear to
hang mysteriously. TIA! :)
--
--Ed Cashin PGP public key:
ecashin at terry.uga.edu http://www.terry.uga.edu/~ecashin/pgp/