bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

for VAR; do does not work any more on some platforms


From: bashbugreport-ta
Subject: for VAR; do does not work any more on some platforms
Date: 4 Mar 2006 11:20:23 -0000

Configuration Information [Automatically generated, do not change]:
Machine: i386
OS: freebsd6.0
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i386' 
-DCONF_OSTYPE='freebsd6.0' -DCONF_MACHTYPE='i386-unknown-freebsd6.0' 
-DCONF_VENDOR='unknown' -DLOCALEDIR='/tmp/bash/share/locale' -DPACKAGE='bash' 
-DSHELL  -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib -I./lib/intl 
-I/tmp/bash-3.1/lib/intl  -g -O2
uname output: FreeBSD katsuragi.div0.ccc-offenbach.org 6.0-STABLE FreeBSD 
6.0-STABLE #1: Sat Jan 28 12:11:17 CET 2006     
address@hidden:/usr/src/sys/i386/compile/DIV0_KERNEL  i386
Machine Type: i386-unknown-freebsd6.0

Bash Version: 3.1
Patch Level: 11
Release Status: release

Description:

In other shells (like bash 3.0, bash 2.x, zsh, dash),

    for VARIABLE; do ...; done

is equivalent to

    for VARIABLE in "$@"; do ...; done

GNU autoconf also relies on this fact at many points:

    ac_prev=
    for ac_option
    do
      # If the previous option needs an argument, assign it.
      if test -n "$ac_prev"; then
        eval "$ac_prev=\$ac_option"
        ac_prev=
        continue
      fi

      ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`

The problem becomes quite visible in that configure scripts seem to ignore
parameters line --prefix. libtool does not work either...

          mode=link
          for arg
          do
            case $arg in
            -c)
               mode=compile

Too bad that this does not work in bash 3.1 any more (3.1 without the patches
is also affected).

It at least happens on FreeBSD/x86 and _did_ happen on Gentoo/PPC but
apparently got fixed. On some other platforms like FC4/x86 it does NOT happen.

Repeat-By:
    address@hidden /tmp/bash/bin $ set -- a b c
    address@hidden /tmp/bash/bin $ echo "$@"
    a b c
    address@hidden /tmp/bash/bin $ for V; do echo $V; done

    address@hidden /tmp/bash/bin $ for V in "$@"; do echo $V; done
    a
    b
    c
    address@hidden /tmp/bash/bin $ help for
    for: for NAME [in WORDS ... ;] do COMMANDS; done
         The `for' loop executes a sequence of commands for each member in a
        list of items.  If `in WORDS ...;' is not present, then `in "$@"' is
        assumed.  For each element in WORDS, NAME is set to that element, and
        the COMMANDS are executed.
    for ((: for (( exp1; exp2; exp3 )); do COMMANDS; done
         Equivalent to
            (( EXP1 ))
            while (( EXP2 )); do
                    COMMANDS
                    (( EXP3 ))
            done
        EXP1, EXP2, and EXP3 are arithmetic expressions.  If any expression is
        omitted, it behaves as if it evaluates to 1.
        [Describe the sequence of events that causes the problem
        to occur.]
    address@hidden /tmp/bash/bin $ set -xv
    address@hidden /tmp/bash/bin $ for X; do echo $X; done 
    for X; do echo $X; done
    + for X in '""'
    + echo






reply via email to

[Prev in Thread] Current Thread [Next in Thread]