The early return of 'wait' is described in POSIX XCU 2.11 Signals and
Error Handling: the wait builtin shall return immediately with >128 exit
status if a trap occurs.  It is somewhat hidden as the page for 'wait'
makes no mention of this. 

To avoid this, you can try to 'wait' until the exit status is less than
128. To distinguish between traps and child processes exiting because of
signals, the trap handlers will have to do more magic.

The early termination of 'sleep' happens because sh's termination causes
the process group (formerly containing sh and sleep) to become orphaned,
and at least one process (sleep) in that process group is stopped. It is
sent a SIGHUP and a SIGCONT signal. This is done because there is noone
left to care about the process, and otherwise it would remain stopped
forever. (See _Exit() in XSH and orphaned process group in XBD 3
Definitions.)

Concludingly, there is no bug here. All the behaviour is as described in
POSIX.

-- 
Jilles Tjoelker



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to