From owner-freebsd-bugs Tue Dec 9 18:10:06 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id SAA01347 for bugs-outgoing; Tue, 9 Dec 1997 18:10:06 -0800 (PST) (envelope-from owner-freebsd-bugs) Received: (from gnats@localhost) by hub.freebsd.org (8.8.7/8.8.7) id SAA01336; Tue, 9 Dec 1997 18:10:02 -0800 (PST) (envelope-from gnats) Resent-Date: Tue, 9 Dec 1997 18:10:02 -0800 (PST) Resent-Message-Id: <199712100210.SAA01336@hub.freebsd.org> Resent-From: gnats (GNATS Management) Resent-To: freebsd-bugs Resent-Reply-To: FreeBSD-gnats@FreeBSD.ORG, tom@sdf.com Received: from shell.uniserve.com (shell.uniserve.com [204.244.210.252]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id SAA00871 for ; Tue, 9 Dec 1997 18:02:03 -0800 (PST) (envelope-from tom@uniserve.com) Received: (from tom@localhost) by shell.uniserve.com (8.8.5/8.8.5) id SAA14215; Tue, 9 Dec 1997 18:01:52 -0800 (PST) Message-Id: <199712100201.SAA14215@shell.uniserve.com> Date: Tue, 9 Dec 1997 18:01:52 -0800 (PST) From: tom@sdf.com Reply-To: tom@sdf.com To: FreeBSD-gnats-submit@FreeBSD.ORG X-Send-Pr-Version: 3.2 Subject: bin/5263: sh bug (with example) Sender: owner-freebsd-bugs@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk >Number: 5263 >Category: bin >Synopsis: sh bug (with example) >Confidential: no >Severity: non-critical >Priority: high >Responsible: freebsd-bugs >State: open >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Dec 9 18:10:01 PST 1997 >Last-Modified: >Originator: Tom >Organization: SDF Systems >Release: FreeBSD 2.2.5-STABLE i386 >Environment: FreeBSD 2.2.5-STABLE i386 >Description: sh has a problem with joining lists within a "for x in list1:list2" construct. Basically, the last element of list1 gets attached to the remaining elements of list2, and this thing gets returned as single item. >How-To-Repeat: Sample script: #! /bin/sh PATH=/bin:/usr/bin:/sbin # The whitespace below is a space followed by a tab IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" for ac_dir in $PATH:/usr/local/bin$ac_dummy; do echo "ac_dir is $ac_dir" done When run under /bin/sh this script produces: ac_dir is /bin ac_dir is /usr/bin ac_dir is /sbin:/usr/local/bin When run under bash this script produces: ac_dir is /bin ac_dir is /usr/bin ac_dir is /sbin ac_dir is /usr/local/bin This is a big problem for ports, as auto-conf configure scripts often use for loops like this to scan for certain binaries. >Fix: >Audit-Trail: >Unformatted: