From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 824 invoked from network); 5 Nov 1998 09:45:04 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 5 Nov 1998 09:45:04 -0000 Received: (from list@localhost) by math.gatech.edu (8.9.1/8.9.1) id EAA20718; Thu, 5 Nov 1998 04:42:15 -0500 (EST) Resent-Date: Thu, 5 Nov 1998 04:42:15 -0500 (EST) Message-Id: <9811050926.AA34182@ibmth.df.unipi.it> To: zsh-workers@math.gatech.edu (Zsh hackers list) Subject: PATCH: 3.1.5: Case-insensitive globbing (2) In-Reply-To: ""Bart Schaefer""'s message of "Wed, 04 Nov 1998 10:48:58 NFT." <981104104858.ZM21585@candle.brasslantern.com> Date: Thu, 05 Nov 1998 10:26:57 +0100 From: Peter Stephenson Resent-Message-ID: <"jEl-w1.0.c35.tBNGs"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/4552 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu (The necessity for the extra patch turned up while I was thinking about these examples, see below.) "Bart Schaefer" wrote: > However, I'm curious how (#i) interacts with parenthesis for grouping. > For example: > > zsh% echo zsh-3.1.5/((#i)src/zle|doc/zsh)/make* > > Where does the case-insensitivity stop in that expression? It would be > logical for it to stop at either the vertical bar or the close paren. To the best of my knowedge, zsh has never allowed grouping to cross directories, i.e. not even (Src/Zle) is supported. You'll find that everything between the / and the next ) is ignored. This is because the path segment code, which is separate from the pattern matching code, has never been rewritten to understand grouping. So the question has never (yet) arisen. It's always seemed like a long job to fix this, so I for one have never thought seriously about it. Documenting it might be an idea. In the case above, % echo zsh-3.1.5/(#i){src/zle,doc/zsh}/(#I)make* should work if you know there are files matching both branches of the {...}. Whoops, there's a minor bug: (#I) wasn't turned off for the `make' string. The patch fixes that. > BTW, is there going to be a parsing conflict between things like > ((#i)src) and math expressions in (( ))? How do you get the desired > glob behavior if there is? The conflict only applies to words in command position, either on the line itself or at the start of a $(...) where there is a confusion with $((...)). It turns out that ((#i)src) at the start of the line is interpreted as starting two subshells, followed by a comment. However, once again it looks like even the existing behaviour is a bit counter-intuitive: % /(bin|var)/false zsh: permission denied: / It seems zsh treats (and has always treated) left parentheses inside the command word differently. When you think about it, it's probably obvious because it's expected to parse a whole command string at once, so if it's sensitive to a `(' at the start it will be anywhere else in the word. So you can't have any form of grouping in the command word. But is it a good idea? You don't know beforehand what command it's going to run. *** Src/glob.c.ci2 Thu Nov 5 10:20:04 1998 --- Src/glob.c Thu Nov 5 10:17:58 1998 *************** *** 579,585 **** return NULL; if (eptr == cstr) { /* if no string yet, carry on and get one. */ ! c->stat |= addflags; cstr = pptr; continue; } --- 579,585 ---- return NULL; if (eptr == cstr) { /* if no string yet, carry on and get one. */ ! c->stat = addflags; cstr = pptr; continue; } -- Peter Stephenson Tel: +39 050 844536 WWW: http://www.ifh.de/~pws/ Dipartimento di Fisica, Via Buonarotti 2, 56100 Pisa, Italy