Bug 57280 - Empty for loops do not work in bash 2.05.8(1)-release
Summary: Empty for loops do not work in bash 2.05.8(1)-release
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: bash
Version: 7.2
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Bernhard Rosenkraenzer
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2001-12-08 16:20 UTC by Roberto Bagnara
Modified: 2008-05-01 15:38 UTC (History)
0 users

Clone Of:
Last Closed: 2001-12-09 08:52:24 UTC

Attachments (Terms of Use)

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
  or newline.  The language in the manual page referring to the list of
  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:

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

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@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.


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.

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