Bug 57709 - for a in; do ... done broken
Summary: for a in; do ... done broken
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: bash
Version: 7.2
Hardware: i386
OS: Linux
medium
high
Target Milestone: ---
Assignee: Bernhard Rosenkraenzer
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-12-19 20:28 UTC by H. Peter Anvin
Modified: 2008-05-01 15:38 UTC (History)
0 users

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2001-12-19 21:13:48 UTC
Embargoed:


Attachments (Terms of Use)

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.


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