Bug 57709 - for a in; do ... done broken
for a in; do ... done broken
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: bash (Show other bugs)
7.2
i386 Linux
medium Severity high
: ---
: ---
Assigned To: Bernhard Rosenkraenzer
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-12-19 15:28 EST by H. Peter Anvin
Modified: 2008-05-01 11:38 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-12-19 16:13:48 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description H. Peter Anvin 2001-12-19 15:28:59 EST
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 11:43:38 EST
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.

Note You need to log in before you can comment on or make changes to this bug.