Bug 57709

Summary: for a in; do ... done broken
Product: [Retired] Red Hat Linux Reporter: H. Peter Anvin <hpa+redhat>
Component: bashAssignee: Bernhard Rosenkraenzer <bero>
Status: CLOSED RAWHIDE QA Contact:
Severity: high Docs Contact:
Priority: medium    
Version: 7.2   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2001-12-19 21:13:48 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description H. Peter Anvin 2001-12-19 20:28:59 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.6) Gecko/20011120

Description of problem:
RedHat 7.2 craps out on shell scripts that contain

for a in ; do
...
done

or

for a in $FOO; do
...
done

where $FOO is empty.  This is a common and useful construct.

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. See Description
2.
3.
	

Actual Results:  bash gives a syntax error

Expected Results:  The loop body should be skipped completely.

Additional info:

This construct was accidentally forbidden from an earlier version of the
POSIX standard; that was corrected later in the standard by Defect Report.
 It looks like this might be a case of "standards bug causing software bug."

I'm setting the Severity to "high" because of the pervasiveness of this
problem.

Comment 1 Bernhard Rosenkraenzer 2002-01-04 16:43:38 UTC
This has been fixed since 2.05a-1.
Until recently, there was no standard mandating this to work the way you
expected it to (there is now, fortunately), so there will not be an errata
update. Using the package from rawhide should not cause any problems, though.