Subject: bin/6213: /bin/sh mishandles trapped signals during "read"
To: None <>
From: Urban Boquist <>
List: netbsd-bugs
Date: 09/29/1998 22:58:31
>Number:         6213
>Category:       bin
>Synopsis:       /bin/sh does not handle a trapped signal correctly
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Sep 29 14:05:00 1998
>Originator:     Urban Boquist
Dept. of CS, Chalmers, Sweden
>Release:        NetBSD-current
System: NetBSD 1.3H NetBSD 1.3H (DOGBERT) #0: Mon Sep 21 12:51:33 CEST 1998 i386

If you "trap" SIGTERM and then execute the sh builtin "read", the shell will
not react to SIGTERM until the "read" is done (you have to press RETURN).

Run this shell script:
trap foo 15
foo () { echo foo; exit 0; }
(sleep 5; kill $$; echo killed) &
echo waiting...
read bar

After 5 seconds it will print "killed", but not exit or print "foo" until
RETURN is pressed.

Btw, the same happens on a system built before the recent signal changes.

No idea, sorry.