From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13366 invoked by alias); 23 Sep 2013 19:53:27 -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: 31764 Received: (qmail 10818 invoked from network); 23 Sep 2013 19:53:12 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at ntlworld.com designates 80.0.253.75 as permitted sender) X-Originating-IP: [31.51.155.8] X-Spam: 0 X-Authority: v=2.0 cv=D70fsYtj c=1 sm=1 a=3BWpU5VZxw7riCwclHOsWQ==:17 a=6CkgMyiT6DYA:10 a=uObrxnre4hsA:10 a=kj9zAlcOel0A:10 a=NLZqzBF-AAAA:8 a=7I4XmpMB7fwA:10 a=q2GGsy2AAAAA:8 a=C628KEpqctgpCL68uKEA:9 a=CjuIK1q_8ugA:10 a=I6wTmPyJxzYA:10 a=_dQi-Dcv4p4A:10 a=3BWpU5VZxw7riCwclHOsWQ==:117 Date: Mon, 23 Sep 2013 20:47:32 +0100 From: Peter Stephenson To: zsh-workers@zsh.org Subject: Re: zpc_special [was Re: question about glob qualifier format (#qx)] Message-ID: <20130923204732.28ca20f2@pws-pc.ntlworld.com> In-Reply-To: <130921163531.ZM18698@torch.brasslantern.com> References: <20130920111110.GA4501@localhost.localdomain> <20130920123830.30111071@pwslap01u.europe.root.pri> <20130920233930.GB4501@localhost.localdomain> <130921013028.ZM17637@torch.brasslantern.com> <130921163531.ZM18698@torch.brasslantern.com> X-Mailer: Claws Mail 3.8.0 (GTK+ 2.24.7; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Sat, 21 Sep 2013 16:35:31 -0700 Bart Schaefer wrote: > On Sep 21, 1:30am, Bart Schaefer wrote: > } > } I accidentally encountered some odd behavior while confirming this. > } With NO_EXTENDED_GLOB, #q is not supposed to be available to introduce > } qualifiers. However > } > } % setopt NO_EXTENDED_GLOB > } % echo *(#q@) > } > } > } Whereas > } > } % echo *(#q/) > } zsh: unknown file attribute > } > } This is inconsistent, that is, sometimes (#q@) will also give "unknown" > } and (#q/) will work. > > I believe this has to do with the new zpc_special[] array in pattern.c. I'm aware of unfinished business for actually disabling hashes, but the problem here is I'm using the array that's only initialised when you set up a pattern too early in the glob process, which is why it sometimes does the right thing after you've used a pattern. See if this fixes everything you found... diff --git a/Src/glob.c b/Src/glob.c index 9299b95..0c7d22d 100644 --- a/Src/glob.c +++ b/Src/glob.c @@ -1112,7 +1112,8 @@ zglob(LinkList list, LinkNode np, int nountok) gf_pre_words = NULL; /* Check for qualifiers */ - while (!nobareglob || zpc_special[ZPC_HASH] != Marker) { + while (!nobareglob || + (isset(EXTENDEDGLOB) && !zpc_disables[ZPC_HASH])) { struct qual *newquals; char *s; int sense, paren; @@ -1158,11 +1159,11 @@ zglob(LinkList list, LinkNode np, int nountok) case Outpar: paren++; /*FALLTHROUGH*/ case Bar: - if (zpc_special[ZPC_BAR] != Marker) + if (!zpc_disables[ZPC_BAR]) nobareglob = 1; break; case Tilde: - if (zpc_special[ZPC_TILDE] != Marker) + if (!isset(EXTENDEDGLOB) || !zpc_disables[ZPC_TILDE]) nobareglob = 1; break; case Inpar: @@ -1172,7 +1173,7 @@ zglob(LinkList list, LinkNode np, int nountok) } if (*s != Inpar) break; - if (s[1] == zpc_special[ZPC_HASH]) { + if (isset(EXTENDEDGLOB) && !zpc_disables[ZPC_HASH] && s[1] == Pound) { if (s[2] == 'q') { *s = 0; s += 2; diff --git a/Src/pattern.c b/Src/pattern.c index b7897e7..4f0166b 100644 --- a/Src/pattern.c +++ b/Src/pattern.c @@ -245,7 +245,8 @@ static const char *zpc_strings[ZPC_COUNT] = { * Corresponding array of pattern disables as set by the user * using "disable -p". */ -static char zpc_disables[ZPC_COUNT]; +/**/ +char zpc_disables[ZPC_COUNT]; /* * Stack of saved (compressed) zpc_disables for function scope. -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/