Bug 880

Summary: Incorrect parsing of command lists by /bin/sh
Product: Base System Reporter: nnd <nnd>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff
none
file.diff none

Description nnd 1995-12-09 17:50:01 UTC
	/bin/sh (ash) incorrectly parse command lists if
	any (but not first) of list components marked as 'background',
	f.e construction

	{ a; b; c & d; e; }

	parsed as if it was

	{ { a; b; c; } & d; e; }

	All other shells which I can test parse this
	as

	{ a; b; { c& } ; d; e; }

	(including /bin/sh in NetBSD-current which is
	 originated from the same sources as FreeBSD one)

Fix: Applay the patch.
(Here is the result of
How-To-Repeat: 
	Try this one:

#!/bin/sh
while true
do
	date +'1:%H:%M:%S'
	sleep 2
	exit
	ps jx &
	date +'2:%H:%M:%S'
	sleep 3
	exit
done

	(while ... do ... done is here to force using
	command-list )
Comment 1 Joerg Wunsch freebsd_committer freebsd_triage 1995-12-10 18:22:28 UTC
State Changed
From-To: open->closed

Suggested fix applied in rev 1.10 of sh/parser.c. 

This does also fix an earlier (non-GNATS) bug report by Ben Jackson 
under the subject ``bug in /bin/sh for loops''.