From haible@seagull.cdrom.com  Thu Sep 18 05:58:28 1997
Received: from seagull.cdrom.com (haible@seagull.cdrom.com [204.216.27.14])
          by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id FAA03925
          for <FreeBSD-gnats-submit@freebsd.org>; Thu, 18 Sep 1997 05:58:27 -0700 (PDT)
Received: (from haible@localhost)
          by seagull.cdrom.com (8.8.6/8.6.6) id FAA13606
          ; Thu, 18 Sep 1997 05:58:28 -0700 (PDT)
Message-Id: <199709181258.FAA13606@seagull.cdrom.com>
Date: Thu, 18 Sep 1997 05:58:28 -0700 (PDT)
From: haible@seagull.cdrom.com
Reply-To: haible@ilog.fr
To: FreeBSD-gnats-submit@freebsd.org
Cc: haible@ilog.fr
Subject: /bin/sh substitution/concatenation bug
X-Send-Pr-Version: 3.2

>Number:         4568
>Category:       bin
>Synopsis:       simple /bin/sh script produces wrong results
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Sep 18 06:00:00 PDT 1997
>Closed-Date:    Mon Sep 7 07:14:20 PDT 1998
>Last-Modified:  Mon Sep  7 07:16:29 PDT 1998
>Originator:     Bruno Haible
>Release:        FreeBSD 2.2-STABLE i386
>Organization:
ILOG
>Environment:

	

>Description:

The following /bin/sh commands

unset LINGUAS
ALL_LINGUAS="en de fr es"
NEW_LINGUAS=
for lang in ${LINGUAS=$ALL_LINGUAS}; do
  case "$ALL_LINGUAS" in
    *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
  esac
done
echo $NEW_LINGUAS

print        en de fr de fr es
instead of   en de fr es

>How-To-Repeat:

Start a sh, then input the above commands.

>Fix:
	
unknown

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->analyzed 
State-Changed-By: bde 
State-Changed-When: Fri Dec 19 12:25:50 PST 1997 
State-Changed-Why:  
I found a quick fix for this a long time ago, but don't intend 
to finish it soon. 

diff -c2 src/bin/sh/expand.c~ src/bin/sh/expand.c 
*** src/bin/sh/expand.c~	Sat Jun 21 15:50:46 1997 
--- src/bin/sh/expand.c	Sat Sep 20 00:52:37 1997 
*************** 
*** 682,685 **** 
--- 682,686 ---- 
if (subevalvar(p, var, 0, subtype, startloc, varflags)) { 
varflags &= ~VSNUL; 
+ 				ifslastp = NULL; 
goto again; 
} 
State-Changed-From-To: analyzed->closed 
State-Changed-By: bde 
State-Changed-When: Mon Sep 7 07:14:20 PDT 1998 
State-Changed-Why:  
Fixed by tegge in rev.1.23 of sh/expand.c, etc. 
>Unformatted:
