Package: bash
Version: 4.1-1
Severity: normal

I've discovered a situation in which "wait $pid" exits before process
$pid has terminated.  Here's a script to reproduce it:

#!/bin/sh
#
# This script illustrates an anomaly when trapping SIGTSTP and waiting
# for a child to exit.  When the suspend key is pressed, the background
# process is stopped (to see this run ps -lp <pid> in another window).
# Then, when the TSTP handler finishes (after you press the Enter key),
# the background process is continued (why?) and the wait command exits
# (why?).  This happens in both bash and dash, but I don't see anything
# in the POSIX spec to support this behavior.  I expect the background
# process to remain stopped.  Regardless of whether the background
# process stays stopped or continues, I expect the wait command to keep
# waiting until the background process terminates.
#
trap 'read junk' TSTP
sleep 60 &
pid=$!
echo background process ID: $pid
wait $pid
echo wait exited with status=$?

-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (900, 'testing'), (800, 'stable'), (600, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.26-2-686 (SMP w/1 CPU core)
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/bash

Versions of packages bash depends on:
ii  base-files                5.0.0          Debian base system miscellaneous f
ii  dash                      0.5.5.1-3      POSIX-compliant shell
ii  debianutils               3.2            Miscellaneous utilities specific t
ii  libc6                     2.9-12         GNU C Library: Shared libraries
ii  libncurses5               5.7+20090803-2 shared libraries for terminal hand

Versions of packages bash recommends:
ii  bash-completion               1:1.0-3    programmable completion for the ba

Versions of packages bash suggests:
pn  bash-doc                      <none>     (no description available)

-- no debconf information



-- 
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