patch to fix non-echo tty on scp SIGINT

Adam Wiggins hiro at dusk.org
Wed Dec 15 20:40:20 EST 2004


On Wed, Dec 08, 2004 at 07:18:54PM +1100, Darren Tucker wrote:
> Adam Wiggins wrote:
> >All makes perfect sense, but the patch doesn't seem to change the
> >behavior on my system (Linux, kernel 2.6, KDE 3.3 terminal).  Just for
> >kicks I tried it on other terminals (xterm, gnome-terminal) on the same
> >system - all give the same result.
> 
> I'm not able to reproduce that behaviour with the patch applied: I 
> tested PuTTY, xterm and gnome-terminal (Linux 2.4.x) and PuTTY and xterm 
> (Linux 2.6.x) and they all correctly restored the terminal echo mode.

Are they all TERM=xterm?

> Could you please re-test with, say, xterm, and if it still exhibits the 
> problem, run the scp under strace -f and post the last 50 or so lines?

Using strace with the -o option causes the echo to restore for some
reason.  So does TERM=linux.  Problem shows only when running strace
with no -o, cut-n-pasting the display into a file instead.

Attached files for each situation:

trace1.log: strace -o trace.log -f ./scp ... [echo restored]
trace2.log: strace -f ./scp ... [echo not restored]
trace3.log: TERM=linux strace -f ./scp ... [echo restored]

