Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Id: Zsh Workers List <zsh-workers.zsh.org>
List-Post: <mailto:zsh-workers@zsh.org>
List-Help: <mailto:zsh-workers-help@zsh.org>
X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham
	autolearn_force=no version=3.4.1
X-AuditID: cbfec7f5-f792a6d000001302-fc-56f11469c076
Date: Tue, 22 Mar 2016 09:46:14 +0000
From: Peter Stephenson <p.stephenson@samsung.com>
To: Zsh Hackers' List <zsh-workers@zsh.org>
Subject: Re: PATCH: short-circuiting glob exclusion operator
Message-id: <20160322094614.13b07bf4@pwslap01u.europe.root.pri>
In-reply-to: <160321155421.ZM27019@torch.brasslantern.com>
References: <20160321183649.4fd4d72a@pwslap01u.europe.root.pri>
 <160321155421.ZM27019@torch.brasslantern.com>
Organization: Samsung Cambridge Solution Centre
X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu)
MIME-version: 1.0
Content-type: text/plain; charset=US-ASCII
Content-transfer-encoding: 7bit
X-Brightmail-Tracker:
 H4sIAAAAAAAAA+NgFrrALMWRmVeSWpSXmKPExsVy+t/xK7qZIh/DDLpvslocbH7I5MDoserg
	B6YAxigum5TUnMyy1CJ9uwSujNPXt7EXrBGsePP1JVsD413eLkZODgkBE4lnTbvYIWwxiQv3
	1rN1MXJxCAksZZRov7CGFcKZwSTx/cBUJgjnHKPEruvtjBDOWUaJIzfPg/WzCKhKHN31HMxm
	EzCUmLppNlARB4eIgLZE+0cxkLCwgI3EvklTGUFsXgF7idWXrzOD2JwCVhKnXjeBxYUE8iXm
	fJzCCmLzC+hLXP37iQniPHuJmVfOQPUKSvyYfI8FxGYW0JLYvK2JFcKWl9i85i0zxBx1iRt3
	d7NPYBSehaRlFpKWWUhaFjAyr2IUTS1NLihOSs810itOzC0uzUvXS87P3cQICeevOxiXHrM6
	xCjAwajEw9uw4UOYEGtiWXFl7iFGCQ5mJRHepV+BQrwpiZVVqUX58UWlOanFhxilOViUxHln
	7nofIiSQnliSmp2aWpBaBJNl4uCUamDkyy9/J3Eq4r7Jq5X9u9UfN1yfs/Wlh/hHLgP2lTJ9
	wSFctgtOld0qSg2Tl7GQnrJ6RcE0vgfb9b0jgmY5vIuVdCiU8dlx5k/Rs+OLHy2ZxHbaz3bj
	0a8Cj18LWTbrGSr2+dYbSD408kzrDhC7cym0Rv5ekB7D9ccVu6dovl7R4xovsq0iv16JpTgj
	0VCLuag4EQAyrrlHYwIAAA==
X-Seq: zsh-workers 38203

On Mon, 21 Mar 2016 15:54:21 -0700
Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Mar 21,  6:36pm, Peter Stephenson wrote:
> }
> } This is a request for comments for now.  I'm not yet entirely sure the
> } pattern syntax with two tildes isn't going to cause problems (though I
> } don't see what they would be), or that I've identified all the side
> } effects that can happen.
> 
> As Mikael has already pointed out, files with names ending in a tilde
> followed by an exclusion pattern may cause trouble with this.

Yes, they do: the logic was that if it saw "~~" in the middle, the first
"~" couldn't be an exclusion, because there was nothing after it other
than another "~" (exclusions have to be non-empty patterns), so it was
treated as quoted.  This would change.

~# might work instead.

> } As an ultra brief summary, ~~ in a glob introduces a pattern that will
> } prune directories on the way through in addition to acting in the normal
> } exclusion fashion.
> 
> I don't suppose it would instead be possible to special-case something at
> the END of the pattern?  E.g. **/*~*/foo/** where the trailing /** means
> to prune at whatever precedes it.

That's quite hard to parse; you're happily looking at a normal "~" and
then you find right at the end that actually it doesn't belong within
the pattern at all, instead it belongs higher up with the hierarchy of
file patterns (although ~ is already hacked a bit to apply to the whole
pattern in ways I haven't quite got to the bottom of again).

What worries me most is pat~foo~bar is supposed to exclude both
foo and bar, and I'm not sure how that could fit in here.

> I suppose that conflicts with the new GLOB_STAR_SHORT option, although
> ultimately it means exactly the same in context.

It doesn't, really, since directories aren't specially handled after the
~, or could in principle be specially handled by different means.

> Aside:  Do we really want to add this before we've figured out the
> background for "Extended globbing seems to have become much slower"?

No hurry, but I have no idea where that's going and we already seem to
have excluded most of the things we know about...

pws

