Bug 57280 - Empty for loops do not work in bash 2.05.8(1)-release
Empty for loops do not work in bash 2.05.8(1)-release
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: bash (Show other bugs)
7.2
All Linux
medium Severity medium
: ---
: ---
Assigned To: Bernhard Rosenkraenzer
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-12-08 11:20 EST by Roberto Bagnara
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-09 03:52:24 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Roberto Bagnara 2001-12-08 11:20:05 EST
From Bugzilla Helper:
User-Agent: Mozilla/4.78 [en] (X11; U; Linux 2.4.13 i686)

Description of problem:
I just upgraded one of my systems
from Red Hat 7.1 to 7.2 and suddenly all my automake-generated
Makefile's stopped working.  The problem can be easily exemplified
as follows:

$ bash --version
GNU bash, version 2.05.8(1)-release (i386-redhat-linux-gnu)
Copyright 2000 Free Software Foundation, Inc.
$ for k in ; do echo flip; done
bash: syntax error near unexpected token `;'
$

On a Red Hat 7.1 system I have, instead,

$ bash --version
GNU bash, version 2.04.21(1)-release (i386-redhat-linux-gnu)
Copyright 1999 Free Software Foundation, Inc.
$ for k in ; do echo flip; done
$

i.e., the loop body is executed zero times.
According to the bash FAQ available at
ftp://ftp.cwru.edu/pub/bash/FAQ and especially question

  E7) What about empty for loops in Makefiles?

whose answer says, among other things,

  In versions of bash before bash-2.05a, this was a syntax error.  If the
  reserved word `in' was present, a word must follow it before the
semicolon
  or newline.  The language in the manual page referring to the list of
words
  being empty referred to the list after it is expanded.  These versions of
  bash required that there be at least one word following the `in' when the
  construct was parsed.

  ...

  The latest drafts of the updated POSIX standard have changed this:  the
  word list is no longer required.  Bash versions 2.05a and later accept
  the new syntax.

This, however, does not explain why version "2.04.21(1)-release" 
did not exhibit the problem.

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


How reproducible:
Always

Steps to Reproduce:
1. for k in ; do echo flip; done
2.
3.
	

Actual Results:  bash: syntax error near unexpected token `;'


Expected Results:  No error should have been given and the loop body should
be executed zero times.


Additional info:
Comment 1 Roberto Bagnara 2001-12-09 03:52:20 EST
Subject: Re: Empty for loops do not work in bash 2.05.8...
Date: Sat, 08 Dec 2001 22:59:01 -0500
From: prj@po.cwru.edu (Paul Jarc)
To: Roberto Bagnara <bagnara@cs.unipr.it>
CC: bug-bash@gnu.org, ppl-devel@cs.unipr.it


Roberto Bagnara <bagnara@cs.unipr.it> wrote:
> So, assuming that version "2.05.8(1)-release" is after "bash-2.05a"

2.05a is the newest version of GNU bash.  2.05.8(1)-release is
something RedHat made out of, I assume, 2.05, the previous version.
If you have a problem with GNU's bash, report it here.  If you have a
problem with RedHat's bash, report it to RedHat.  If they introduced
the problem, they can fx it; if they find that the problem present in
the original GNU release, they can report it here, or notify you so
you can do so.

> Is there any workaround apart from downgrading bash?

Install GNU's bash 2.05a.


paul
Comment 2 Bernhard Rosenkraenzer 2001-12-13 09:41:01 EST
2.05a has been in rawhide for a couple of weeks.
Comment 3 H. Peter Anvin 2001-12-19 15:34:15 EST
I would highly suggest making an update available for RH7.2.  This bug is making
RH7.2 useless for a site which has to maintain large amounts of shell scripts.

This is a high severity erratum.

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