bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: unfinished command executed when TTY is closed


From: Chet Ramey
Subject: Re: unfinished command executed when TTY is closed
Date: Wed, 17 Dec 2014 10:54:20 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:24.0) Gecko/20100101 Thunderbird/24.6.0

On 12/17/14, 8:34 AM, Jiri Kukacka wrote:

> I understand that this is due to handling EOF from closed TTY as \n, thus
> executing the command, and this is standard behavior of readline, but I
> think the problem is quite serious, so I have to fix it, and I hope that
> you would like this to have fixed as well.
> 
> So, my current suggested fix is attached bellow (created for Bash 4.2),
> thanks for any comments to it.

I would be interested in knowing what happens when the existing code is
executed.  In bash-4.2/readline-6.2, rl_getc returns READERR if read(2)
returns -1/errno!=EINTR and readline returns immediately without adding
a newline.  It may be that bash executes a command that does not end in
a newline, but in this case it doesn't seem like the code you modified
should be executed.


-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]