zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@ibmth.df.unipi.it>
To: zsh-workers@math.gatech.edu (Zsh hackers list)
Subject: PATCH: 3.1.5: Case-insensitive globbing (2)
Date: Thu, 05 Nov 1998 10:26:57 +0100	[thread overview]
Message-ID: <9811050926.AA34182@ibmth.df.unipi.it> (raw)
In-Reply-To: ""Bart Schaefer""'s message of "Wed, 04 Nov 1998 10:48:58 NFT." <981104104858.ZM21585@candle.brasslantern.com>

(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 <pws@ibmth.df.unipi.it>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarotti 2, 56100 Pisa, Italy


  reply	other threads:[~1998-11-05  9:45 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-10-31 10:14 PATCH: 3.1.5 - (Sven) Case-insensitive globbing Bart Schaefer
1998-11-02  9:21 ` Zefram
1998-11-02 17:07   ` Peter Stephenson
1998-11-02 17:45     ` Bruce Stephens
1998-11-02 18:06     ` Zefram
1998-11-03  8:12       ` Sven Wischnowsky
1998-11-03 12:22         ` Bruce Stephens
1998-11-03 12:47           ` Bruce Stephens
1998-11-03 15:01             ` Zefram
1998-11-03 15:27               ` Bruce Stephens
     [not found]         ` <MLIST_vbn269dkyw.fsf@snake.isode.com>
1998-11-03 18:09           ` Jarkko Hietaniemi
1998-11-03 18:54             ` Zefram
1998-11-03 19:14               ` Jarkko Hietaniemi
1998-11-03 19:27                 ` Zefram
1998-11-03 19:36                   ` Jarkko Hietaniemi
1998-11-04 18:48                     ` Bart Schaefer
1998-11-05  9:26                       ` Peter Stephenson [this message]
1998-11-05 18:15                         ` PATCH: 3.1.5: Case-insensitive globbing (2) Bart Schaefer
1998-11-06 11:01                           ` PATCH: 3.1.5: doc fix, was re: Case-insensitive globbing Peter Stephenson
1998-11-06 13:43                             ` Bruce Stephens
1998-11-06  9:24                     ` Approximate matching Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9811050926.AA34182@ibmth.df.unipi.it \
    --to=pws@ibmth.df.unipi.it \
    --cc=zsh-workers@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).