-------------- next part --------------
30237 select(4, [3], NULL, NULL, NULL)  = 1 (in [3])
30237 read(3, "\265\v\335\326\313\232]@N\245\274=\204\314\360\370\202"..., 8192) = 64
30237 write(3, "\32\f\311\373zn\360\316\231-J)_\251\34\344\242+\26|\212"..., 240) = 240
30237 select(4, [3], NULL, NULL, NULL)  = 1 (in [3])
30237 read(3, "\3J\300=Qr\236}\334\f\245\2015\367\316\4O\36\16af\235g"..., 8192) = 64
30237 stat64("/home/adam/.ssh/identity", 0xfef3e950) = -1 ENOENT (No such file or directory)
30237 stat64("/home/adam/.ssh/id_dsa", 0xfef3e950) = -1 ENOENT (No such file or directory)
30237 open("/dev/tty", O_RDWR|O_LARGEFILE) = 5
30237 close(5)                          = 0
30237 open("/dev/tty", O_RDWR|O_LARGEFILE) = 5
30237 rt_sigaction(SIGALRM, {0x806d334, [], SA_RESTORER, 0x45ca48}, {SIG_DFL}, 8) = 0
30237 rt_sigaction(SIGHUP, {0x806d334, [], SA_RESTORER, 0x45ca48}, {SIG_DFL}, 8) = 0
30237 rt_sigaction(SIGINT, {0x806d334, [], SA_RESTORER, 0x45ca48}, {SIG_DFL}, 8) = 0
30237 rt_sigaction(SIGPIPE, {0x806d334, [], SA_RESTORER, 0x45ca48}, {SIG_IGN}, 8) = 0
30237 rt_sigaction(SIGQUIT, {0x806d334, [], SA_RESTORER, 0x45ca48}, {SIG_DFL}, 8) = 0
30237 rt_sigaction(SIGTERM, {0x806d334, [], SA_RESTORER, 0x45ca48}, {SIG_DFL}, 8) = 0
30237 rt_sigaction(SIGTSTP, {0x806d334, [], SA_RESTORER, 0x45ca48}, {SIG_DFL}, 8) = 0
30237 rt_sigaction(SIGTTIN, {0x806d334, [], SA_RESTORER, 0x45ca48}, {SIG_DFL}, 8) = 0
30237 rt_sigaction(SIGTTOU, {0x806d334, [], SA_RESTORER, 0x45ca48}, {SIG_DFL}, 8) = 0
30237 ioctl(5, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
30237 ioctl(5, SNDCTL_TMR_CONTINUE or TCSETSF, {B38400 opost isig icanon -echo ...}) = 0
30237 write(5, "adam at main.oversee.net\'s password"..., 34) = 34
30237 read(5,  <unfinished ...>
30236 <... read resumed> 0xfef30780, 1) = ? ERESTARTSYS (To be restarted)
30237 <... read resumed> 0xfef3dbcf, 1) = ? ERESTARTSYS (To be restarted)
30236 --- SIGINT (Interrupt) @ 0 (0) ---
30237 --- SIGINT (Interrupt) @ 0 (0) ---
30236 kill(30237, SIGINT <unfinished ...>
30237 sigreturn( <unfinished ...>
30236 <... kill resumed> )              = 0
30237 <... sigreturn resumed> )         = ? (mask now [])
30236 waitpid(30237,  <unfinished ...>
30237 --- SIGINT (Interrupt) @ 0 (0) ---
30237 sigreturn()                       = ? (mask now [])
30237 write(5, "\n", 1)                 = 1
30237 ioctl(5, SNDCTL_TMR_CONTINUE or TCSETSF, {B38400 opost isig icanon echo ...}) = 0
30237 rt_sigaction(SIGALRM, {SIG_DFL}, NULL, 8) = 0
30237 rt_sigaction(SIGHUP, {SIG_DFL}, NULL, 8) = 0
30237 rt_sigaction(SIGINT, {SIG_DFL}, NULL, 8) = 0
30237 rt_sigaction(SIGQUIT, {SIG_DFL}, NULL, 8) = 0
30237 rt_sigaction(SIGPIPE, {SIG_IGN}, NULL, 8) = 0
30237 rt_sigaction(SIGTERM, {SIG_DFL}, NULL, 8) = 0
30237 rt_sigaction(SIGTSTP, {SIG_DFL}, NULL, 8) = 0
30237 rt_sigaction(SIGTTIN, {SIG_DFL}, NULL, 8) = 0
30237 close(5)                          = 0
30237 kill(30237, SIGINT)               = 0
30237 --- SIGINT (Interrupt) @ 0 (0) ---
30236 <... waitpid resumed> NULL, 0)    = 30237
30236 --- SIGCHLD (Child exited) @ 0 (0) ---
30236 exit_group(1)                     = ?
-------------- next part --------------
[pid 30244] read(4, "orodruin,64.32.131.193 ssh-rsa A"..., 4096) = 4096
[pid 30244] read(4, "QBim8LWRK+hNRiwxrhqKPpc=\ntrancel"..., 4096) = 4096
[pid 30244] read(4, "zWszJkV+KGwvzYEMoU6/azqxXalLWxJK"..., 4096) = 4096
[pid 30244] read(4, "3wfLsEm88aDvosOetFNe/CsThU9Rqhn5"..., 4096) = 1023
[pid 30244] close(4)                    = 0
[pid 30244] munmap(0xf6fff000, 4096)    = 0
[pid 30244] open("/home/adam/.ssh/known_hosts", O_RDONLY|O_LARGEFILE) = 4
[pid 30244] fstat64(4, {st_mode=S_IFREG|0644, st_size=13311, ...}) = 0
[pid 30244] mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xf6fff000
[pid 30244] read(4, "orodruin,64.32.131.193 ssh-rsa A"..., 4096) = 4096
[pid 30244] read(4, "QBim8LWRK+hNRiwxrhqKPpc=\ntrancel"..., 4096) = 4096
[pid 30244] read(4, "zWszJkV+KGwvzYEMoU6/azqxXalLWxJK"..., 4096) = 4096
[pid 30244] read(4, "3wfLsEm88aDvosOetFNe/CsThU9Rqhn5"..., 4096) = 1023
[pid 30244] close(4)                    = 0
[pid 30244] munmap(0xf6fff000, 4096)    = 0
[pid 30244] write(3, "\0\0\0\f\n\25\0\0\0\0\0\0\0\0\0\0", 16) = 16
[pid 30244] write(3, "\34\\\366\303VJ\231\305\312\232\24~y\300\202\377\356N\224"..., 48) = 48
[pid 30244] select(4, [3], NULL, NULL, NULL) = 1 (in [3])
[pid 30244] read(3, "\373\236\7\304J\306\1\363x|`\340\206n\264+g\207\347\211"..., 8192) = 48
[pid 30244] socket(PF_FILE, SOCK_STREAM, 0) = 4
[pid 30244] fcntl64(4, F_SETFD, FD_CLOEXEC) = 0
[pid 30244] connect(4, {sa_family=AF_FILE, path="/tmp/ssh-cMKwdW3780/agent.3780"}, 110) = 0
[pid 30244] write(4, "\0\0\0\1", 4)     = 4
[pid 30244] write(4, "\v", 1)           = 1
[pid 30244] read(4, "\0\0\0\270", 4)    = 4
[pid 30244] read(4, "\f\0\0\0\1\0\0\0\225\0\0\0\7ssh-rsa\0\0\0\1#\0\0\0\201"..., 184) = 184
[pid 30244] write(3, "\322\6If{\354\351M\275\322$\276\1\2442.]\r6\340\335\260"..., 64) = 64
[pid 30244] select(4, [3], NULL, NULL, NULL) = 1 (in [3])
[pid 30244] read(3, "\34\3578\305\330~JX\245q\35b\235\214\22!@\214pa\3419\253"..., 8192) = 64
[pid 30244] write(3, "\367\365\310\23Z\322\1\347\0210(\265\374^qj\301\221\264"..., 240) = 240
[pid 30244] select(4, [3], NULL, NULL, NULL) = 1 (in [3])
[pid 30244] read(3, "\321j\17\6#\341\377\247\273\24\341=\337`\304A\36\370\177"..., 8192) = 64
[pid 30244] stat64("/home/adam/.ssh/identity", 0xfeec4660) = -1 ENOENT (No such file or directory)
[pid 30244] stat64("/home/adam/.ssh/id_dsa", 0xfeec4660) = -1 ENOENT (No such file or directory)
[pid 30244] open("/dev/tty", O_RDWR|O_LARGEFILE) = 5
[pid 30244] close(5)                    = 0
[pid 30244] open("/dev/tty", O_RDWR|O_LARGEFILE) = 5
[pid 30244] rt_sigaction(SIGALRM, {0x806d334, [], SA_RESTORER, 0x45ca48}, {SIG_DFL}, 8) = 0
[pid 30244] rt_sigaction(SIGHUP, {0x806d334, [], SA_RESTORER, 0x45ca48}, {SIG_DFL}, 8) = 0
[pid 30244] rt_sigaction(SIGINT, {0x806d334, [], SA_RESTORER, 0x45ca48}, {SIG_DFL}, 8) = 0
[pid 30244] rt_sigaction(SIGPIPE, {0x806d334, [], SA_RESTORER, 0x45ca48}, {SIG_IGN}, 8) = 0
[pid 30244] rt_sigaction(SIGQUIT, {0x806d334, [], SA_RESTORER, 0x45ca48}, {SIG_DFL}, 8) = 0
[pid 30244] rt_sigaction(SIGTERM, {0x806d334, [], SA_RESTORER, 0x45ca48}, {SIG_DFL}, 8) = 0
[pid 30244] rt_sigaction(SIGTSTP, {0x806d334, [], SA_RESTORER, 0x45ca48}, {SIG_DFL}, 8) = 0
[pid 30244] rt_sigaction(SIGTTIN, {0x806d334, [], SA_RESTORER, 0x45ca48}, {SIG_DFL}, 8) = 0
[pid 30244] rt_sigaction(SIGTTOU, {0x806d334, [], SA_RESTORER, 0x45ca48}, {SIG_DFL}, 8) = 0
[pid 30244] ioctl(5, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
[pid 30244] ioctl(5, SNDCTL_TMR_CONTINUE or TCSETSF, {B38400 opost isig icanon -echo ...}) = 0
[pid 30244] write(5, "adam at main.oversee.net\'s password"..., 34adam at main.oversee.net's password: ) = 34
[pid 30244] read(5,  <unfinished ...>
Process 30244 detached


-------------- next part --------------
[pid 30254] read(4, "orodruin,64.32.131.193 ssh-rsa A"..., 4096) = 4096
[pid 30254] read(4, "QBim8LWRK+hNRiwxrhqKPpc=\ntrancel"..., 4096) = 4096
[pid 30254] read(4, "zWszJkV+KGwvzYEMoU6/azqxXalLWxJK"..., 4096) = 4096
[pid 30254] read(4, "3wfLsEm88aDvosOetFNe/CsThU9Rqhn5"..., 4096) = 1023
[pid 30254] close(4)                    = 0
[pid 30254] munmap(0xf6fff000, 4096)    = 0
[pid 30254] open("/home/adam/.ssh/known_hosts", O_RDONLY|O_LARGEFILE) = 4
[pid 30254] fstat64(4, {st_mode=S_IFREG|0644, st_size=13311, ...}) = 0
[pid 30254] mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xf6fff000
[pid 30254] read(4, "orodruin,64.32.131.193 ssh-rsa A"..., 4096) = 4096
[pid 30254] read(4, "QBim8LWRK+hNRiwxrhqKPpc=\ntrancel"..., 4096) = 4096
[pid 30254] read(4, "zWszJkV+KGwvzYEMoU6/azqxXalLWxJK"..., 4096) = 4096
[pid 30254] read(4, "3wfLsEm88aDvosOetFNe/CsThU9Rqhn5"..., 4096) = 1023
[pid 30254] close(4)                    = 0
[pid 30254] munmap(0xf6fff000, 4096)    = 0
[pid 30254] write(3, "\0\0\0\f\n\25\0\0\0\0\0\0\0\0\0\0", 16) = 16
[pid 30254] write(3, "[\326\370\354\365<m\3673\344[\245K\255\311\340E;l\'\312"..., 48) = 48
[pid 30254] select(4, [3], NULL, NULL, NULL) = 1 (in [3])
[pid 30254] read(3, "2n\207\257\207sVV\'\326\232\vh\310.\264\326@\247*\246\10"..., 8192) = 48
[pid 30254] socket(PF_FILE, SOCK_STREAM, 0) = 4
[pid 30254] fcntl64(4, F_SETFD, FD_CLOEXEC) = 0
[pid 30254] connect(4, {sa_family=AF_FILE, path="/tmp/ssh-cMKwdW3780/agent.3780"}, 110) = 0
[pid 30254] write(4, "\0\0\0\1", 4)     = 4
[pid 30254] write(4, "\v", 1)           = 1
[pid 30254] read(4, "\0\0\0\270", 4)    = 4
[pid 30254] read(4, "\f\0\0\0\1\0\0\0\225\0\0\0\7ssh-rsa\0\0\0\1#\0\0\0\201"..., 184) = 184
[pid 30254] write(3, "n\20Q\3033V\342(\360\264\327f#\335\360\200&\236\234\n\270"..., 64) = 64
[pid 30254] select(4, [3], NULL, NULL, NULL) = 1 (in [3])
[pid 30254] read(3, "\23\342\257\363\226\10\231\242\244\224\302\300\22\\4\321"..., 8192) = 64
[pid 30254] write(3, "x\nF\340\220\v\320SM\225\265\325\10\376\215\322\271d6\363"..., 240) = 240
[pid 30254] select(4, [3], NULL, NULL, NULL) = 1 (in [3])
[pid 30254] read(3, "\323\307\207\230N\275\265q\227\342.\202\36\250\4\276\364"..., 8192) = 64
[pid 30254] stat64("/home/adam/.ssh/identity", 0xfefbaf00) = -1 ENOENT (No such file or directory)
[pid 30254] stat64("/home/adam/.ssh/id_dsa", 0xfefbaf00) = -1 ENOENT (No such file or directory)
[pid 30254] open("/dev/tty", O_RDWR|O_LARGEFILE) = 5
[pid 30254] close(5)                    = 0
[pid 30254] open("/dev/tty", O_RDWR|O_LARGEFILE) = 5
[pid 30254] rt_sigaction(SIGALRM, {0x806d334, [], SA_RESTORER, 0x45ca48}, {SIG_DFL}, 8) = 0
[pid 30254] rt_sigaction(SIGHUP, {0x806d334, [], SA_RESTORER, 0x45ca48}, {SIG_DFL}, 8) = 0
[pid 30254] rt_sigaction(SIGINT, {0x806d334, [], SA_RESTORER, 0x45ca48}, {SIG_DFL}, 8) = 0
[pid 30254] rt_sigaction(SIGPIPE, {0x806d334, [], SA_RESTORER, 0x45ca48}, {SIG_IGN}, 8) = 0
[pid 30254] rt_sigaction(SIGQUIT, {0x806d334, [], SA_RESTORER, 0x45ca48}, {SIG_DFL}, 8) = 0
[pid 30254] rt_sigaction(SIGTERM, {0x806d334, [], SA_RESTORER, 0x45ca48}, {SIG_DFL}, 8) = 0
[pid 30254] rt_sigaction(SIGTSTP, {0x806d334, [], SA_RESTORER, 0x45ca48}, {SIG_DFL}, 8) = 0
[pid 30254] rt_sigaction(SIGTTIN, {0x806d334, [], SA_RESTORER, 0x45ca48}, {SIG_DFL}, 8) = 0
[pid 30254] rt_sigaction(SIGTTOU, {0x806d334, [], SA_RESTORER, 0x45ca48}, {SIG_DFL}, 8) = 0
[pid 30254] ioctl(5, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
[pid 30254] ioctl(5, SNDCTL_TMR_CONTINUE or TCSETSF, {B38400 opost isig icanon -echo ...}) = 0
[pid 30254] write(5, "adam at main.oversee.net\'s password"..., 34adam at main.oversee.net's password: ) = 34
[pid 30254] read(5,  <unfinished ...>
Process 30254 detached



More information about the openssh-unix-dev mailing list