Bug 57280

Summary: Empty for loops do not work in bash 2.05.8(1)-release
Product: [Retired] Red Hat Linux Reporter: Roberto Bagnara <bagnara>
Component: bashAssignee: Bernhard Rosenkraenzer <bero>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 7.2   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2001-12-09 08:52:24 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 Roberto Bagnara 2001-12-08 16:20:05 UTC
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 08:52:20 UTC
Subject: Re: Empty for loops do not work in bash 2.05.8...
Date: Sat, 08 Dec 2001 22:59:01 -0500
From: prj.edu (Paul Jarc)
To: Roberto Bagnara <bagnara.it>
CC: bug-bash, ppl-devel.it


Roberto Bagnara <bagnara.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 14:41:01 UTC
2.05a has been in rawhide for a couple of weeks.


Comment 3 H. Peter Anvin 2001-12-19 20:34:15 UTC
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.