Subject: bin/228: /bin/sh handles '&' incorrectly within if-then-fi
To: None <gnats-admin>
From: Bob Kemp <rsk@allegory.demon.co.uk>
List: netbsd-bugs
Date: 04/20/1994 14:05:06
>Number:         228
>Category:       bin
>Synopsis:       /bin/sh handles '&' incorrectly within if-then-fi
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    gnats-admin (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Apr 20 14:05:05 1994
>Originator:     Bob Kemp
>Organization:
	Home PC
>Release:        -current 05Mar94
>Environment:
	
System: NetBSD allegory 0.9a ALLEGORY#0 i386


>Description:

	In an ash script, if there are multiple background commands (&)_
	within an if-then-fi, the second and subsequent commands are run
	ahead of the rest.  This is best understood by running the following
	code.

	#!/bin/sh
	if true
	then
		sleep 5
		echo Should wait 5 and then echo -- 1 &
		echo Should wait 5 and then echo -- 2 &
		echo Should wait 5 and then echo -- 3 &
		echo Should wait 5 and then echo -- 4 &
	fi


>How-To-Repeat:

	Run the above script and you will see 2, 3, 4 and 5
	echo immediately, whereas 1 will wait the full 5 seconds.

>Fix:
>Audit-Trail:
>Unformatted:


------------------------------------------------------------------------------