Bug 52875

Summary: "IFS=: for foo in $FOO:bar:baz; do" doesn't work properly
Product: [Retired] Red Hat Raw Hide Reporter: Jonathan Kamens <jik>
Component: ashAssignee: Crutcher Dunnavant <crutcher>
Status: CLOSED NOTABUG QA Contact: Aaron Brown <abrown>
Severity: medium Docs Contact:
Priority: medium    
Version: 1.0   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2001-08-30 12:19:12 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 Jonathan Kamens 2001-08-30 12:19:08 UTC
Run this script:

  #!/bin/ash

  FOO="foo:bar:baz"
  IFS=:

  for ac_dir in $FOO:screlt:freeble; do
      echo $ac_dir
  done

  echo ''

  ac_dummy=$FOO:screlt:freeble
  for ac_dir in $ac_dummy; do
      echo $ac_dir
  done

You'll see this output:

  foo
  bar
  baz screlt freeble

  foo
  bar
  baz
  screlt
  freeble

That's wrong.  The first and second blocks of output should be
identical.

Bash 2.05 gets this wrong in the same way (and I've submitted a bug
report about it directly to the bash maintainers).  Bash 1.14.7 gets
it right.

Normally, I would have submitted this bug report directly to the
maintainer of ash, but I can't figure out who that is -- it isn't in
the man page or in the output of "rpm -q -i ash".

Comment 1 Jonathan Kamens 2001-08-30 13:42:19 UTC
The maintainer of bash has convinced me that this behavior is correct.