bug-bash
[Top][All Lists]
Advanced

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

Re: bash --noediting killed by O_NONBLOCK


From: Chet Ramey
Subject: Re: bash --noediting killed by O_NONBLOCK
Date: Tue, 01 Jul 2008 12:07:33 -0400
User-agent: Thunderbird 2.0.0.14 (Macintosh/20080421)

Glynn Clements wrote:
Configuration Information [Automatically generated, do not change]:
Machine: i686
OS: linux-gnu
Compiler: i686-pc-linux-gnu-gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu' 
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL 
-DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib   -g -O2 -mtune=pentium-m -pipe
uname output: Linux cerise 2.6.24.3 #2 SMP Thu Mar 27 10:43:06 GMT 2008 i686 
GNU/Linux
Machine Type: i686-pc-linux-gnu

Bash Version: 3.2
Patch Level: 33
Release Status: release

Description:

If --noediting is used (e.g. for use with Emacs' shell-mode), and a
program run from bash sets O_NONBLOCK on bash's stdin, bash reads and
executes random garbags until it eventually segfaults.

Repeat-By:

bash --noediting
<any program which leaves the descriptor in non-blocking mode>

Fix:

The attached patch appears to fix the specific problem. However, I'm
still unclear as to how the original problem occurs. It looks as if
the errno != EINTR check should result in a busy-wait.

Thanks for the patch.  There won't be a busy-wait if nothing's been
read into the local buffer:  local_bufused == 0 means that the function
will return EOF.

Chet

--
``The lyf so short, the craft so long to lerne.'' - Chaucer

Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/




reply via email to

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