From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1299 invoked from network); 8 Feb 2000 09:25:44 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 8 Feb 2000 09:25:44 -0000 Received: (qmail 18977 invoked by alias); 8 Feb 2000 09:25:37 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9614 Received: (qmail 18968 invoked from network); 8 Feb 2000 09:25:37 -0000 Date: Tue, 8 Feb 2000 10:25:35 +0100 (MET) Message-Id: <200002080925.KAA01349@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: "Bart Schaefer"'s message of Mon, 7 Feb 2000 21:19:29 -0800 Subject: Re: Zsh 3.1.6 - ${~foo} expansion bug Bart Schaefer wrote: > On Feb 8, 12:16am, Alexandre Duret-Lutz wrote: > > Subject: Re: Zsh 3.1.6 - ${~foo} expansion bug > > > > From my experiments I am tempted to deduce that this is > > reproducible as long as you don't call a builtin before > > the for loop. > > This is exactly correct; I recompiled with --disable-zshenv to be > absolutely certain that no commands were executed by "zsh -f", > and now I can reproduce the problem as well. > > Tracing through, I find that after a builtin has been executed, > the `esglob' == 1 at exec.c:1516. The first time through the "for" > loop, when it misbehaves, `esglob' == 0. And sure enough, esglob > is a static which is not initialized until execcmd() is called. > > I imagine there some similar problem with `esprefork'. I don't > know where these should be getting initialized, though, nor what > the right starting value for `esprefork' should be, though `esglob' > clearly ought to be initialized to 1. The initialisation to `1' for esglob in the patch below shouldn't really be necessary, because both es* should be set up when one of the functions calling execsubst() will be called. What really confused me is that the test was still in the order in which it was. I *know* I once changed that -- obviously I didn't send a patch for it. Sorry! Bye Sven diff -ru ../z.old/Src/exec.c Src/exec.c --- ../z.old/Src/exec.c Tue Feb 8 10:16:04 2000 +++ Src/exec.c Tue Feb 8 10:22:15 2000 @@ -1506,7 +1506,7 @@ } } -static int esprefork, esglob; +static int esprefork, esglob = 1; /**/ void @@ -1917,10 +1917,10 @@ is_exec = 1; } - if (args && (esglob = !(cflags & BINF_NOGLOB))) { + if ((esglob = !(cflags & BINF_NOGLOB)) && args) { LinkList oargs = args; globlist(args); - args=oargs; + args = oargs; } if (errflag) { lastval = 1; -- Sven Wischnowsky wischnow@informatik.hu-berlin.de