Created attachment 1844 [details] remove progress meter signal handlers in stop_progress_meter sftp, when built with libedit (editline) support enabled, may exit unexpectedly if you resize the terminal window after a transfer. This is with libedit 20100424-3.0 (which fixed the resize problem in libedit 20090923), but this appears to be a separate bug in sftp. sftp handles any number of terminal resizes before a transfer, but after a file transfer, it exits after 2 consecutive terminal resizes. I think the problem may due to signal handlers (one for SIGWINCH, the terminal resize signal) being set up in the progress meter code, but these don't seem to be removed on disposing of the progress meter. Well, at least the patch appears to fix the problem for me.
I can't replicate this on either OpenBSD of Ubuntu Lucid. Your patch makes sense, but I'd like to see how it crashes before applying it. Is there any change you could capture a debug/gdb trace of it crashing?
Created attachment 1887 [details] strace, sftp closing after resizes The trouble is sftp doesn't crash, it exits normally. I need to work out where to put some useful breakpoints or something. I've attached the output from strace, with several resizes before a transfer, then a transfer, and sftp closing after some more resizes. It's probably not very helpful.
I can reproduce it locally (fedora 10). I'd like to understand to root cause first before making any changes though.
Created attachment 1904 [details] fix for libedit I now think this is more likely to be a libedit bug, since when running sftp, libedit's sig_handler() function only gets called on the first SIGWINCH during a read, any more seem to be ignored. Fixing that seems to solve the problem (although I don't really know why it causes sftp to close only after a progress bar has been shown). I've emailed the libedit maintainers with my new findings.
libedit is now fixed in cvs, so this isn't an sftp bug.
With the release of OpenSSH 5.6p1 this bug is now considered closed. If you have further problems please reopen or file a new bug as appropriate.