Subject: Re: bin/35055: /bin/sh wait bug
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org,>
From: Wada Keiji <keiji@hiemalis.org>
List: netbsd-bugs
Date: 11/26/2006 07:30:03
The following reply was made to PR bin/35055; it has been noted by GNATS.

From: Wada Keiji <keiji@hiemalis.org>
To: gnats-bugs@NetBSD.org, dieter.r@pandora.be
Cc: keiji@hiemalis.org
Subject: Re: bin/35055: /bin/sh wait bug
Date: Sun, 26 Nov 2006 16:25:08 +0900 (JST)

 >>>>> On Sat, 25 Nov 2006 22:10:03 +0000 (UTC)
 >>>>> dieter.r@pandora.be(dieter roelants)  said:
 
 dieter.r> The following reply was made to PR bin/35055; it has been noted by GNATS.
 
 dieter.r> From: dieter roelants <dieter.r@pandora.be>
 dieter.r> To: gnats-bugs@NetBSD.org
 dieter.r> Cc: keiji@hiemalis.org
 dieter.r> Subject: Re: bin/35055: /bin/sh wait bug
 dieter.r> Date: Sat, 25 Nov 2006 23:08:58 +0100
 
 dieter.r>  > #!/bin/sh
 dieter.r>  > #!/emul/freebsd/bin/sh
 dieter.r>  > sleep 3 &
 dieter.r>  > sleep 1 &
 dieter.r>  > 
 dieter.r>  > wait %1
 dieter.r>  > r1=$?
 dieter.r>  > echo $r1
 dieter.r>  > wait %2
 dieter.r>  > r2=$?
 dieter.r>  > echo $r2
 dieter.r>  > -----
 dieter.r>  > Both r1 and r2 should be 0.
  
 dieter.r>  Why do you think so? By the time the first wait returns,
 dieter.r> the second sleep has finished and so you don't have a job 2
 dieter.r> anymore. 127 is the return value wait gives when you specify
 dieter.r> a non-existing child.
 
 I want to get second sleep(job) return value. But NetBSD's sh can't.
 FreeBSD's sh and zsh give me second sleep(job) return value.
 
 dieter.r>  > But exec this sh program, r1 is 0, r2 is 127.
  
 dieter.r>  Seems right to me...
  
 I don't know what is right. But this sh program action is different
 between NetBSD and FreeBSD.
 
 Thanks.