From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18144 invoked from network); 15 May 2000 15:03:42 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 15 May 2000 15:03:42 -0000 Received: (qmail 12274 invoked by alias); 15 May 2000 15:03:25 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 11381 Received: (qmail 12267 invoked from network); 15 May 2000 15:03:25 -0000 Date: Mon, 15 May 2000 16:02:57 +0100 From: Peter Stephenson Subject: PATCH: Re: ${-str} In-reply-to: "Your message of Mon, 15 May 2000 11:28:52 +0200." <200005150928.LAA14829@beta.informatik.hu-berlin.de> To: zsh-workers@sunsite.auc.dk (Zsh hackers list) Message-id: <0FUL00JG9WGWSH@la-la.cambridgesiliconradio.com> Content-transfer-encoding: 7BIT Sven wrote > > Tanaka Akira typed: > > :Z(4):akr@serein% Src/zsh -f > > :serein% print -lr ${-str} > > :569XZfims > > Shouldn't we change this to be an error? Or do we really need this for > compatibility? Is this correct? All the parameter tests still seem to work. The first hunk simply removes an unneeded local variable. The change already picked up an extraneous closing brace in _vars_eq, which is also patched. Index: Completion/Builtins/_vars_eq =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Builtins/_vars_eq,v retrieving revision 1.6 diff -u -r1.6 _vars_eq --- Completion/Builtins/_vars_eq 2000/05/15 00:31:20 1.6 +++ Completion/Builtins/_vars_eq 2000/05/15 15:01:42 @@ -45,7 +45,7 @@ export) use="${${use/g/}/x/}" ;; esac -[[ -z "${words[(r)-*f*]]}" ]] || func=f +[[ -z "${words[(r)-*f*]}" ]] || func=f [[ -z "${words[(r)-*[aA]*]}" ]] || func=p for ((i=1;i<=$#use;++i)); do Index: Src/subst.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/subst.c,v retrieving revision 1.4 diff -u -r1.4 subst.c --- Src/subst.c 2000/05/08 08:58:37 1.4 +++ Src/subst.c 2000/05/15 15:01:42 @@ -1463,10 +1463,12 @@ } } { +#if 1 + singsub(&s); +#else char t = s[-1]; singsub(&s); -#if 0 /* * This allows # and % to be at the start of * a parameter in the substitution, which is @@ -1543,6 +1545,10 @@ } if (!inbrace) fstr = s; + else if (s != fstr && *s) { + zerr("garbage in parameter substitution: %s", s, 0); + return NULL; + } } if (errflag) return NULL; -- Peter Stephenson Cambridge Silicon Radio, Unit 300, Science Park, Milton Road, Cambridge, CB4 0XL, UK Tel: +44 (0)1223 392070