On 12/17/14, 3:23 PM, Greg Wooledge wrote: > On Wed, Dec 17, 2014 at 03:16:53PM -0500, Steve Simmons wrote: >> Advance apologies if I'm misunderstanding, but the described bug looks like >> reasonable behavior to me. > > It would be more reasonable for bash (or ssh, I'm not sure at what level > this handling should occur) to discard the partially typed line. Not > to execute it. > > If I open an rxvt and type "touch this_file_should_not_exist" but do not > press Enter, and then I close the terminal using my window manager's > "Close" functionality, bash does not execute the partially-typed command. > (Verified by the absence of the file in a new window.)
The timing was right: the shell received SIGHUP, it interrupted read(2), and the shell exited. This is how it happens in the vast majority of cases. What the original complaint refers to is what to do in the infrequent case when the terminal goes away, the kernel doesn't deliver a SIGHUP, and a read returns EOF instead of -1. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/