zsh-users
 help / color / mirror / code / Atom feed
From: Mikael Magnusson <mikachu@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Perry Smith <pedz@easesoftware.com>, Zsh Users <zsh-users@zsh.org>
Subject: Re: Is this a bug?
Date: Tue, 19 Apr 2022 23:53:29 +0200	[thread overview]
Message-ID: <CAHYJk3ReVeuF7SZ3BHrNVnh5C3O+rapfexCfLJr2nwLKfj50UQ@mail.gmail.com> (raw)
In-Reply-To: <CAH+w=7ZUkzTRZf-G9EOjXXc6i36iD41Mn34MVN_rDggoOeKTdg@mail.gmail.com>

On 4/19/22, Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Tue, Apr 19, 2022 at 10:13 AM Mikael Magnusson <mikachu@gmail.com>
> wrote:
>>
>> Hmm?
>> % mkdir -p {a,Volumes}/{b,Volumes}/{c,Volumes}
>> % print -l ((^Volumes)/)#
>> a/
>> a/b/
>> a/b/c/
>
> Sure, but try ((^Volumes)/)#/ and suddenly you're recursing from the root.

There's no reason to append this extra slash, (foo/)#hello works fine
to match bar/hello (but not /hello).

% touch a/b/c/hello
% print -l ((^Volumes)/)#hello
a/b/c/hello


> For Perry's specific use case, ./((^Volumes)/)#/ is OK, because he
> only cares about directories, bad things can happen if you end that
> with another glob.  I discounted ./((^Volumes)/)#/(^Volumes) but
> that's because it runs afoul of bare_glob_qual, it works if you unset
> that or append some other qualifier to force (^...) to be taken as a
> pattern.

Afaict, ((^Volumes)/)#^Volumes should work fine there.

% touch **/*(/e*'REPLY+=/bar'*)
% print -l ((^Volumes)/)#^Volumes
a
a/b
a/b/bar
a/b/c
a/b/c/bar
a/b/c/hello
a/bar


-- 
Mikael Magnusson


      reply	other threads:[~2022-04-19 21:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-19  2:02 Perry Smith
2022-04-19  3:05 ` Bart Schaefer
2022-04-19 12:33   ` Perry Smith
2022-04-19 16:53     ` Bart Schaefer
2022-04-19 17:13       ` Mikael Magnusson
2022-04-19 21:06         ` Bart Schaefer
2022-04-19 21:53           ` Mikael Magnusson [this message]

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=CAHYJk3ReVeuF7SZ3BHrNVnh5C3O+rapfexCfLJr2nwLKfj50UQ@mail.gmail.com \
    --to=mikachu@gmail.com \
    --cc=pedz@easesoftware.com \
    --cc=schaefer@brasslantern.com \
    --cc=zsh-users@zsh.org \
    --subject='Re: Is this a bug?' \
    /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

Code repositories for project(s) associated with this 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).