Subject: bin/35055: /bin/sh wait bug
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: None <keiji@hiemalis.org>
List: netbsd-bugs
Date: 11/15/2006 04:00:01
>Number:         35055
>Category:       bin
>Synopsis:       /bin/sh wait bug
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Nov 15 04:00:00 +0000 2006
>Originator:     Wada Keiji
>Release:        3.99.15
>Organization:
>Environment:
NetBSD poker 3.99.15 NetBSD 3.99.15 (POKER-PCMCIA) #6: Sat Dec 31 03:03:42 JST 2005  root@poker:/home/NetBSD/src/sys/arch/i386/compile/POKER-PCMCIA i386
>Description:
please exec sh program
-----
#!/bin/sh
#!/emul/freebsd/bin/sh
sleep 3 &
sleep 1 &

wait %1
r1=$?
echo $r1
wait %2
r2=$?
echo $r2
-----
Both r1 and r2 should be 0.
But exec this sh program, r1 is 0, r2 is 127.

>How-To-Repeat:
exec sh program
#!/bin/sh
#!/emul/freebsd/bin/sh
sleep 3 &
sleep 1 &

wait %1
r1=$?
echo $r1
wait %2
r2=$?
echo $r2
>Fix: