From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6632 invoked from network); 14 Sep 2000 16:55:57 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 14 Sep 2000 16:55:57 -0000 Received: (qmail 3777 invoked by alias); 14 Sep 2000 16:55:20 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 12806 Received: (qmail 3770 invoked from network); 14 Sep 2000 16:55:20 -0000 X-Envelope-Sender-Is: Andrej.Borsenkow@mow.siemens.ru (at relayer david.siemens.de) From: "Andrej Borsenkow" To: Subject: RE: PATCH: "typeset -m" plays havoc Date: Thu, 14 Sep 2000 20:55:16 +0400 Message-ID: <005101c01e6c$8e67ea50$21c9ca95@mow.siemens.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) Importance: Normal In-Reply-To: <1000914154206.ZM12447@candle.brasslantern.com> X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 > Don't try this: > > zsh% splat() { typeset -m \* } > zsh% splat > > The result is that all non-readonly/non-special parameters get stomped on, > which leaves zsh in a pretty sorry state. > > The behavior up to 3.1.5 or so was that `-m' implied the equivalent of `-g', > so I think the following is the most expedient patch. Peter? > What happens in case of splat() { typeset -F -m \* } ?? Currently it creates local floating point parameters and then breaks on first special one (in may case it is cdpath). With this patch, won't it silently change type of global parameters? Also, consider: bor@itsrm2% splat () {typeset cdpath} bor@itsrm2% splat If I can believe manual: For each remaining NAME that refers to a parameter that is set, the name and value of the parameter are printed in the form of an assignment. Nothing is printed for newly-created parameters, or if any attribute flags listed below are given. Using `+' instead of minus to introduce an attribute turns it off. In our case cdpath is definitely set; but what we get is creation of local cdpath. The suggested patch seems to take care of the both. It is on top of Bart's. Peter? Index: Src/builtin.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/builtin.c,v retrieving revision 1.32 diff -u -r1.32 builtin.c --- Src/builtin.c 2000/09/14 15:55:00 1.32 +++ Src/builtin.c 2000/09/14 16:54:31 @@ -1800,7 +1800,7 @@ Asgment asg; Patprog pprog; char *optstr = TYPESET_OPTSTR; - int on = 0, off = 0, roff, bit = PM_ARRAY; + int on = 0, off = 0, ron, roff, bit = PM_ARRAY; int i; int returnval = 0, printflags = 0; @@ -1816,6 +1816,7 @@ on |= bit; else if (ops[STOUC(*optstr)] == 2) off |= bit; + ron = on; roff = off; /* Sanity checks on the options. Remove conficting options. */ @@ -1858,7 +1859,8 @@ return 0; } - if ((!ops['g'] && !ops['x']) || ops['g'] == 2 || *name == 'l' || + if ((!ops['g'] && !ops['x'] && (ron || roff)) + || ops['g'] == 2 || *name == 'l' || !isset(GLOBALEXPORT)) on |= PM_LOCAL; @@ -1942,7 +1944,6 @@ /* With the -m option, treat arguments as glob patterns */ if (ops['m']) { - on &= ~PM_LOCAL; while ((asg = getasg(*argv++))) { LinkList pmlist = newlinklist(); LinkNode pmnode;