NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/46327: sh background commands have old return value

>Number:         46327
>Category:       bin
>Synopsis:       sh background commands have old return value
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Apr 12 22:10:00 +0000 2012
>Originator:     David Mandelberg
NetBSD [redacted] 5.99.63 NetBSD 5.99.63 (GENERIC) #2: Fri Feb  3 04:53:44 EST 
2012  [redacted]/netbsd-current/obj/sys/arch/i386/compile/GENERIC i386
/bin/sh doesn't set $? properly when running a command in the background. It 
should set $? to 0 if the command can be run, but instead it leaves $? 
unchanged from the return value of the last command. This especially 
problematic in this case:

#!/bin/sh -e
if false; then
  true & # aborts the script
# true; true & echo $?
# false; true & echo $?


Home | Main Index | Thread Index | Old Index