From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25530 invoked by alias); 9 Aug 2015 17:56:18 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 36027 Received: (qmail 583 invoked from network); 9 Aug 2015 17:56:14 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2 autolearn=ham autolearn_force=no version=3.4.0 X-Originating-IP: [80.3.228.158] X-Spam: 0 X-Authority: v=2.1 cv=YMdiskyx c=1 sm=1 tr=0 a=P+FLVI8RzFchTbbqTxIDRw==:117 a=P+FLVI8RzFchTbbqTxIDRw==:17 a=NLZqzBF-AAAA:8 a=kj9zAlcOel0A:10 a=pGLkceISAAAA:8 a=4dGD9cTR0QmUE1YbyuUA:9 a=CjuIK1q_8ugA:10 Date: Sun, 9 Aug 2015 18:56:10 +0100 From: Peter Stephenson To: zsh workers Subject: Re: typeset -T crash Message-ID: <20150809185610.4ee4d3e5@ntlworld.com> In-Reply-To: References: X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.28; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Wed, 5 Aug 2015 19:59:31 +0200 Mikael Magnusson wrote: > typeset -T i j k; typeset -T j i k Surely the right fix is something like this? pws diff --git a/Src/builtin.c b/Src/builtin.c index 34bad03..c63be7e 100644 --- a/Src/builtin.c +++ b/Src/builtin.c @@ -2674,7 +2674,9 @@ bin_typeset(char *name, char **argv, LinkList assigns, Options ops, int func) && (locallevel == pm->level || !(on & PM_LOCAL))) { if (pm->node.flags & PM_TIED) { unqueue_signals(); - if (!strcmp(asg->name, pm->ename)) { + if (PM_TYPE(pm->node.flags) != PM_SCALAR) { + zwarnnam(name, "already tied as non-scalar: %s", asg0.name); + } else if (!strcmp(asg->name, pm->ename)) { /* * Already tied in the fashion requested. */ diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst index 0a9e253..c7d506a 100644 --- a/Test/D04parameter.ztst +++ b/Test/D04parameter.ztst @@ -1069,6 +1069,11 @@ >a:b a b >x:y:z + typeset -T tied1 tied2 + + typeset -T tied2 tied1 + +1:Attempts to swap tied variables are safe but futile +?(eval):typeset:2: already tied as non-scalar: tied2 + string='look for a match in here' if [[ ${string%%(#b)(match)*} = "look for a " ]]; then print $match[1] $mbegin[1] $mend[1] $string[$mbegin[1],$mend[1]]