[Top][All Lists]

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

interaction of read(1) and SIGCHLD

From: Chris Lightfoot
Subject: interaction of read(1) and SIGCHLD
Date: Mon, 12 Feb 2001 17:35:06 +0000

Configuration Information [Automatically generated, do not change]:
Machine: i386
OS: Linux
Compiler: gcc
-O2 -march=i386 -mcpu=i686
uname output: Linux statu.southeast.local 2.2.17 #2 SMP Thu Oct 19 18:28:41 BST 
2000 i686 unknown

Bash Version: 1.14
Patch Level: 7


read(1) will exit immediately if the shell receives a signal, including


Consider a script like

xv fish.jpg &
echo type something:
read r

(xv could be replaced with an arbitrary program which runs in the background,
and which the user could terminate in some way.)

If xv quits while the read is waiting for input, read will terminate without
setting the variable r. This is because the call into stdio will fail, with
errno being set to EINTR.

A second bug is that read does not report the failed call into stdio.


Re-enable restartable system call semantics when setting signal handlers; the
function set_signal_handler in general.c should do this, but the code to set
the flag is #if'd out. I presume there is some good reason for this
(portability, perhaps) but it ought to work OK on Linux and many other systems.

Bash2 does not have this bug, but I have not compared the signal handling code.

reply via email to

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