Date: Tue, 9 Dec 1997 18:01:52 -0800 (PST) From: tom@sdf.com To: FreeBSD-gnats-submit@FreeBSD.ORG Subject: bin/5263: sh bug (with example) Message-ID: <199712100201.SAA14215@shell.uniserve.com> Resent-Message-ID: <199712100210.SAA01336@hub.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199712100201.SAA14215>